[Geojson] Valid values for numbers in points etc?

Michael Geary mg at mg.to
Wed Mar 6 09:03:50 PST 2013


The meaning of the coordinate values depends on the coordinate reference
system (CRS) the GeoJSON file uses.

The default CRS is WGS84 (EPSG:4326), where the values do represent
longitude, latitude, and optional altitude.

If you specify a different CRS in the GeoJSON file, then the coordinate
values are easting, northing, and again optional altitude. The meaning of
the easting and northing depends on the CRS. I believe altitude is in
meters in all cases; someone correct me if I'm wrong.

As an example, my PolyGonzo library accepts GeoJSON in either the default
WGS84, or alternatively in Spherical Mercator (EPSG:3857) coordinates, also
known as Google Mercator. These are coordinates in "meters" on the
projected Spherical Mercator plane. If you use this in the GeoJSON, it
allows slightly faster display of the polygons because it only takes a
single multiplication to convert each coordinate to a pixel location
instead of a sequence of trigonometric operations.

Here's an example of GeoJSON using Spherical Mercator coordinates. This
file contains the boundary of the District of Columbia, from my Google
election results map.

    {
        "crs": {
            "type": "name",
            "properties": {
                "name": "urn:ogc:def:crs:EPSG::3857"
            }
        },
        "features": [
            {
                "name": "District of Columbia",
                "geometry": {
                    "type": "MultiPolygon",
                    "coordinates": [
                        [
                            [
                                [ -8576165, 4720971 ],
                                [ -8571687, 4716527 ],
                                [ -8561515, 4706329 ],
                                [ -8575898, 4691851 ],
                                [ -8575586, 4695194 ],
                                [ -8576553, 4698721 ],
                                [ -8575252, 4699023 ],
                                [ -8575129, 4700281 ],
                                [ -8576120, 4703241 ],
                                [ -8576655, 4703812 ],
                                [ -8577066, 4703169 ],
                                [ -8579404, 4707459 ],
                                [ -8582844, 4708927 ],
                                [ -8584948, 4712267 ],
                                [ -8576165, 4720971 ]
                            ]
                        ]
                    ]
                },
                "centroid": [ -8573379, 4708026 ],
                "bbox": [ -8584948, 4691851, -8561515, 4720971 ],
                "type": "Feature",
                "id": "0500000US11001"
            }
        ],
        "table": "carto2010.county_512",
        "center": [ -8573231, 4706411 ],
        "type": "FeatureCollection",
        "id": "11",
        "bbox": [ -8584948, 4691851, -8561515, 4720971 ],
        "name": "District of Columbia"
    }


Further reading:

http://www.geojson.org/geojson-spec.html#positions

http://www.geojson.org/geojson-spec.html#coordinate-reference-system-objects

http://en.wikipedia.org/wiki/World_Geodetic_System

http://docs.openlayers.org/library/spherical_mercator.html

https://code.google.com/p/polygonzo/

-Mike


On Wed, Mar 6, 2013 at 7:49 AM, Francis Galiegue <fgaliegue at gmail.com>wrote:

> Hello,
>
> First, a short announce to say that the schemas for GeoJSON have
> moved. Their new home is:
>
> https://github.com/fge/sample-json-schemas/tree/master/geojson
>
> And then I have a question about valid numeric values in points etc. I
> guess those are latitude or longitude coordinates?
>
> --
> Francis Galiegue, fgaliegue at gmail.com
> JSON Schema in Java: http://json-schema-validator.herokuapp.com
> _______________________________________________
> Geojson mailing list
> Geojson at lists.geojson.org
> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geojson.org/pipermail/geojson-geojson.org/attachments/20130306/fffb96b6/attachment.htm>


More information about the GeoJSON mailing list