Export to KML Widget

1736
10
08-01-2022 12:39 PM
Labels (3)
SinChew3
New Contributor

Has anyone created an export to KML widget? I have a dashboard and would like to create a custom widget that allows non-GIS users to be able to select features and be able to automatically export to KML file. 

10 Replies
USLEOperations
New Contributor III

Such a widget would be very helpful to have in Experience Builder, too.  Given the apparent glacial progress in essential enhancements to EB, I doubt this will happen 😞

0 Kudos
JamesCrandall
MVP Frequent Contributor

My personal preference would be to create a GP tool (python) to perform the conversion, publish it as a GP Service and make requests to it from your web application (whatever form that may be).  Just build it off the Layer To KML tool and publish it out as a GP service.

 

You can run thru the gauntlet of possible Javscript solutions but I don't believe there's any ESRI Javascript api options available.  You would probably need to format any input as GeoJSON first then perhaps need to hit other api's that could do the conversion for you (some are free but may have frequency limits on the number of requests). 

 

It looks like there'a generateKML option available on Enterprise services? Not sure about that tho.  

Katie_Clark
MVP Regular Contributor

@JamesCrandall I am very new to creating geoprocessing services, but I attempted this building off the Layer to KML tool, as you suggested.

When I use the service in a widget and try to select features, the server returns an error saying:  ERROR 000840: The value is not a Layer.

As I said, I am extremely new to this process and I'm sure I made a novice mistake when setting up the service. Could you possibly provide additional information on the best way to set up this service?

Thank you so much!

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos
JamesCrandall
MVP Frequent Contributor

Hi Katherine!

What is the output parameter of your GP tool?  I'm unsure what the application is expecting to render it as or what would be appropriate.  I think my comments above to the original post were more about generating an output of a zipped up kml that would end up in a the user's downloads folder.  If that's the case, your python script source would need to execute the "Layer To KML" tool then implement code to zip that up and send via the output parameter.

0 Kudos
sapnas
by
Occasional Contributor III

I had created an "export to KMZ" widget for web appbuilder which allowed users to export the graphics to the KMZ file. It was a combination of c# and JavaScript.

sajjady
New Contributor III

could you please share theexport to kmz widget

0 Kudos
sapnas
by
Occasional Contributor III

The widget requires the server-side component to work. If you are proficient with C# programming then you may want to look into the SharpKML library which pretty much covers all the geometric shapes.

0 Kudos
sajjady
New Contributor III

Could you please share

 

0 Kudos
sapnas
by
Occasional Contributor III

The widget (Draw.zip) and the C# controller, Model (KMZFileGISController.zip) is attached. I am unable to attach the entire C# project since it has other rest api implementation. You will have to replace the url within config.json with your desired REST service. 

"KMZExportService": "https://localhost/GISUtilRestService/api"