1
<project name="data_directory" default="process"
2
xmlns:if="ant:if" xmlns:unless="ant:unless"
3
xmlns:resolver="antlib:org.apache.maven.resolver.ant"
6
<macrodef name="download">
7
<attribute name="download" default="download"/>
8
<attribute name="file"/>
9
<attribute name="url"/>
11
<condition property="@{file}.downloaded">
12
<available file="@{download}/@{file}"/>
14
<get unless:set="@{file}.downloaded"
15
skipexisting="true" tryGzipEncoding="true"
17
dest="@{download}/@{file}"/>
22
<property name="download" location="download"/>
23
<property name="process" location="process"/>
24
<property name="data" location="../../data/release/data"/>
27
<condition property="download.available">
28
<available file="${download}"/>
30
<condition property="process.available">
31
<available file="${process}"/>
34
<property environment="env"/>
35
<path id="combined-PATH">
36
<pathelement path="${env.PATH}"/>
37
<pathelement path="${env.Path}"/>
39
<property name="PATH" refid="combined-PATH"/>
40
<condition property="ogr.available">
42
<available file="ogr2ogr.exe" filepath="${PATH}"/>
43
<available file="ogr2ogr" filepath="${PATH}"/>
48
<target name="clean_download"
49
description="clean downloads ">
50
<delete dir="${download}"/>
54
description="clean processed files">
55
<delete dir="${process}"/>
59
<target name="init_download" unless="download.available">
60
<mkdir dir="${download}"/>
63
<target name="init" depends="init_download" unless="process.available">
64
<mkdir dir="${process}"/>
68
<target name="download" depends="init_download"
69
description="Pre-download and prep files">
70
<parallel threadCount="5">
71
<antcall target="ne_geopackage_download"/>
76
<target name="process" depends="download,init"
77
description="Prep files">
78
<antcall target="ne_geopackage_process"/>
81
<target name="install" depends="process" description="Update release/data with processed data.">
83
file="${process}/natural_earth.gpkg" todir="${data}/ne"/>
87
<target name="ne_geopackage_download" depends="init_download">
89
url="https://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip"
90
file="natural_earth_vector.gpkg.zip">
95
<target name="ne_geopackage_check">
96
<available file="${process}/natural_earth.gpkg" property="gpkg.processed"/>
99
<target name="ne_geopackage_process" depends="ne_geopackage_download,ne_geopackage_check" unless="gpkg.processed">
100
<echo level="info">Unzip into ${download}</echo>
101
<unzip overwrite="false" src="${download}/natural_earth_vector.gpkg.zip" dest="${download}">
103
<include name="packages/*"/>
105
<mapper type="flatten"/>
107
<echo level="info">Use ogr2ogr create natural_earth.gpkg</echo>
108
<property name="input" location="${download}/natural_earth_vector.gpkg"/>
109
<property name="output" location="${process}/natural_earth.gpkg"/>
110
<property name="options" location="-append -update"/>
112
<antcall target="-lines">
113
<param name="table" value="boundary_lines_land"/>
114
<param name="from" value="ne_50m_admin_0_boundary_lines_land"/>
115
<param name="select" value = "fid,geom,SCALERANK,FEATURECLA,MIN_ZOOM"/>
116
<param name="where" value ="TRUE"/>
117
<param name="options" value=""/>
118
<param name="title" value="Boundary Lines"/>
119
<param name="description" value="Country boundaries on land and offshore."/>
122
<antcall target="-lines">
123
<param name="table" value="coastlines"/>
124
<param name="from" value="ne_50m_coastline"/>
125
<param name="select" value = "*"/>
126
<param name="where" value ="TRUE"/>
127
<param name="options" value="-update"/>
128
<param name="title" value="Coastlines"/>
129
<param name="description" value="Ocean coastline, including major islands."/>
132
<antcall target="-polygons">
133
<param name="table" value="countries"/>
134
<param name="from" value="ne_50m_admin_0_countries"/>
135
<param name="select" value = "fid,geom,featurecla,scalerank,LABELRANK,SOVEREIGNT,SOV_A3,ADM0_DIF,LEVEL,TYPE,TLC,ADMIN,ADM0_A3,GEOU_DIF,GEOUNIT,GU_A3,SU_DIF,SUBUNIT,SU_A3,BRK_DIFF,NAME,NAME_LONG,BRK_A3,BRK_NAME,BRK_GROUP,ABBREV,POSTAL,FORMAL_EN,FORMAL_FR,NAME_CIAWF,NOTE_ADM0,NOTE_BRK,NAME_SORT,NAME_ALT,MAPCOLOR7,MAPCOLOR8,MAPCOLOR9,MAPCOLOR13,POP_EST,POP_RANK,POP_YEAR,GDP_MD,GDP_YEAR,ECONOMY,INCOME_GRP,FIPS_10,ISO_A2,ISO_A2_EH,ISO_A3,ISO_A3_EH,ISO_N3,ISO_N3_EH,UN_A3,WB_A2,WB_A3,WOE_ID,WOE_ID_EH,WOE_NOTE,ADM0_ISO,CONTINENT,REGION_UN,SUBREGION,REGION_WB,NAME_LEN,LONG_LEN,ABBREV_LEN,TINY,HOMEPART,MIN_ZOOM,MIN_LABEL,MAX_LABEL,LABEL_X,LABEL_Y,NE_ID,WIKIDATAID,NAME_AR,NAME_BN,NAME_DE,NAME_EN,NAME_ES,NAME_FA,NAME_FR,NAME_EL,NAME_HE,NAME_HI,NAME_HU,NAME_ID,NAME_IT,NAME_JA,NAME_KO,NAME_NL,NAME_PL,NAME_PT,NAME_RU,NAME_SV,NAME_TR,NAME_UK,NAME_UR,NAME_VI,NAME_ZH,NAME_ZHT,FCLASS_ISO,TLC_DIFF,FCLASS_TLC"/>
136
<param name="where" value ="TRUE"/>
137
<param name="options" value="-update"/>
138
<param name="title" value="Countries"/>
139
<param name="description" value="Sovereign states"/>
142
<antcall target="-polygons">
143
<param name="table" value="disputed_areas"/>
144
<param name="from" value="ne_50m_admin_0_breakaway_disputed_areas"/>
145
<param name="select" value = "*"/>
146
<param name="where" value ="TRUE"/>
147
<param name="options" value="-update"/>
148
<param name="title" value="Disputed Areas"/>
149
<param name="description" value="Disputed areas and breakaway regions."/>
152
<antcall target="-point">
153
<param name="table" value="populated_places"/>
154
<param name="from" value="ne_50m_populated_places_simple"/>
155
<param name="select" value = "*"/>
156
<param name="where" value ="TRUE"/>
157
<param name="options" value="-update"/>
158
<param name="title" value="Populated places"/>
159
<param name="description" value="City and town points"/>
177
<target name="-lines">
178
<echo level="info">${title}: ${description}</echo>
179
<exec executable="ogr2ogr">
180
<arg line="-f 'GPKG'"/>
181
<arg path="${output}"/>
182
<arg path="${input}"/>
183
<arg line="-lco IDENTIFIER='${title}'"/>
184
<arg line="-lco DESCRIPTION='${description}'"/>
185
<arg line="${options}"/>
186
<arg line="-nlt MULTILINESTRING"/>
187
<arg line="-nln ${table}"/>
189
<arg value="SELECT ${select} FROM ${from} WHERE ${where}"/>
190
<arg line="-simplify ${simplify}" unless:blank="${simplify}"/>
194
<target name="-polygons">
195
<echo level="info">${title}: ${description}</echo>
196
<exec executable="ogr2ogr">
197
<arg line="-f 'GPKG'"/>
198
<arg path="${output}"/>
199
<arg path="${input}"/>
200
<arg line="-lco OVERWRITE=YES"/>
201
<arg line="-lco IDENTIFIER='${title}'"/>
202
<arg line="-lco DESCRIPTION='${description}'"/>
203
<arg line="${options}"/>
204
<arg line="-nlt MULTIPOLYGON"/>
205
<arg line="-nln ${table}"/>
207
<arg value="SELECT ${select} FROM ${from}"/>
210
<target name="-point">
211
<echo level="info">${title}: ${description}</echo>
212
<exec executable="ogr2ogr">
213
<arg line="-f 'GPKG'"/>
214
<arg path="${output}"/>
215
<arg path="${input}"/>
216
<arg line="-lco IDENTIFIER='${title}'"/>
217
<arg line="-lco DESCRIPTION='${description}'"/>
218
<arg line="${options}"/>
219
<arg line="-nlt POINT"/>
220
<arg line="-nln ${table}"/>
222
<arg value="SELECT ${select} FROM ${from}"/>