I am using the ArcGIS library in Python.
I was able to create a WebMap with the command
<SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">WebMap</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">()</SPAN>
I added some Layers on it with the command
<SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">add_layer </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">()</SPAN>
I added property on Web Map
and saved my changes.
But I didn't have Extent (Zoom to layer) in my filtered Layers
I would like to get the extent of the filtered layer to pass the extent in the webmap, does anyone know any way?
Library - https://esri.github.io/arcgis-python-api/apidoc/html/index.html
Hi Vitor Ribeiro,
If you know the extent, you can call
.update(item_properties={'extent': extent})
https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.gis.toc.html#item
@DerrickWong i'm calling the extent of the feature im interested, but when i publish the webmap the zoom is still at global level. How could i fix it?
This form works, but returns something empty.
These steps I followed to child Web Map with my desired information. The biggest problem is zooming to the extent of Filtered Layers.
- I created WebMap ()
- Add 2 layers to wb
- I gave a definitionExpression on my layers (as shown in print)
- Set up webmap_item_properties with title
- snippet and tags
- I finally saved the Web Map
Unfortunately the extent of the Map is too far away, showing the entire globe of the basemap. I would like to know if it is possible to zoom the moment you filter in definitionExpression?
Here's a screenshot of my Jupyter Notebook
In the empty line was my sql, but I had personal information and could not publish, but it was working
You should be able to grab the extent from the layer object that is returned from a search:
Here's a sample code:
from arcgis.gis import GISgis = GIS("https://ABC.maps.arcgis.com", "USERNAME", "PASSWORD")search_result = gis.content.search('title:LayerOfInterest', item_type = 'Feature Service')
if len(search_result) > 0: layer = search_result[0] #assuming we want the first layer. print(layer.extent)
Attached is a screenshot of the code running on my AGOL with the results displayed in the output.
Hope that helps.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.