Calculate extent of KML layer in ArcGIS Online

562
3
08-12-2019 07:48 AM
WilliamFerster
New Contributor

Is there any way to calculate the extent of a KML layer loaded from the web using the  KMLLayer({ url: "my file" }) method in ArcGIS Online?   

The KMLs loaded AGOL have a valid fullExtent property, but ones loaded from other sources seem to default to the entire world, which is not useful.

0 Kudos
3 Replies
WilliamFerster
New Contributor

Here is an example:

app.kml=new KMLLayer({ url: "my file" });                                                                                     app.map.add(app.kml);                                                                                                     app.kml.load().then(function() { app.mapView.extent=app.kml.fullExtent; console.log(app.kml) });

It is live at:

http://viseyes.org/visualeyes/test.htm?kml=https://www.arcgis.com/sharing/rest/content/items/a8efe6f...

The console prints out the KMLLayer object, and the fullExtent field seems to be not set right.

0 Kudos
AshokVanam1
New Contributor III

Hi William, try importing the Kml features into Graphic Layers and use it extents.

regards

ashok

0 Kudos
WilliamFerster
New Contributor

ok. I'll try that. Thanks!

0 Kudos