GeoJSON is an open format for encoding information about geographic features using JSON. It has much in common with older GIS formats, but also a few new twists: GeoJSON is a text format, has a flexible schema, and is specified in a single HTML page. The specification is informed by standards such as OGC Simple Features and Web Feature Service and streamlines them to suit the way web developers actually build software today.
Promoted by GitHub and used in the Twitter API, GeoJSON has become a big deal in the open web. We are huge fans of the little format that could. GeoJSON suits the web and suits us very well; it plays a major part in our libraries, services, and products.
One of the best parts about using simple, open formats like GeoJSON is that we’re not even limited to the open web. For as long as we’ve had markers available as GeoJSON from our API, we’ve also supported bringing those markers into native iOS apps. Apple’s Cocoa frameworks have supported native JSON parsing with NSJSONSerialization for several years now, and our open source iOS SDK builds atop this in RMMapBoxSource for bringing your MapBox maps and their markers into native apps. We have an example app, Weekend Picks for iOS, that shows this in action, with markers designed in our web editor being automatically turned into first class native objects in iOS code. This could allow simple editing of a web map to translate into updates to a real, native iOS app in the field.
What’s more, you can use straight GeoJSON as well, including lines and polygons, as in this example from our code library. Here we iterate the features array directly, parsing out geometry objects and their coordinates. Take note that Apple’s convention when building CLLocationCoordinate2D structures, as in Leaflet, is latitude, then longitude.
TileMill has long supported GeoJSON as an input format. Add a File type layer and specify a local filesystem path or HTTP URL of a GeoJSON document – such as a raw URLs from a GeoJSON file on GitHub or a MapBox API GeoJSON URL (as mentioned above) – and you have a data source that can be stylishly rendered.
Open formats are healthier formats
In a marketplace crowded with geospatial data formats, GeoJSON has the distinction of being the only one designed with the open web in mind. It’s also shown itself to be useful on native device platforms. We are committed to giving you tools to map and share GeoJSON and to helping ensure that the format continues to flourish.