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 tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.
2 thoughts on “Null Archipelago — Null Islands for All Coordinate Reference Systems”