Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Null Archipelago — Null Islands for All Coordinate Reference Systems — revision

Posted by smathermather on September 10, 2014

Ok, I misunderstood… . The Null Island Archipelago is actually meant to be just datum based, i.e. not the 0,0 of every projection, but the 0,0 of every null lat/lon.

CREATE OR REPLACE FUNCTION where_in_the_null (crs integer) RETURNS
geometry AS $$

WITH null_island AS (
	SELECT ST_MakePoint(0,0) AS geom
	),
null_island_crs AS (
	SELECT ST_SetSRID(geom, crs) AS geom FROM null_island
)
SELECT ST_Transform(geom, 4326) FROM null_island_crs

---

DROP TABLE IF EXISTS null_archipelago;

CREATE TABLE null_archipelago AS
SELECT srid, where_in_the_null(auth_srid) FROM spatial_ref_sys
WHERE proj4text LIKE '%longlat%';

null_archipelago_real

 

 

@mizmay Someone suggested & @schuyler tweeted (who? please remind me!) a few weeks ago that each coordinate reference system (CRS) has it’s own Null Island, and therefore there must be a Null Archipelago. This got me thinking — what does that look like?

Enter PostGIS. We’ll create a function, that given an EPSG code will return the 0,0 location for that reference system in the real world. It turns out, this is quite easy.


CREATE OR REPLACE FUNCTION where_in_the_null (crs integer) RETURNS
geometry AS $$

WITH null_island AS (
	SELECT ST_MakePoint(0,0) AS geom
	),
null_island_crs AS (
	SELECT ST_SetSRID(geom, crs) AS geom FROM null_island
)
SELECT ST_Transform(geom, 4326) FROM null_island_crs
 
$$ LANGUAGE SQL VOLATILE;


So, now we need some EPSG codes. To that end, we have one in any PostGIS database.


CREATE TABLE null_archipelago AS
SELECT srid, where_in_the_null(auth_srid) FROM spatial_ref_sys
	WHERE auth_srid > 2000 AND auth_srid < 4904;


Map showing the null archipelago overlayed on the Stamen Watercolor Map

Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: