GeoJSON is Spectacularly Wrong

Yet Somehow Right Enough

Sean Gillies / @sgillies

The Little Format that Could

  • GeoJSON gets many things right
  • It gets some things wrong
  • Requirements, opinions, and tastes differ
  • GeoJSON is flexible and evolvable
  • It's been a valuable experiment in standards making

About Me

  • I write programs for classicists
  • And libraries for Python programmers
  • Some are geospatial (Shapely, &c.)
  • I ❤ XML
  • I ❤ ❤ ❤ the Web

And the Web loved XML, too

... for a while.

I think the Web community has spoken, and it's clear that what it wants is HTML5, JavaScript and JSON. XML isn't going away but I see it being less and less a Web technology; it won't be something that you send over the wire on the public Web, but just one of many technologies that are used on the server to manage and generate what you do send over the wire.

— James Clark, XML vs the Web (2010)

A Timeline

  • 1998: XML 1.0
  • 2002: D. Crockford launches json.org
  • 2005: AJAX
  • 2006: RFC 4627, "The application/json Media Type for JavaScript Object Notation (JSON)"
  • 2009: The Web stops calling XML back

The Web loves JSON because it is

  • minimal, portable, textual
  • self-describing
  • a subset of JavaScript
  • (and other languages with Map literals)
  • Makes simple network computing easy

JSON is self-describing

{"foo": 5, "bar": "5"}

vs.

55

Network computing made easy

  • "Impedance match" between wire format and programs
  • Ordinary code can be split between network nodes

A Simple Application


from module1 import func1 # Returns a mapping
from module2 import func2 # Takes a mapping

data = func1()
func2(**data)
                    

A Simple Network Application


# Network Node 1

from module1 import func1 # Returns a mapping

data = func1()

# send data...
                    

# Network Node 2

from module2 import func2 # Takes a mapping

# receive data...

func2(**data)
                    

Node 1 ⟶ {data} ⟶ Node 2

GeoJSON is a profile of JSON

Written in 2008 by

  • Howard Butler
  • Martin Daly
  • Allan Doyle
  • Sean Gillies
  • Tim Schaub
  • Christopher Schmidt

Working Group Goals

  • Reconcile Simple Features and the Web
  • Keep it accessible and simple
  • Work in the open

Success!

Failure!

While I do not mind folks ignoring ISO 19107 (which is the official OGC geometry volume) in small things, it is disconcerting to have the requirement to catalogue the disconnects to understand what is suppose to be a simple specification.

—Exasperated Architect (2007)

GeoJSON is Spectacularly Wrong.

—Exasperated Developer (2012)

Coordinate Order is a Big Deal

GeoJSON is not Lat, Lng

  • To match OGR
  • To match KML
  • It surprises the naive
  • It annoys the expert
  • It is what it is

GeoJSON does not conform with ISO 191**

  • Because we wanted to ship soon
  • And get back to work writing programs
  • It's a blocker for some vendors
  • Good news: GML is just as good as it ever was

But GeoJSON Does Good, too

The Spec Doesn't Waste Your Time

  • 8 pages (printed)
  • HTML
  • With section targets
  • No click-through license agreement
  • Stable. There will be no GeoJSON 2.0

GeoJSON is good for programmers


def explode(coords):
"""Explode a GeoJSON geometry's coordinates object and yield coordinate
tuples. As long as the input is conforming, the type of the geometry
doesn't matter.
"""
for e in coords:
    if isinstance(e, (float, int, long)):
        yield coords
        break
    else:
        for f in explode(e):
            yield f

GeoJSON is flexible

  • It's a good fit for Map/Reduce: http://mike.teczno.com/notes/elephants-osm-hadoop.html
  • It's tileable: https://github.com/NelsonMinar/vector-river-map

GeoJSON is evolvable

Best uses will be discovered by others, "out there"

Look into TopoJSON, for example

(You may never come back)

The Little Format that Could

  • GeoJSON gets many things right
  • It gets some things wrong
  • Requirements, opinions, and tastes differ
  • GeoJSON is flexible and evolvable
  • It's been a valuable experiment in standards making

Credits

Thank You

THE END