Skip to content

Instantly share code, notes, and snippets.

@hrbrmstr hrbrmstr/README.md
Last active Aug 29, 2015

Embed
What would you like to do?

2015-08-05 UPDATE I got an official response from the Maritime Safety Office that included the official shapefile! I added that GeoJSON to this gist


So, I managed to determine that NIMA is directly associated with the NGIA and I found a GitHub org for NGIA: https://github.com/ngageoint?page=1

There's an iOS app repo there - https://github.com/ngageoint/anti-piracy-iOS-app which had a CSV file: https://raw.githubusercontent.com/ngageoint/anti-piracy-iOS-app/master/Asam/subregions.csv

That CSV file is a set of "spatial lines" for framing the sub-regions. I had to modify the subregions (I put the modified file in this gist) to remove duplicate IDs.

The R script in this gist will convert the CSV tile to a SpatialPolygonsDataFrame and also uses the geojsonio package to make a geojson file of the SPDF (which is also in the repo).

Thank you to everyone who went on the hunt! It's really weird this shapefile wasn't in any catalog.

The reason for this treasure hunt will become evident on September 19th! #rrrr

library(sp)
library(stringr)
dat <- readLines("subregions.csv")
SpatialPolygons(lapply(dat, function(x) {
region <- str_split_fixed(x, ",", 2)[,1]
poly_pts <- as.numeric(str_split(str_split_fixed(x, ",", 2)[,2], ",")[[1]])
poly_mat <- matrix(c(poly_pts, poly_pts[1], poly_pts[2]), ncol=2, byrow=TRUE)
tmp <- poly_mat[,2]
poly_mat[,2] <- poly_mat[,1]
poly_mat[,1] <- tmp
Polygons(list(Polygon(poly_mat)), ID=region)
}), proj4string=CRS("+proj=longlat")) -> subr
subr_dat <- data.frame(id=sapply(subr@polygons, function(x) { slot(x, "ID") }),
stringsAsFactors=FALSE)
rownames(subr_dat) <- subr_dat$id
subr <- SpatialPolygonsDataFrame(subr, subr_dat)
plot(subr)
library(geojsonio)
geojson_write(subr, geometry="polygon", file="subregions.geojson")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 33 columns, instead of 19. in line 1.
11,32.750000000,-116.000000000,34.250270844,-107.428421021,44.002246857,-105.655769348,44.000003815,-93.000000000,40.499996185,-88.000000000,40.500003815,-82.000007629,35.527622223,-77.197044373,35.499992371,-74.750000000,32.935321808,-74.250007629,32.000000000,-79.599998474,23.499948502,-79.600051880,23.500000000,-86.000000000,23.499994278,-90.000007629,27.299686432,-100.679649353,28.985225677,-105.417129517,32.750000000,-116.000000000
12,35.527622223,-77.197044373,40.500003815,-82.000007629,45.308727264,-72.726028442,41.490531921,-72.377975464,40.880031586,-72.370025635,34.027954102,-68.000099182,32.935321808,-74.250007629,35.499992371,-74.750000000,35.527622223,-77.197044373
13,41.490531921,-72.377975464,45.308727264,-72.726028442,47.500000000,-68.500000000,47.000000000,-66.833000183,45.571815491,-66.833000183,45.000000000,-66.833000183,34.727268219,-64.000007629,34.027954102,-68.000099182,40.880031586,-72.370025635,41.490531921,-72.377975464
14,45.571815491,-66.833000183,47.000000000,-66.833000183,47.500000000,-68.500000000,45.308727264,-72.726028442,40.500003815,-82.000007629,40.499996185,-88.000000000,44.000003815,-93.000000000,44.002246857,-105.655769348,50.135452271,-104.540916443,49.999996185,-92.999992371,52.499992371,-55.750007629,56.999946594,-46.374122620,41.500000000,-27.500000000,36.255950928,-55.255950928,34.727268219,-64.000007629,45.000000000,-66.833000183,45.571815491,-66.833000183
15,49.999996185,-92.999992371,50.135452271,-104.540916443,50.357135773,-123.427871704,55.996353149,-129.862518311,59.827285767,-135.168716431,67.144081116,-139.915374756,69.611801147,-140.000000000,84.000000000,-140.000000000,84.000000000,-58.000007629,81.994918823,-61.014419556,80.603416443,-67.500137329,78.706398010,-73.801895142,76.682182312,-73.793853760,68.994766235,-60.980079651,56.999946594,-46.374122620,52.499992371,-55.750007629,49.999996185,-92.999992371
16a,67.144081116,-139.915374756,59.827285767,-135.168716431,59.000000000,-136.000000000,52.000000000,-150.000000000,45.000000000,-150.000000000,45.000000000,-180.000000000,59.136230469,-180.000000000,66.500000000,-168.000000000,74.017883301,-168.000000000,84.000000000,-168.000000000,84.000000000,-140.000000000,69.611801147,-140.000000000,67.144081116,-139.915374756
16b,50.000000000,170.000000000,53.000000000,170.000000000,59.141044617,180.000000000,45.000000000,180.000000000,45.000000000,170.000000000,50.000000000,170.000000000
17,45.000000000,-150.000000000,52.000000000,-150.000000000,59.000000000,-136.000000000,59.827285767,-135.168716431,55.996353149,-129.862518311,50.357135773,-123.427871704,49.950000763,-124.449996948,45.000000000,-135.000000000,45.000000000,-150.000000000
18,50.357135773,-123.427871704,50.135452271,-104.540916443,34.250270844,-107.428421021,32.750000000,-116.000000000,32.000000000,-120.000000000,18.000000000,-120.000000000,18.000000000,-135.000000000,45.000000000,-135.000000000,49.950000763,-124.449996948,50.357135773,-123.427871704
19,17.918098450,-180.000000000,45.000000000,-180.000000000,45.000000000,-150.000000000,45.000000000,-135.000000000,18.000000000,-135.000000000,17.918098450,-180.000000000
20,25.000000000,170.000000000,45.000000000,170.000000000,45.000000000,180.000000000,18.000000000,180.000000000,18.000000000,170.000000000,25.000000000,170.000000000
21,32.750000000,-116.000000000,28.985225677,-105.417129517,19.907112122,-101.226486206,14.563762665,-87.291870117,10.937788963,-84.805953979,8.903383255,-82.893020630,8.756045341,-82.008003235,8.589264870,-80.988677979,9.266214371,-79.497474670,9.014428139,-78.252540588,8.165849686,-77.666007996,5.000000000,-85.000000000,5.000000000,-120.000000000,18.000000000,-120.000000000,32.000000000,-120.000000000,32.750000000,-116.000000000
22,8.165849686,-77.666007996,5.476679325,-75.311500549,-14.171706200,-58.331077576,-34.083778381,-65.307380676,-52.016635895,-71.590248108,-51.966194153,-68.720603943,-53.000000000,-63.000000000,-60.000000000,-63.000000000,-60.000000000,-120.000000000,5.000000000,-120.000000000,5.000000000,-85.000000000,8.165849686,-77.666007996
23,-34.083778381,-65.307380676,-36.249954224,-57.162769318,-36.250000000,-20.000000000,-53.500000000,-20.000000000,-53.500000000,-47.000000000,-60.000000000,-47.000000000,-60.000000000,-63.000000000,-53.000000000,-63.000000000,-51.966194153,-68.720603943,-52.016635895,-71.590248108,-34.083778381,-65.307380676
24,23.999437332,-42.999435425,1.000000119,-20.000000000,-36.250000000,-20.000000000,-36.249954224,-57.162769318,-34.083778381,-65.307380676,-14.171706200,-58.331077576,5.476679325,-75.311500549,8.165849686,-77.666007996,13.250000954,-76.000007629,13.643375397,-72.049453735,13.500000000,-67.999992371,13.000000000,-65.000000000,11.250000000,-59.333000183,23.999437332,-42.999435425
25,34.727268219,-64.000007629,36.255950928,-55.255950928,23.999437332,-42.999435425,11.250000000,-59.333000183,13.000000000,-65.000000000,13.500000000,-67.999992371,13.643375397,-72.049453735,13.250000954,-76.000007629,17.750013351,-71.499992371,19.999984741,-71.500000000,34.727268219,-64.000007629
26,32.935321808,-74.250007629,34.027954102,-68.000099182,34.727268219,-64.000007629,19.999984741,-71.500000000,17.750013351,-71.499992371,13.250000954,-76.000007629,8.165849686,-77.666007996,9.014428139,-78.252540588,9.266214371,-79.497474670,8.589264870,-80.988677979,8.756045341,-82.008003235,14.000045776,-82.000022888,18.000001907,-81.000000000,19.899993896,-77.250007629,20.384473801,-75.757171631,21.749994278,-75.750000000,23.499948502,-79.600051880,32.000000000,-79.599998474,32.935321808,-74.250007629
27,23.500000000,-86.000000000,23.499948502,-79.600051880,21.749994278,-75.750000000,20.384473801,-75.757171631,19.899993896,-77.250007629,18.000001907,-81.000000000,21.500019073,-86.000007629,23.500000000,-86.000000000
28,28.985225677,-105.417129517,27.299686432,-100.679649353,23.499994278,-90.000007629,23.500000000,-86.000000000,21.500019073,-86.000007629,18.000001907,-81.000000000,14.000045776,-82.000022888,8.756045341,-82.008003235,8.903383255,-82.893020630,10.937788963,-84.805953979,14.563762665,-87.291870117,19.907112122,-101.226486206,28.985225677,-105.417129517
29,-53.500000000,-20.000000000,-60.000000000,-20.000000000,-60.000000000,-47.000000000,-53.500000000,-47.000000000,-53.500000000,-20.000000000
35,70.000000000,-0.000000182,56.580001831,0.000000010,54.000000000,-0.000000004,56.333000183,-5.333000183,52.166000366,-7.250000000,51.333000183,-8.000000000,50.498779297,-10.755830765,50.098834991,-13.333263397,49.743328094,-16.421730042,49.999992371,-19.298252106,70.000000000,-0.000000182
36,54.000000000,-0.000000004,50.080001831,-5.333000183,49.500000000,-6.750000000,42.190994263,-12.749922752,41.500000000,-27.500000000,49.999992371,-19.298252106,49.743328094,-16.421730042,50.098834991,-13.333263397,50.498779297,-10.755830765,51.333000183,-8.000000000,52.166000366,-7.250000000,56.333000183,-5.333000183,54.000000000,-0.000000004
37,56.580001831,0.000000010,56.580001831,8.170000076,56.576995850,8.174303055,56.000000000,9.000000000,54.580001831,9.000000000,53.500000000,10.250000000,50.000000000,10.250000000,42.799999237,0.249999940,42.554054260,-5.000000000,42.190994263,-12.749922752,49.500000000,-6.750000000,50.080001831,-5.333000183,54.000000000,-0.000000004,56.580001831,0.000000010
38,84.000000000,0.000000868,75.500000000,0.000000598,70.000000000,-0.000000182,49.999992371,-19.298252106,41.500000000,-27.500000000,56.999946594,-46.374122620,68.994766235,-60.980079651,76.682182312,-73.793853760,78.706398010,-73.801895142,80.603416443,-67.500137329,81.994918823,-61.014419556,84.000000000,-58.000007629,84.000000000,0.000000868
41a,56.336849213,129.539199829,50.000000000,102.750000000,50.000000000,99.000000000,55.099975586,97.199478149,75.498229980,89.997970581,78.002349854,86.998298645,84.000000000,86.999160767,84.000000000,180.000000000,74.000000000,180.000000000,74.000000000,178.000000000,67.800003052,178.000000000,56.336849213,129.539199829
41b,74.036087036,-180.000000000,84.002609253,-180.000000000,84.000000000,-168.000000000,74.017883301,-168.000000000,74.036087036,-180.000000000
42,61.000003815,35.000000000,66.991241455,24.016050339,69.750000000,31.000001907,71.000000000,33.000000000,75.500000000,33.000000000,75.500000000,0.000000598,84.000000000,0.000000868,84.000000000,36.067436218,84.000000000,86.528755188,84.000000000,86.999160767,78.002349854,86.998298645,75.498229980,89.997970581,55.099975586,97.199478149,50.000000000,99.000000000,50.000000000,91.935134888,50.000000000,62.041564941,50.000000000,43.000000000,50.000000000,35.000000000,61.000003815,35.000000000
43,66.991241455,24.016050339,60.000000000,8.170000076,56.580001831,8.170000076,56.580001831,0.000000010,70.000000000,-0.000000182,75.500000000,0.000000598,75.500000000,33.000000000,71.000000000,33.000000000,69.750000000,31.000001907,66.991241455,24.016050339
44,50.000000000,35.000000000,50.000000000,26.079999924,50.000000000,10.250000000,53.500000000,10.250000000,54.580001831,9.000000000,56.000000000,9.000000000,56.576995850,8.174303055,56.580001831,8.170000076,60.000000000,8.170000076,66.991241455,24.016050339,61.000003815,35.000000000,50.000000000,35.000000000
51,41.500000000,-27.500000000,42.190994263,-12.749922752,42.554054260,-5.000000000,30.000000000,-5.000000000,30.000000000,12.000000000,30.000000000,18.750000000,8.342633247,18.750000000,8.358990669,-7.238349438,4.239999771,-7.240001202,1.000000119,-20.000000000,23.999437332,-42.999435425,36.255950928,-55.255950928,41.500000000,-27.500000000
52,42.799999237,0.249999940,38.599998474,8.250000000,38.599998474,12.000000000,34.000000000,12.000000000,30.000000000,12.000000000,30.000000000,-5.000000000,42.554054260,-5.000000000,42.799999237,0.249999940
53,50.000000000,10.250000000,43.347511292,11.621723175,40.659999847,17.250000000,34.000000000,17.250000000,34.000000000,12.000000000,38.599998474,12.000000000,38.599998474,8.250000000,42.799999237,0.249999940,50.000000000,10.250000000
54,50.000000000,26.079999924,40.000000000,26.079999924,39.000000000,28.500000000,39.000000000,43.000000000,34.000000000,34.000000000,34.000000000,17.250000000,40.659999847,17.250000000,43.347511292,11.621723175,50.000000000,10.250000000,50.000000000,26.079999924
55,50.000000000,43.000000000,39.000000000,43.000000000,39.000000000,28.500000000,40.000000000,26.079999924,50.000000000,26.079999924,50.000000000,35.000000000,50.000000000,43.000000000
56,30.000000000,12.000000000,34.000000000,12.000000000,34.000000000,17.250000000,34.000000000,34.000000000,39.000000000,43.000000000,30.000000000,43.000000000,30.000000000,31.590322495,30.000000000,18.750000000,30.000000000,12.000000000
57,1.000000119,-20.000000000,4.239999771,-7.240001202,8.358990669,-7.238349438,8.342633247,18.750000000,-60.000000000,18.750000000,-60.000000000,-20.000000000,-53.500000000,-20.000000000,-36.250000000,-20.000000000,1.000000119,-20.000000000
61,8.342633247,18.750000000,8.038599014,45.912963867,11.136983871,51.005599976,11.133999825,54.000000000,0.000000041,54.000000000,0.000000005,90.000000000,-11.250000000,90.000000000,-34.000000000,90.000000000,-60.000000000,90.000000000,-60.000000000,18.750000000,8.342633247,18.750000000
62,8.038599014,45.912963867,8.342633247,18.750000000,30.000000000,18.750000000,30.000000000,31.590322495,30.000000000,43.000000000,39.000000000,43.000000000,50.000000000,43.000000000,50.000000000,62.041564941,26.588459015,62.042350769,25.094608307,62.076801300,22.795736313,63.676589966,20.539367676,64.475715637,18.000000000,64.000000000,15.815094948,62.759944916,13.934782982,60.785617828,12.171998978,57.730117798,11.133999825,54.000000000,11.136983871,51.005599976,8.038599014,45.912963867
63,26.588459015,62.042350769,50.000000000,62.041564941,50.000000000,91.935134888,50.000000000,99.000000000,26.544488907,99.000000000,8.249998093,99.000000000,5.000000000,90.000000000,0.000000005,90.000000000,0.000000041,54.000000000,11.133999825,54.000000000,12.171998978,57.730117798,13.934782982,60.785617828,15.815094948,62.759944916,18.000000000,64.000000000,20.539367676,64.475715637,22.795736313,63.676589966,25.094608307,62.076801300,26.588459015,62.042350769
71,0.000000005,90.000000000,5.000000000,90.000000000,8.249998093,99.000000000,1.749999762,104.000000000,7.400000095,107.000000000,7.400000095,116.410003662,7.400000095,117.500007629,6.399542809,118.500465393,-2.500000477,111.000000000,-6.500000000,108.500000000,-11.250000000,108.500000000,-11.250000000,90.000000000,0.000000005,90.000000000
72,6.399542809,118.500465393,5.400000095,119.500007629,4.400000095,119.500007629,4.780911446,123.500007629,1.000002384,123.500007629,0.999995172,121.000053406,-6.500000000,121.000000000,-8.500000000,118.919998169,-11.250000954,118.000000000,-11.250000000,108.500000000,-6.500000000,108.500000000,-2.500000477,111.000000000,6.399542809,118.500465393
73,4.780911446,123.500007629,5.400000095,130.000000000,1.500000000,130.000000000,-0.000000004,136.750000000,-1.000000000,141.250000000,-5.600006580,147.250015259,-8.100000381,150.750000000,-8.100000381,154.000000000,-15.000000000,162.000000000,-12.000000000,150.000000000,-10.000000000,146.000000000,-10.000000000,142.000000000,-9.500000000,132.000000000,-11.250000954,118.000000000,-8.500000000,118.919998169,-6.500000000,121.000000000,0.999995172,121.000053406,1.000002384,123.500007629,4.780911446,123.500007629
74,-11.250000000,90.000000000,-11.250000000,108.500000000,-11.250000954,118.000000000,-9.500000000,132.000000000,-10.000000000,142.000000000,-10.000000000,146.000000000,-12.000000000,150.000000000,-15.000000000,162.000000000,-27.000000000,162.000000000,-27.000000000,172.500000000,-27.000000000,177.000000000,-34.000000000,168.090911865,-34.000080109,151.048080444,-34.044635773,145.828018188,-28.202676773,130.957580566,-34.000000000,114.978965759,-34.000000000,90.000000000,-11.250000000,90.000000000
75,-34.000000000,90.000000000,-34.000000000,114.978965759,-28.202676773,130.957580566,-34.044635773,145.828018188,-34.000080109,151.048080444,-34.000000000,168.090911865,-60.000000000,135.000000000,-60.000000000,90.000000000,-34.000000000,90.000000000
76a,-60.000000000,135.000000000,-34.000000000,168.090911865,-27.000000000,177.000000000,-27.000000000,180.000000000,-60.000000000,180.000000000,-60.000000000,135.000000000
76b,-60.000000000,-175.000000000,-59.985656738,-180.000000000,-26.988185883,-180.000000000,-27.000000000,-175.000000000,-60.000000000,-175.000000000
81,21.500000000,130.000000000,23.500000000,130.000000000,23.500000000,150.000000000,25.000000000,150.000000000,25.000000000,170.000000000,18.000000000,170.000000000,18.000000000,180.000000000,4.000000000,180.000000000,-0.000000009,168.000000000,0.000000049,162.997329712,0.000000107,158.000000000,-0.000000004,136.750000000,1.500000000,130.000000000,5.400000095,130.000000000,13.250000000,130.000000000,21.500000000,130.000000000
82,-0.000000004,136.750000000,0.000000107,158.000000000,0.000000049,162.997329712,-17.999711990,172.500000000,-27.000000000,172.500000000,-27.000000000,162.000000000,-15.000000000,162.000000000,-8.100000381,154.000000000,-8.100000381,150.750000000,-5.600006580,147.250015259,-1.000000000,141.250000000,-0.000000004,136.750000000
83a,-27.000000000,172.500000000,-17.999711990,172.500000000,0.000000049,162.997329712,-0.000000009,168.000000000,4.000000000,180.000000000,-27.000000000,180.000000000,-27.000000000,177.000000000,-27.000000000,172.500000000
83b,-26.988185883,-180.000000000,17.918098450,-180.000000000,18.000000000,-135.000000000,18.000000000,-120.000000000,5.000000000,-120.000000000,-60.000000000,-120.000000000,-60.000000000,-175.000000000,-27.000000000,-175.000000000,-26.988185883,-180.000000000
91,13.000000000,118.999992371,15.000000000,118.250000000,21.500000000,118.250000000,21.500000000,123.500000000,21.500000000,130.000000000,13.250000000,130.000000000,13.250000000,127.000007629,13.000000000,127.000007629,13.000000000,118.999992371
92,7.400000095,116.410003662,13.000000000,118.999992371,13.000000000,127.000007629,13.250000000,127.000007629,13.250000000,130.000000000,5.400000095,130.000000000,4.780911446,123.500007629,4.400000095,119.500007629,5.400000095,119.500007629,6.399542809,118.500465393,7.400000095,117.500007629,7.400000095,116.410003662
93,8.249998093,99.000000000,26.544488907,99.000000000,41.546016693,99.000000000,23.239999771,116.699996948,21.500000000,118.250000000,15.000000000,118.250000000,13.000000000,118.999992371,7.400000095,116.410003662,7.400000095,107.000000000,1.749999762,104.000000000,8.249998093,99.000000000
94,21.500000000,118.250000000,23.239999771,116.699996948,41.546016693,99.000000000,41.537452698,113.226295471,41.515213013,124.297668457,39.900001526,124.310005188,33.000000000,124.310005188,21.500000000,123.500000000,21.500000000,118.250000000
95,41.515213013,124.297668457,42.083305359,129.567108154,42.148853302,130.175079346,42.150001526,130.210006714,40.830001831,140.750000000,39.000000000,140.500000000,36.000000000,138.000000000,35.099998474,135.500000000,34.166000366,131.000000000,33.000000000,128.000000000,33.000000000,124.310005188,39.900001526,124.310005188,41.515213013,124.297668457
96a,42.083305359,129.567108154,41.515213013,124.297668457,41.537452698,113.226295471,41.546016693,99.000000000,50.000000000,99.000000000,50.000000000,102.750000000,56.336849213,129.539199829,67.800003052,178.000000000,74.000000000,178.000000000,74.000000000,180.000000000,59.141044617,180.000000000,53.000000000,170.000000000,50.000000000,170.000000000,42.500000000,155.000000000,40.830001831,140.750000000,42.150001526,130.210006714,42.148853302,130.175079346,42.083305359,129.567108154
96b,59.136230469,-180.000000000,74.036087036,-180.000000000,74.017883301,-168.000000000,66.500000000,-168.000000000,59.136230469,-180.000000000
97,40.830001831,140.750000000,42.500000000,155.000000000,50.000000000,170.000000000,45.000000000,170.000000000,25.000000000,170.000000000,25.000000000,150.000000000,23.500000000,150.000000000,23.500000000,130.000000000,21.500000000,130.000000000,21.500000000,123.500000000,33.000000000,124.310005188,33.000000000,128.000000000,34.166000366,131.000000000,35.099998474,135.500000000,36.000000000,138.000000000,39.000000000,140.500000000,40.830001831,140.750000000
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikeatlas

This comment has been minimized.

Copy link

mikeatlas commented Aug 3, 2015

I was mentioned on this from twitter, what's the hoopla all about? These subregions don't make a ton of sense without context, but sortof remind me of FAA regions:

faa-zones-map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.