Skip to content

Conversation

@mumeraltaf
Copy link

Addressing #937 and #563. Added a function to add vector tiles as base layer (namely protobuf) to a map.
Using VectorGrid plugin.
Usage Example: examples/VectorGrid.ipynb

folium/folium.py Outdated
for obj in args:
self.objects_to_stay_in_front.append(obj)

def add_vector_grid_protobuf(self,tiles,name=None,options=None):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ','

folium/folium.py Outdated
"""
_default_js.append(
('vectorGrid','https://unpkg.com/[email protected]/dist/Leaflet.VectorGrid.bundled.js'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ','

folium/folium.py Outdated
"""
_default_js.append(
('vectorGrid','https://unpkg.com/[email protected]/dist/Leaflet.VectorGrid.bundled.js'))
vectorGrid = VectorGrid(tiles=tiles,name=name,options=options)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ','

folium/folium.py Outdated
_default_js.append(
('vectorGrid','https://unpkg.com/[email protected]/dist/Leaflet.VectorGrid.bundled.js'))
vectorGrid = VectorGrid(tiles=tiles,name=name,options=options)
self.add_child(vectorGrid,name=name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ','

vectorGrid = VectorGrid(tiles=tiles,name=name,options=options)
self.add_child(vectorGrid,name=name)


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W391 blank line at end of file

from folium.map import Marker, Layer

from jinja2 import Template
from jinja2 import Environment, PackageLoader, Template

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'jinja2.Environment' imported but unused
F401 'jinja2.PackageLoader' imported but unused

@Conengmo Conengmo added the waiting for review PR is waiting to be reviewed label Oct 15, 2018
@ocefpaf
Copy link
Member

ocefpaf commented Nov 7, 2018

@mumeraltaf sorry for the long time to review this. Nice stuff and great feature you have here but have you considered creating an external plugin and depend on folium instead?

The reason I say this is b/c we won't be able to maintain the code. I would also recommend you pinning the folium version to ensure the plugin won't break with new updates. (Something you cannot do if this is part if the main folium.)

@Conengmo
Copy link
Member

Conengmo commented Nov 25, 2018

I think this PR is nicely done, code looks good. Thanks for your effort @mumeraltaf! I'm inclined to include this in the repository because:

  • It's not that heavy in code
  • The underlying library is in the Leaflet github organization
  • and seems to be actively maintained

I would propose to move it to it's own plugin module though, since the appeal is not that broad (I assume) and technically it is a plugin.

Furthermore, I think it's best not to include the VectorGridChoropleth since it seems fragile. We've learned from our current Choropleth class that users get confused about how to use it, and much validation and documentation is needed. Let's not repeat a second time.

Also, the two methods in Map should be removed.

Here are links to the two notebooks, which aren't working it seems by the way:
http://nbviewer.jupyter.org/github/AURIN/folium/blob/master/examples/VectorGrid.ipynb
http://nbviewer.jupyter.org/github/AURIN/folium/blob/master/examples/VectorChoropleth.ipynb

@Conengmo Conengmo added in discussion This PR or issue is being discussed and removed waiting for review PR is waiting to be reviewed labels Nov 25, 2018
@ocefpaf ocefpaf force-pushed the master branch 3 times, most recently from 53546b8 to 9f2299a Compare February 26, 2019 19:49
@RenoFilla
Copy link

OK, so has this functionality been picked up anywhere yet? I like to display airspace using OpenAIP (https://maps.openaip.net) which is a vector tile layer as far as I can see:

var OpenAIP = L.tileLayer('http://{s}.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{y}.{ext}', {
attribution: 'openAIP Data (CC-BY-NC-SA)',
ext: 'png',
minZoom: 4,
maxZoom: 14,
tms: true,
detectRetina: true,
subdomains: '12'
});

@Conengmo
Copy link
Member

Conengmo commented Nov 7, 2022

This PR is very stale, so I'm going to close it now. This feature is still welcome, so if somebody wants to pick up the work here and address the comments (#943 (comment)) in a new PR that would be appreciated!

@Conengmo Conengmo closed this Nov 7, 2022
@Conengmo
Copy link
Member

This was also partially implemented in #1576, available in the 0.13.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in discussion This PR or issue is being discussed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants