-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
406 lines (317 loc) · 21.6 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
DATADIR := data
JSONDIR := assets/geojson
JSONLOWDIR := assets/geojson-low
TOPOJSON := /usr/local/bin/topojson
SHELL := /bin/bash
DATED=$(shell date '+%Y-%m-%d')
latest:
ssh studio.stamen.com "cd /var/www/com.stamen.studio/moore/show/latest && git pull"
dated-latest:
ssh studio.stamen.com "cd /var/www/com.stamen.studio/moore/show \
&& mkdir -p $(DATED) \
&& cp -r latest/* $(DATED)"
# To install the tilemill project
install:
mkdir -p ${HOME}/Documents/MapBox/project
cd tilemill_lowzoom && ln -sf "`pwd`" ${HOME}/Documents/MapBox/project/moore_lowzoom && ln -sf ../data
cd tilemill_highzoom && ln -sf "`pwd`" ${HOME}/Documents/MapBox/project/moore_highzoom && ln -sf ../tilemill_lowzoom/style.mss && ln -sf ../tilemill_lowzoom/images && ln -sf ../data
cd tilemill_highzoom_labels && ln -sf "`pwd`" ${HOME}/Documents/MapBox/project/moore_highzoom_labels && ln -sf ../tilemill_lowzoom/images && ln -sf ../data
clean:
rm -rf $(DATADIR)/*
datadir:
test -d $(DATADIR) || mkdir $(DATADIR)
jsondir:
test -d $(JSONDIR) || mkdir $(JSONDIR)
# The unchanging base data for context:
basedata: datadir $(DATADIR)/ne_10m_admin_1_states_provinces_lakes.shp $(DATADIR)/ne_10m_land_scale_rank.shp $(DATADIR)/ne_10m_populated_places.shp $(DATADIR)/ne_10m_geography_marine_polys.shp $(DATADIR)/ne_10m_ocean.shp $(DATADIR)/ne_10m_lakes.shp $(DATADIR)/ne_10m_graticules_10.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp
$(DATADIR)/World_EEZ_v8_20140228_LR:
test -d $(DATADIR)/World_EEZ_v8_20140228_LR || mkdir $(DATADIR)/World_EEZ_v8_20140228_LR
$(DATADIR)/World_EEZ_v8_20140228_LR.zip:
$(error Download World_EEZ_v8_20140228_LR.zip from http://www.marineregions.org/download_file.php?fn=v8_20140228_LR and place the zipfile in the oceanplanning.org/data directory. Then try again)
$(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp: $(DATADIR)/World_EEZ_v8_20140228_LR $(DATADIR)/World_EEZ_v8_20140228_LR.zip
unzip -o $< -d $(DATADIR)/World_EEZ_v8_20140228_LR && \
touch $@
$(DATADIR)/ne_10m_admin_1_states_provinces_lakes.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces_lakes.zip -o $@
$(DATADIR)/ne_10m_admin_1_states_provinces_lakes.shp: $(DATADIR)/ne_10m_admin_1_states_provinces_lakes.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/ne_10m_land_scale_rank.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_land_scale_rank.zip -o $@
$(DATADIR)/ne_10m_land_scale_rank.shp: $(DATADIR)/ne_10m_land_scale_rank.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/ne_10m_lakes.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_lakes.zip -o $@
$(DATADIR)/ne_10m_lakes.shp: $(DATADIR)/ne_10m_lakes.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/ne_10m_populated_places.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip -o $@
$(DATADIR)/ne_10m_populated_places.shp: $(DATADIR)/ne_10m_populated_places.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/ne_10m_geography_marine_polys.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_geography_marine_polys.zip -o $@
$(DATADIR)/ne_10m_geography_marine_polys.shp: $(DATADIR)/ne_10m_geography_marine_polys.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/ne_10m_ocean.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_ocean.zip -o $@
$(DATADIR)/ne_10m_ocean.shp: $(DATADIR)/ne_10m_ocean.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/ne_10m_graticules_10.zip:
curl -sL http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_graticules_10.zip -o $@
$(DATADIR)/ne_10m_graticules_10.shp: $(DATADIR)/ne_10m_graticules_10.zip
unzip $< -d $(DATADIR) && \
touch $@
# Unfortunately I have no source for the disputed areas, so I will create approximations by intersecting some Canadian planning areas with the Alaskan EEZ from the World EEZ file (which shows the US claims).
disputed: $(DATADIR)/disputed_dixon_entrance.shp $(DATADIR)/disputed_beaufort_sea.shp
$(DATADIR)/disputed_dixon_entrance.shp: $(DATADIR)/PNCIMA/pncimabndy_inlets071031.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" -clipdst $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp -clipdstwhere "Country = 'Alaska'" $@ $(DATADIR)/PNCIMA/pncimabndy_inlets071031.shp
$(DATADIR)/disputed_beaufort_sea.shp: $(DATADIR)/LOMA_Shapefiles/LOMA_Beaufort_Sea.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" -clipdst $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp -clipdstwhere "Country = 'Alaska'" $@ $(DATADIR)/LOMA_Shapefiles/LOMA_Beaufort_Sea.shp
# rule to project any shapefile into Lambert Azimuthal Equal Area
%_laea.shp: %.shp
ogr2ogr -fieldTypeToString All -overwrite --config SHAPE_ENCODING WINDOWS-1252 --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE -t_srs '+proj=laea +lat_0=40 +lon_0=-105 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs' $@ $<
basedatalaea: basedata $(DATADIR)/ne_10m_admin_1_states_provinces_lakes_laea.shp $(DATADIR)/ne_10m_land_scale_rank_laea.shp $(DATADIR)/ne_10m_populated_places_laea.shp $(DATADIR)/ne_10m_geography_marine_polys_laea.shp $(DATADIR)/ne_10m_ocean_laea.shp $(DATADIR)/ne_10m_lakes_laea.shp $(DATADIR)/ne_10m_graticules_10_laea.shp
# The EEZ and protected area data:
geojson: jsondir \
$(JSONDIR)/ma_coastalzone.geojson \
$(JSONDIR)/ri_coastalzone.geojson \
$(JSONDIR)/bc_mapp_haida_gwaii.geojson \
$(JSONDIR)/bc_mapp_north_coast.geojson \
$(JSONDIR)/bc_mapp_central_coast.geojson \
$(JSONDIR)/bc_mapp_north_vancouver_island.geojson \
$(JSONDIR)/bc_wcvi.geojson \
$(JSONDIR)/bc_pncima.geojson \
$(JSONDIR)/hi_humpback_sanctuary.geojson \
$(JSONDIR)/LOMA_Beaufort_Sea.geojson \
$(JSONDIR)/LOMA_Eastern_Scotian_Shelf.geojson \
$(JSONDIR)/LOMA_Gulf_of_Saint_Lawrence.geojson \
$(JSONDIR)/LOMA_Pacific_North_Coast.geojson \
$(JSONDIR)/LOMA_Placentia_Bay___Grand_Banks.geojson \
$(JSONDIR)/NLUP_Boundary.geojson \
$(JSONDIR)/florida_keys.geojson \
$(JSONDIR)/oregon.geojson \
$(JSONDIR)/great_lakes.geojson \
$(JSONDIR)/pacific_islands.geojson \
$(JSONDIR)/us_caribbean.geojson \
$(JSONDIR)/us_west_coast.geojson \
$(JSONDIR)/washington_state.geojson \
$(JSONDIR)/south_atlantic.geojson \
$(JSONDIR)/nroc_data_development_area.geojson \
$(JSONDIR)/marco_data_development_area.geojson \
# Create topojson file. -q is quantization, -p means preserve all properties
topojson:
$(TOPOJSON) -q 60000 --simplify-proportion 0.7 -p -o $(JSONDIR)/planning_areas.topojson \
$(JSONDIR)/ma_coastalzone.geojson \
$(JSONDIR)/ri_coastalzone.geojson \
$(JSONDIR)/bc_mapp_haida_gwaii.geojson \
$(JSONDIR)/bc_mapp_north_coast.geojson \
$(JSONDIR)/bc_mapp_central_coast.geojson \
$(JSONDIR)/bc_mapp_north_vancouver_island.geojson \
$(JSONDIR)/bc_wcvi.geojson \
$(JSONDIR)/bc_pncima.geojson \
$(JSONDIR)/hi_humpback_sanctuary.geojson \
$(JSONDIR)/LOMA_Beaufort_Sea.geojson \
$(JSONDIR)/LOMA_Eastern_Scotian_Shelf.geojson \
$(JSONDIR)/LOMA_Gulf_of_Saint_Lawrence.geojson \
$(JSONDIR)/LOMA_Pacific_North_Coast.geojson \
$(JSONDIR)/LOMA_Placentia_Bay___Grand_Banks.geojson \
$(JSONDIR)/NLUP_Boundary.geojson \
$(JSONDIR)/florida_keys.geojson \
$(JSONDIR)/oregon.geojson \
$(JSONDIR)/great_lakes.geojson \
$(JSONDIR)/pacific_islands.geojson \
$(JSONDIR)/us_caribbean.geojson \
$(JSONDIR)/us_west_coast.geojson \
$(JSONDIR)/washington_state.geojson \
$(JSONDIR)/south_atlantic.geojson \
$(JSONDIR)/nroc_data_development_area.geojson \
$(JSONDIR)/marco_data_development_area.geojson \
topojson-low:
$(TOPOJSON) -q 1e5 -s 0.0000001 -p -o $(JSONLOWDIR)/planning_areas.topojson \
$(JSONDIR)/ma_coastalzone.geojson \
$(JSONDIR)/ri_coastalzone.geojson \
$(JSONDIR)/bc_mapp_haida_gwaii.geojson \
$(JSONDIR)/bc_mapp_north_coast.geojson \
$(JSONDIR)/bc_mapp_central_coast.geojson \
$(JSONDIR)/bc_mapp_north_vancouver_island.geojson \
$(JSONDIR)/bc_wcvi.geojson \
$(JSONDIR)/bc_pncima.geojson \
$(JSONDIR)/hi_humpback_sanctuary.geojson \
$(JSONDIR)/LOMA_Beaufort_Sea.geojson \
$(JSONDIR)/LOMA_Eastern_Scotian_Shelf.geojson \
$(JSONDIR)/LOMA_Gulf_of_Saint_Lawrence.geojson \
$(JSONDIR)/LOMA_Pacific_North_Coast.geojson \
$(JSONDIR)/LOMA_Placentia_Bay___Grand_Banks.geojson \
$(JSONDIR)/NLUP_Boundary.geojson \
$(JSONDIR)/florida_keys.geojson \
$(JSONDIR)/oregon.geojson \
$(JSONDIR)/great_lakes.geojson \
$(JSONDIR)/pacific_islands.geojson \
$(JSONDIR)/us_caribbean.geojson \
$(JSONDIR)/us_west_coast.geojson \
$(JSONDIR)/washington_state.geojson \
$(JSONDIR)/south_atlantic.geojson \
$(JSONDIR)/nroc_data_development_area.geojson \
$(JSONDIR)/marco_data_development_area.geojson \
data: datadir $(DATADIR)/USMaritimeLimitsNBoundaries.shp $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions.shp $(DATADIR)/MA_Coastal_Zone/MA_Coastal_Zone.shp $(DATADIR)/mbounds_samp.shp
$(JSONDIR)/us_eez.geojson: $(DATADIR)/USMaritimeLimitsNBoundaries.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
$(DATADIR)/USMaritimeLimitsAndBoundariesSHP.zip:
curl -sL http://maritimeboundaries.noaa.gov/downloads/USMaritimeLimitsAndBoundariesSHP.zip -o $@
# The changed spelling of "And" to "N" is not a typo. That's what's in the zip file.
$(DATADIR)/USMaritimeLimitsNBoundaries.shp: $(DATADIR)/USMaritimeLimitsAndBoundariesSHP.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/CoastalZoneManagementActBoundary.zip:
curl -sL ftp://ftp.csc.noaa.gov/pub/MSP/CoastalZoneManagementActBoundary.zip -o $@
# This one is a gdb
#$(DATADIR)/CoastalZoneManagementActBoundary.shp: $(DATADIR)/CoastalZoneManagementActBoundary.zip
# TODO: continue here
### US fisheries regions
$(DATADIR)/NationalMarineFisheriesServiceRegions.zip:
curl -sL http://csc.noaa.gov/htdata/CMSP/FederalGeoregulations/NationalMarineFisheriesServiceRegions.zip -o $@
# Respect the unnecessary subdirectories for now
$(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions.shp: $(DATADIR)/NationalMarineFisheriesServiceRegions.zip
unzip $< -d $(DATADIR) && \
touch $@
$(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions_4326.shp: $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" $@ $< && \
### British Columbia MaPP_subregions
### Haida Gwaii
$(JSONDIR)/bc_mapp_haida_gwaii.geojson: $(DATADIR)/MaPP_subregions/HaidaGwaii_Marine_Area_EstuaryCorrected.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Haida Gwaii - MaPP" as name, * FROM HaidaGwaii_Marine_Area_EstuaryCorrected' $@ $<
### BC North Coast
$(JSONDIR)/bc_mapp_north_coast.geojson: $(DATADIR)/MaPP_subregions/NorthCoast_Marine_Area_EstuaryCorrected.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "North Coast - MaPP" as name, * FROM NorthCoast_Marine_Area_EstuaryCorrected' $@ $<
### BC Central Coast
$(JSONDIR)/bc_mapp_central_coast.geojson: $(DATADIR)/MaPP_subregions/CentralCoast_Marine_Area_EstuaryCorrected.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Central Coast - MaPP" as name, * FROM CentralCoast_Marine_Area_EstuaryCorrected' $@ $<
### BC North Vancouver Island
$(JSONDIR)/bc_mapp_north_vancouver_island.geojson: $(DATADIR)/MaPP_subregions/NorthVancouverIsland_Marine_Area_EstuaryCorrected.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "North Vancouver Island - MaPP" as name, * FROM NorthVancouverIsland_Marine_Area_EstuaryCorrected' $@ $<
### British Columbia West Coast Vancouver Island
$(JSONDIR)/bc_wcvi.geojson: $(DATADIR)/WCVI_AMB_Boundary_Union/AMB_Boundary_Union.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" $(DATADIR)/bc_wcvi_4326.shp $< && \
ogr2ogr -overwrite -clipsrc $(DATADIR)/ne_10m_ocean.shp $(DATADIR)/bc_wcvi_clipped.shp $(DATADIR)/bc_wcvi_4326.shp && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "British Columbia West Coast Vancouver Island" as name, * FROM bc_wcvi_clipped' $@ $(DATADIR)/bc_wcvi_clipped.shp
### British Columbia PNCIMA
$(JSONDIR)/bc_pncima.geojson: $(DATADIR)/PNCIMA/PNCIMA_with_watersheds_BCalb.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" $(DATADIR)/PNCIMA/pncima_4326.shp $< && \
ogr2ogr -overwrite -clipsrc $(DATADIR)/ne_10m_ocean.shp $(DATADIR)/PNCIMA/pncima_clipped.shp $(DATADIR)/PNCIMA/pncima_4326.shp && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "British Columbia PNCIMA" as name, * FROM pncima_clipped' $@ $(DATADIR)/PNCIMA/pncima_clipped.shp
### Massachusetts
#$(DATADIR)/ma-coastal-zone-boundary-2012.zip:
#curl -sL http://www.mass.gov/eea/docs/czm/fcr-regs/ma-coastal-zone-boundary-2012.zip -o $@
# The unzip generates an error, prepend a '-' to ignore it
#$(DATADIR)/MA_Coastal_Zone/MA_Coastal_Zone.shp: $(DATADIR)/ma-coastal-zone-boundary-2012.zip
#-unzip $< -d $(DATADIR) && \
#touch $@
$(JSONDIR)/ma_coastalzone.geojson: $(DATADIR)/MA_Coastal_Zone/MA_Coastal_Zone.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" $(DATADIR)/ma_coastalzone_4326.shp $< && \
ogr2ogr -overwrite -clipsrc $(DATADIR)/ne_10m_ocean.shp $(DATADIR)/ma_coastalzone_clipped.shp $(DATADIR)/ma_coastalzone_4326.shp && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Massachusetts" as name, * FROM ma_coastalzone_clipped' $@ $(DATADIR)/ma_coastalzone_clipped.shp
### Rhode Island
$(DATADIR)/mbounds_samp.zip:
curl -sL http://www.narrbay.org/d_projects/OceanSAMP/Downloads/mbounds_samp.zip -o $@
$(DATADIR)/mbounds_samp.shp: $(DATADIR)/mbounds_samp.zip
unzip $< -d $(DATADIR) && \
touch $@
$(JSONDIR)/ri_coastalzone.geojson: $(DATADIR)/mbounds_samp.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Rhode Island" as name, * FROM mbounds_samp' $@ $<
### Hawaii
$(DATADIR)/hihwnms_py2.zip:
curl -sL http://sanctuaries.noaa.gov/library/imast/hihwnms_py2.zip -o $@
$(DATADIR)/hihwnms_py.shp: $(DATADIR)/hihwnms_py2.zip
unzip $< -d $(DATADIR) && \
touch $@
$(JSONDIR)/hi_humpback_sanctuary.geojson: $(DATADIR)/hihwnms_py.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Hawaii" as name, * FROM hihwnms_py' $@ $<
### Canada EEZ
$(JSONDIR)/canada_eez.geojson: $(DATADIR)/canada_eez.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
# TODO: source for Canadian EEZ. I downloaded from here: http://www.marineregions.org/gazetteer.php?p=details&id=8493
### Beaufort Sea
### Data comes from LOMA_Shapefiles.zip (Canada)
$(JSONDIR)/LOMA_Beaufort_Sea.geojson: $(DATADIR)/LOMA_Shapefiles/LOMA_Beaufort_Sea.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
### Eastern Scotian Shelf
### Data comes from LOMA_Shapefiles.zip (Canada)
$(JSONDIR)/LOMA_Eastern_Scotian_Shelf.geojson: $(DATADIR)/LOMA_Shapefiles/LOMA_Eastern_Scotian_Shelf_Updated.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
### Gulf of Saint Lawrence
### Data comes from LOMA_Shapefiles.zip (Canada)
$(JSONDIR)/LOMA_Gulf_of_Saint_Lawrence.geojson: $(DATADIR)/LOMA_Shapefiles/LOMA_Gulf_of_Saint_Lawrence.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
### Pacific North Coast
### Data comes from LOMA_Shapefiles.zip (Canada)
$(JSONDIR)/LOMA_Pacific_North_Coast.geojson: $(DATADIR)/LOMA_Shapefiles/LOMA_Pacific_North_Coast.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
### Placentia Bay / Grand Banks
### Data comes from LOMA_Shapefiles.zip (Canada)
$(JSONDIR)/LOMA_Placentia_Bay___Grand_Banks.geojson: $(DATADIR)/LOMA_Shapefiles/LOMA_Placentia_Bay___Grand_Banks.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
### Nunavut
### NOTE, this data does not come from LOMA_Shapefiles.zip. From NLUP_Boundary.zip (Canada)
$(JSONDIR)/NLUP_Boundary.geojson: $(DATADIR)/NLUP_Boundary/NLUP_Boundary.shp $(DATADIR)/ne_10m_lakes.shp
ogr2ogr -overwrite -t_srs "EPSG:4326" $(DATADIR)/NLUP_Boundary/NLUP_Boundary_4326.shp $< && \
ogr2ogr -overwrite $(DATADIR)/NLUP_Boundary/NLUP_Boundary_4326_dissolved.shp $(DATADIR)/NLUP_Boundary/NLUP_Boundary_4326.shp -dialect sqlite -sql "SELECT ST_union(Geometry),'Nunavut' as name from NLUP_Boundary_4326 group by name" && \
ogr2ogr -overwrite -clipsrc $(DATADIR)/ne_10m_ocean.shp $(DATADIR)/NLUP_Boundary/NLUP_Boundary_4326_clipped.shp $(DATADIR)/NLUP_Boundary/NLUP_Boundary_4326_dissolved.shp && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $(DATADIR)/NLUP_Boundary/NLUP_Boundary_4326_clipped.shp
### Florida keys
$(DATADIR)/fknms_py2.zip:
curl -sL http://sanctuaries.noaa.gov/library/imast/fknms_py2.zip -o $@
$(DATADIR)/fknms_py.shp: $(DATADIR)/fknms_py2.zip
unzip $< -d $(DATADIR) && \
touch $@
$(JSONDIR)/florida_keys.geojson: $(DATADIR)/fknms_py.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Florida Keys" as name, * FROM fknms_py' $@ $<
### Oregon
$(DATADIR)/BASE_Territorial_Sea_Polygon_ESIshoreline.zip:
curl -sL 'http://www.oregonocean.info/index.php?option=com_docman&task=doc_download&gid=819&Itemid=19' -o $@
$(DATADIR)/BASE_Territorial_Sea_Polygon_ESIshoreline.shp: $(DATADIR)/BASE_Territorial_Sea_Polygon_ESIshoreline.zip
unzip $< -d $(DATADIR) && \
touch $@
$(JSONDIR)/oregon.geojson: $(DATADIR)/BASE_Territorial_Sea_Polygon_ESIshoreline.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Oregon" as name, * FROM BASE_Territorial_Sea_Polygon_ESIshoreline' $@ $<
### Great Lakes
$(JSONDIR)/great_lakes.geojson: $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions_4326.shp $(DATADIR)/ne_10m_lakes.shp
ogr2ogr -overwrite $(DATADIR)/NationalMarineFisheriesServiceRegions/great_lakes_dissolved.shp $(DATADIR)/ne_10m_lakes.shp -dialect sqlite -sql "SELECT ST_union(Geometry),name_alt from ne_10m_lakes where name_alt = 'Great Lakes' group by name_alt" && \
ogr2ogr -overwrite -clipsrc $(DATADIR)/NationalMarineFisheriesServiceRegions/great_lakes_dissolved.shp $(DATADIR)/NationalMarineFisheriesServiceRegions/great_lakes_clipped.shp -clipdstwhere "Region = Northeast" $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions_4326.shp && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $(DATADIR)/NationalMarineFisheriesServiceRegions/great_lakes_clipped.shp
### Pacific Islands
$(JSONDIR)/pacific_islands.geojson: $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions_4326.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp
ogr2ogr -overwrite $(DATADIR)/NationalMarineFisheriesServiceRegions/pacific_islands_dissolved.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp -dialect sqlite -sql "SELECT ST_union(Geometry),Sovereign from World_EEZ_v8_2014 where Country = 'Wake Island' or Country = 'Northern Mariana Islands and Guam' or Country = 'Johnston Atoll' or Country = 'Howland Island and Baker Island' or Country = 'Palmyra Atoll' or Country = 'Jarvis Island' or Country = 'American Samoa' or Country = 'Hawaii' group by Sovereign" && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $(DATADIR)/NationalMarineFisheriesServiceRegions/pacific_islands_dissolved.shp
### US Caribbean
$(JSONDIR)/us_caribbean.geojson: $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions_4326.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp
ogr2ogr -overwrite $(DATADIR)/NationalMarineFisheriesServiceRegions/us_caribbean_dissolved.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp -dialect sqlite -sql "SELECT ST_union(Geometry),Sovereign from World_EEZ_v8_2014 where Country = 'Puerto Rico' or Country = 'Virgin Islands of the United States' group by Sovereign" && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $(DATADIR)/NationalMarineFisheriesServiceRegions/us_caribbean_dissolved.shp
### US West Coast
$(JSONDIR)/us_west_coast.geojson: $(DATADIR)/NationalMarineFisheriesServiceRegions/NationalMarineFisheriesServiceRegions_4326.shp $(DATADIR)/ne_10m_ocean.shp
ogr2ogr -overwrite -clipsrc -130 25 -115 50 $(DATADIR)/NationalMarineFisheriesServiceRegions/us_west_coast_clipped.shp $(DATADIR)/World_EEZ_v8_20140228_LR/World_EEZ_v8_2014.shp && \
ogr2ogr -overwrite -where "EEZ_ID='163'" $(DATADIR)/NationalMarineFisheriesServiceRegions/us_west_coast_extracted.shp $(DATADIR)/NationalMarineFisheriesServiceRegions/us_west_coast_clipped.shp && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $(DATADIR)/NationalMarineFisheriesServiceRegions/us_west_coast_extracted.shp
### Washington State
$(JSONDIR)/washington_state.geojson: $(DATADIR)/WA_state_MSP/WA_state_MSP.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT "Washington State" as name, * FROM WA_state_MSP' $@ $<
### South Atlantic
$(DATADIR)/sa_eez_off_states.zip:
curl -sL 'http://sero.nmfs.noaa.gov/maps_gis_data/fisheries/s_atlantic/geodata/sa_eez_off_states.zip' -o $@
### Northeast US
$(JSONDIR)/nroc_data_development_area.geojson: $(DATADIR)/nroc/nroc_data_development_area.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" $@ $<
### Mid-Atlantic US
$(JSONDIR)/marco_data_development_area.geojson: $(DATADIR)/marco/marco_data_development_area.shp
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -s_srs "EPSG:3857" $@ $<
$(DATADIR)/SA_EEZ_off_states.shp: $(DATADIR)/sa_eez_off_states.zip
unzip $< -d $(DATADIR) && \
touch $@
# Note, here we add a buffer of 0.001 degrees so our union doesn't have slivers
$(JSONDIR)/south_atlantic.geojson: $(DATADIR)/SA_EEZ_off_states.shp
ogr2ogr -overwrite $(DATADIR)/sa_eez_off_states_dissolved.shp $(DATADIR)/SA_EEZ_off_states.shp -dialect sqlite -sql "SELECT ST_union(ST_buffer(Geometry,0.001)),'South Atlantic' as name from SA_EEZ_off_states group by name" && \
ogr2ogr -overwrite -f "GeoJSON" -t_srs "EPSG:4326" -sql 'SELECT * FROM sa_eez_off_states_dissolved' $@ $(DATADIR)/sa_eez_off_states_dissolved.shp