Specifically into NAD83.

Google tells me that KML only supports WGS84, but I can't seem to find much info on being able to reproject KML using ESRI's Javascript API.

Basically, I've got this base map in Nad83 and I need to overlay some kml.

  • KML is specially WGS84 you would need your base-map to accommodate the KML – Mapperz Oct 17 '11 at 17:38
  • I realize that, but is there no way to do the reprojection on the fly with the js api? – Carter Oct 17 '11 at 17:49

Yes, the ArcGIS API for JavaScript's KMLLayer class relies on a hosted service that converts a KML file to JSON. To re-project, specify an outSR in the constructor options when creating your KML layer.

  • please update the links with latest example. – Sunil Aug 23 '13 at 5:32

No, the js api cannot reproject on the fly. The KML needs to match the base service that you are using. The js api can convert WGS84 geometries to Web Mercator, but that is all it can do.

  • For the use case outlined by Carter, I disagree. When's the last time you saw a KML file in anything other than WGS84? With the JS API, when you create a KMLLayer, the KML file is sent to a service and converted to JSON. As part of this conversion, you can specify a spatial reference(wkid or wkt) and the features from the KML file will be returned in that spatial reference. The re-projection isn't happening client side but you do end up with re-projected features. Side note: don't forget that the JS API can also convert Web Mercator --> Geographic client side as well. – Derek Swingley Oct 18 '11 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.