Using OpenLayers to Convert Data

OpenLayers has the ability to read and write geographic data in several different formats: KML, GML, GeoRSS (Simple and GML), GeoJSON, WKT. One of the things that hasn’t thus far been exploited as a result of this is the use of OpenLayers as a format conversion tool… until today.

OpenLayers Data Conversion is a new service that allows easy conversion from any of the formats that OpenLayers supports to any of the formats that OpenLayers supports. Simply paste your data, choose your format, and hit convert. Additionally, this tool supports reprojection to and from Spherical Mercator, the internal coordinate system used in Google Maps.

This code isn’t quite in trunk of OpenLayers yet, but in the meantime, you can grab the example from an svn sandbox, including the prebuilt lightweight OpenLayers build for format conversion.

10 Responses to “Using OpenLayers to Convert Data”

  1. Dylan Says:

    Hi Chris,

    I like your enthusiasm and appreciate what open layers is- but isn’t what you are proposing here just a web front-end to GDAL and PROJ ?

    maybe I am missing something

    Cheers,

    Dylan

  2. crschmidt Says:

    Dylan:

    Nope. This is entirely clientside Javascript: No OGR, Proj, or server side dependancies involved. (Just watch your network connection, if you don’t believe me: playing around with the demo will cause no network traffic.)

    Note that I’m not ‘proposing’ anything — these are just bits that are going to need to go into OpenLayers for other reasons. I just thought it was fun to be able to pull them together like this — and demonstrate that OpenLayers is more than just a map drawing library.

  3. Brian Timoney Says:

    Chris:

    The client-side WGS84 GMap/VE projection functionality is very tasty, I’m sure thanks from Google and Microsoft will be coming forthwith….

    Brian

  4. Kusum Says:

    Hii Chris
    The converter u explained above is a very useful tool.
    I am also working on this these days as i want my application to be able to load and show any kind of data supported.like if i give the path of a file it is able to load it and show me the maps.

    But the data conversions example urls u have mentioned above dont work
    may be its removed from that place.
    Pls check and update the urls
    It would be real nice of You

    Regards
    Kusum

  5. claybo Says:

    Hiya – great post, thanks. Unfortunately the link you’ve posted is now dead . Is that file hosted anywhere else?

    Regards

  6. routh Says:

    *BUMPING* the request for the content of those old links… or an update… or something!

    Cheers!

  7. crschmidt Says:

    svn co -r 6060 http://svn.openlayers.org/sandbox/crschmidt/projection

    This will get you the code.

  8. Ric Says:

    Hi. That svn repo doesn’t seem to exist any more either. Do you have the code somewhere else, please? I’d love to see how you converted from KML to GeoJSON.

  9. Alexboss Says:

    Yep, can’t find the repo but would need this resource ! Is it possible to get the code please ? (for those who are interested, they may check this converter too http://blog.renevier.net/index.php?post/2010/05/27/gisconverter.php%3A-un-convertisseur-kml-geojson-wkt – unfortunately it’s too restrictive too mee)

  10. Alexboss Says:

    Argh…. maybe here finally http://trac.osgeo.org/openlayers/browser/sandbox/crschmidt/projection?rev=5427 ?