Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active April 12, 2016 14:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springmeyer/4728105 to your computer and use it in GitHub Desktop.
Save springmeyer/4728105 to your computer and use it in GitHub Desktop.
test parsing geojson urn style crs definition
~/projects/node-srs[master]$ node
> var srs = require('srs')
// http://geojson.org/geojson-spec.html#coordinate-reference-system-objects
> srs.parse('urn:ogc:def:crs:OGC:1.3:CRS84')
{ input: 'urn:ogc:def:crs:OGC:1.3:CRS84',
proj4: '+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs',
srid: 4326,
auth: 'EPSG',
pretty_wkt: 'GEOGCS["WGS 84",\n DATUM["WGS_1984",\n SPHEROID["WGS 84",6378137,298.257223563,\n AUTHORITY["EPSG","7030"]],\n TOWGS84[0,0,0,0,0,0,0],\n AUTHORITY["EPSG","6326"]],\n PRIMEM["Greenwich",0,\n AUTHORITY["EPSG","8901"]],\n UNIT["degree",0.0174532925199433,\n AUTHORITY["EPSG","9108"]],\n AUTHORITY["EPSG","4326"]]',
esri: false,
name: 'WGS 84',
valid: true,
is_geographic: true }
> srs.parse('urn:ogc:def:crs:EPSG::26912')
{ input: 'urn:ogc:def:crs:EPSG::26912',
proj4: '+proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
srid: 26912,
auth: 'EPSG',
pretty_wkt: 'PROJCS["NAD83 / UTM zone 12N",\n GEOGCS["NAD83",\n DATUM["North_American_Datum_1983",\n SPHEROID["GRS 1980",6378137,298.257222101,\n AUTHORITY["EPSG","7019"]],\n TOWGS84[0,0,0,0,0,0,0],\n AUTHORITY["EPSG","6269"]],\n PRIMEM["Greenwich",0,\n AUTHORITY["EPSG","8901"]],\n UNIT["degree",0.0174532925199433,\n AUTHORITY["EPSG","9122"]],\n AUTHORITY["EPSG","4269"],\n AXIS["Latitude",NORTH],\n AXIS["Longitude",EAST]],\n UNIT["metre",1,\n AUTHORITY["EPSG","9001"]],\n PROJECTION["Transverse_Mercator"],\n PARAMETER["latitude_of_origin",0],\n PARAMETER["central_meridian",-111],\n PARAMETER["scale_factor",0.9996],\n PARAMETER["false_easting",500000],\n PARAMETER["false_northing",0],\n AUTHORITY["EPSG","26912"],\n AXIS["Easting",EAST],\n AXIS["Northing",NORTH]]',
esri: false,
name: 'NAD83 / UTM zone 12N',
valid: true,
is_geographic: false }
> srs.parse('urn:ogc:def:crs:EPSG::3857')
{ proj4: '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over',
srid: 3857,
auth: 'EPSG',
pretty_wkt: 'PROJCS["WGS 84 / Pseudo-Mercator",\n GEOGCS["WGS 84",\n DATUM["WGS_1984",\n SPHEROID["WGS 84",6378137,298.257223563,\n AUTHORITY["EPSG","7030"]],\n AUTHORITY["EPSG","6326"]],\n PRIMEM["Greenwich",0,\n AUTHORITY["EPSG","8901"]],\n UNIT["degree",0.0174532925199433,\n AUTHORITY["EPSG","9122"]],\n AUTHORITY["EPSG","4326"]],\n UNIT["metre",1,\n AUTHORITY["EPSG","9001"]],\n PROJECTION["Mercator_1SP"],\n PARAMETER["central_meridian",0],\n PARAMETER["scale_factor",1],\n PARAMETER["false_easting",0],\n PARAMETER["false_northing",0],\n EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"],\n AUTHORITY["EPSG","3857"],\n AXIS["X",EAST],\n AXIS["Y",NORTH]]',
esri: false,
name: 'Google Maps Global Mercator',
valid: true,
is_geographic: false,
input: 'urn:ogc:def:crs:EPSG::3857' }
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment