Monthly Archives: October 2012

Leaflet Vector Layers version 1.3.0 released

That took a really long time. Sorry.

But an updated version of Leaflet Vector Layers is out with support for Leaflet version 0.4.x.

Also in this release:

  • Fixed a bug where GeoIQ was returning JSON wrapped in single quotes, then they didn’t, then this layer type broke.
  • Reduce file size by 6k because I was dumb and duplicating some code. There’s probably still some room for improvement here.
  • Added code examples for GISCloud.

GeoJSON validation via geojsonlint.com

Here at MapMyFitness we’ve been increasing our usage of the GeoJSON format over the last few months. Whether it’s displaying routes on a Google Map or processing data between subsystems, GeoJSON has proven to be a simple dialect for describing various geo features in our systems.

One thing I’ve been wanting to do for quite some time is build a GeoJSON validator. While the spec is very simple, it’s easy to get tripped up when you’re first getting started with the format.

So, I built http://geojsonlint.com. It’s a very simple django app that validates your GeoJSON and shows your feature(s) on a map if everything checks out ok. It works by POSTing your data to the /validate endpoint and returning a JSON object that signifies success or an error.

Valid:

{"status": "ok"}

Invalid:

{"status": "error", "message": "Required field 'coordinates' is missing"}

There are still a few rough edges but the code is available at https://github.com/JasonSanford/geojsonlint.com if you want to check it out or fix something I could be doing better. I’m using the Validictory python library to do most of the heavy lifting.

Future Work

  • Break it down into its own python library
  • Allow for pasting a URL to a GeoJSON resource to validate
  • Better error messages – Give the exact line number for something that didn’t validate (kind of like http://jsonlint.com)