Hi guys,
I'm attempting create multiple views off of a single feature layer -
I can copy a view I've created but I cant modify the visible area (trying to make views for different parts of the country)
This appears to be the geometry filter on the view :
AFeatureLayer.manager.properties.adminLayerInfo.viewLayerDefinition.table.filter.value.geometry
I've attempted to take a copy of the manager properties - modify the geometry value and then run
AFeatureLayer.manager.update_definition(copy_of_properties)
this returns an error message :
RuntimeError: Unable to update feature service layer definition.
Invalid definition for 'LastEditDate'.
Invalid definition for ESRI.ArcGIS.SDS.Metadata.EditingInfo
Then I attempted to only update using only AFeatureLayer.manager.properties.adminLayerInfo
with the geometry changed . This returns {'success': True}
This doesnt seem to actually update the layer and the view doesnt change filter when reloaded -
Any suggestions would be very useful as I cant find any documentation
figured it out
view_def = {"viewLayerDefinition":{"filter":
{"operator":"esriSpatialRelIntersects","value":
{"geometryType":"esriGeometryPolygon","geometry":
{'rings': [[[some coords]]]}
"spatialReference":{"wkid":29900,"latestWkid":29902}}}}}
AFeatureLayer.manager.update_definition(view_def )
now I'm struggling with copying a view itself as I noticed my filter applied to the copy and the original View any suggestions would be a great help
Hi Oisin Slevin,
I did have a similar question last year, and this forum provided me with the answer 🙂
You have already found out how to apply the the updateDefinition operation on the view layer to set an area of interest.
And now the trick is not to copy a view, but to create multiple views for the same FeatureLayerCollection, and then set the area of interest for each of these views.
See my original question, and the response by Earl Medina here:
ArcGIS API for Python: set an Area of Interest on a Hosted Feature Layer View?
In this blog I present a script looping through a FeatureLayer with geometries (12 provinces in the Netherlands), to create a view with all the police stations in each of these provinces:
Please let us know whether or not this solves your issue 🙂
BR,
Egge-Jan
Hi Egge-Jan
The reason I want to be able to copy is a User is creating the view with specific rules, /stylings / permissions as a template.
I just want to be able to replicate it for the User for multiple locations quickly.
Otherwise I need to figure out how to replicate his view - ie give users permissions and custom styling etc using code and updating the definitions, where as a Copy would make this much simpler - as the user may want to change the view template in the future
Is there a way to create a view of the same data and then copy view parameters from a template view ?