Smathermather's Weblog

Null Archipelago — Null Islands for All Coordinate Reference Systems

Posted by smathermather on September 10, 2014

@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 &gt; 2000 AND auth_srid &lt; 4904;
```

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

1. The Null Island Algorithm | geomaticblogsaid

[…] But earlier this year, some geonerds such as @mizmay, @schuyler that there is no one Null Island, but one Null Island per datum / coordinate system (depending on who you ask). And @smathermather had the spare time to find out how the “Null Archipielago” looks like: […]

2. Mapping an Integer | GIS for Thoughtsaid

[…] we can try some alternatives. Smathermather had a great post about mapping Null Island/Archipelago, so we can re-use some code. To map our […]