-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VectorTileLayer - How to control vector layer draw order #1232
Comments
Perhaps I was wrong about
That gives:
There doesn't appear to be a |
Hi @drclanc-oss . Unfortunately, I don't think there is a way to control the order. However, you can try adding multiple leaflet layers with different from ipyleaflet import Map, VectorTileLayer
world_tiles_url = "https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/{z}/{y}/{x}.pbf"
bathymetry_style='''{
"Graticule/label":[],
"Graticule":[],
"Marine area":[],
"Bathymetry": function(properties, zoom, geometryDimension){
L.Path.mergeOptions({stroke:false}); // HACK
var color;
# ... your code to assign color based on the property
return {
fillColor: color,
fill: true,
weight: 0,
opacity: 1,
fillOpacity: 1
}
}
}
'''
marine_area_style='''{
"Marine area": {"fillOpacity": 1, "color": "#e7f9ff", "fill": true},
}
'''
bathymetry = VectorTileLayer(
url=world_tiles_url,
vector_tile_layer_styles=bathymetry_style,
name="Bathymetry Basemap"
)
marine_areas = VectorTileLayer(
url=world_tiles_url,
vector_tile_layer_styles=marine_area_style,
name="Marine areas"
)
m = Map(center=[30, -65], zoom=4)
[m.remove(lyr) for lyr in m.layers]
m.add(marine_areas)
m.add(bathymetry)
bathymetry.redraw() # Hack.
m I think this is what you are looking for, right? However, there is one problem with your vector tile layer: it seems there are extra Line features that are not contained in any "layer", i.e. they are not coming from either of In leaflet.js, you could update In the code I shared above, I did it in a hacky way.. I updated |
Thanks @lopezvoliver I appreciate your insight. |
I am trying to make an ocean map layer, including bathymetry, from this Esri vector tile service. I am able to style the various bathymetry depths by providing a JavaScript string to the
vector_tile_layer_styles
param on theVectorTileLayer
constructor and it works well.'0.19.2'
This looks pretty good!
However, the water areas nearest the coastlines is not filled. This is because the required features are in the "Marine area" layer; when I uncomment the "Marine area" style in my
jstyle
above those areas are indeed filled, but the features cover up my bathymetry.When I look at these vector tiles using Esri's style editor the layers draw in the correct order: https://www.arcgis.com/apps/vtseditor/en/#/7dc6cea0b1764a1f9af2e679f642f0f5/layers
Can I control the layer draw order somehow? From everything I've read, this is controlled in the vector tiles themselves via the
zIndex
. In this case I want theMarine area
layer to draw underneath theBathymetry
layer instead of on top of it.The text was updated successfully, but these errors were encountered: