Select to view content in your preferred language

Widget to export line/polygon to KML

710
1
11-30-2021 12:03 PM
JohnSasso2
Frequent Contributor

I am prompting a request made often before, yet unanswered.  Is there a custom widget available that will allow one to draw lines and/or polygons and export what was drawn to a KML file?  Its pretty simple.  Just what was drawn and that's it.  I am surprised something like this is not available already, unless I missed something in my searches.   Thanks!

0 Kudos
1 Reply
StanislausCounty
Regular Contributor

I don't know of a specific ESRI widget but assuming you are using an underlying feature layer on which the user is drawing you should be able to make a pop-up with an arcade expression that drops out a url that references the rest service and spits out a geojson response. From there there are a ton of free web converters you can use to go from that to kml. Otherwise you could code up your own widget using javascript that does essentially the same thing. See this thread for an example (that poster is using leaflet but the geojson conversion using javascript should be the same): javascript - Leaflet.Draw - geoJSON to Kml - Stack Overflow

As an aside, ESRI has their own implementation of leaflet as well if you wanted to give that a go: Esri Leaflet

 

0 Kudos