Select to view content in your preferred language

Update GeoJSONLayer URL parameter and refresh

1479
2
Jump to solution
02-22-2022 01:41 PM
ArnauForner
Emerging Contributor

Hello

Is it possible to change the URL property of a GeoJSONLayer and .refresh(), so that it fetches a new set of data, overwrites the previous one and displays it on the map?

I need a different URL, not just a different query string, which I know it is possible by using .createQuery()  .queryFeatures().

Thanks

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

This cannot be done and goes for all layers. You'd have to create a new instance of GeoJSONLayer for each unique URLs. 

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

This cannot be done and goes for all layers. You'd have to create a new instance of GeoJSONLayer for each unique URLs. 

rhys-kdrm
Emerging Contributor

I know this is an old post, but in case anyone comes across this, yes this is possible.  I wrote a LinkedIn article on this a while ago: https://www.linkedin.com/pulse/how-load-geojson-from-postgres-using-bounding-box-arcgis-donoghue - how to load GeoJSON using a bounding box.  You shouldn't change the URL, you should just change the query string parameters using the custom parameters for the layer.  If you really do have different URLs and cannot change them, then you can set up a service that handles the different URLs, and then use that service URL in your app.  I occasionally do this when I need to integrate non-ArcGIS systems with ArcGIS Enterprise or ArcGIS Online.

0 Kudos