-1

I'm using openlayers 2.12 and I'm wondering how could upload shp, kml, csv, gml into the browser, just as a temporary layer wich user could see it.

Is there any library or way to do it?

1

You could use the FileAPI: http://www.w3.org/TR/FileAPI/

Here is one example: http://renevier.net/misc/mapfileapi.html

If you need a kml file to test: http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/kml/sundials.kml

And here the browsers that support the fileapi: http://caniuse.com/#feat=fileapi

The same as jsfiddle for own tests:

http://jsfiddle.net/expedio/v0nkgebh/

  • thanks @Thomas! You know some tool to do it with shapefile? (this format I'm really interested in) – VFG Oct 15 '15 at 10:07
  • You could use this: github.com/wavded/js-shapefile-to-geojson but kml / geojson are better formats for this reading them at clientside... – Thomas B Oct 15 '15 at 10:37

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.