Upload KML file to Map.

2907
4
07-12-2019 05:39 AM
irtizahussain
Occasional Contributor

I'm working on web application where i use arcgis api for JS 4.10,i want to upload kml/ kmz file to the map same as This sample working, in this sample shape file is used where i want to upload kml/kmz. Is this possible !! need assistance.

Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Irtiza,

  I assume you have already seem the KMLLayer class?

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-KMLLayer.html

There is no way that I know of to upload a KML via a file selector dialog like is shown in that sample for a shapefile. The KMLLayer only accepts a url.

0 Kudos
irtizahussain
Occasional Contributor

Ok. So can we modify the shape file sample and make it to upload kml instead of shape file.!!

RobertScheitlin__GISP
MVP Emeritus
There is no way that I know of to upload a KML via a file selector dialog like is shown in that sample for a shapefile. The KMLLayer only accepts a url.
BenElan
Esri Contributor

Robert is correct. However a few workarounds were suggested in this thread that you can try:

https://community.esri.com/thread/183421-how-can-i-load-local-kml-file-as-kmllayer