geoserver

Форк
0
/
build.xml 
226 строк · 8.9 Кб
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"
4
> 
5
  <!-- macros -->
6
  <macrodef name="download">
7
    <attribute name="download" default="download"/>
8
    <attribute name="file"/>
9
    <attribute name="url"/>
10
    <sequential>
11
      <condition property="@{file}.downloaded">
12
        <available file="@{download}/@{file}"/>
13
      </condition>
14
      <get unless:set="@{file}.downloaded"
15
        skipexisting="true" tryGzipEncoding="true" 
16
         src="@{url}"
17
         dest="@{download}/@{file}"/>
18
    </sequential>
19
  </macrodef>
20
    
21
  <!-- some common locations -->
22
  <property name="download" location="download"/>
23
  <property name="process" location="process"/>
24
  <property name="data" location="../../data/release/data"/>
25

26
  <!-- check environment -->
27
  <condition property="download.available">
28
    <available file="${download}"/>
29
  </condition>
30
  <condition property="process.available">
31
    <available file="${process}"/>
32
  </condition>
33
  
34
  <property environment="env"/>
35
  <path id="combined-PATH">
36
    <pathelement path="${env.PATH}"/> <!--linux-->
37
    <pathelement path="${env.Path}"/> <!--windows-->
38
  </path>
39
  <property name="PATH" refid="combined-PATH"/>
40
  <condition property="ogr.available">
41
    <or>
42
      <available file="ogr2ogr.exe" filepath="${PATH}"/>
43
      <available file="ogr2ogr" filepath="${PATH}"/>
44
    </or>
45
  </condition>
46
  
47
  <!-- clean -->
48
  <target name="clean_download"
49
          description="clean downloads ">
50
     <delete dir="${download}"/>
51
  </target>
52
  
53
  <target name="clean"
54
          description="clean processed files">
55
     <delete dir="${process}"/>
56
  </target>
57

58
  <!-- init -->
59
  <target name="init_download" unless="download.available">
60
     <mkdir dir="${download}"/>
61
  </target>
62
  
63
  <target name="init" depends="init_download" unless="process.available">
64
     <mkdir dir="${process}"/>
65
  </target>
66
  
67
  <!-- download -->
68
  <target name="download" depends="init_download" 
69
          description="Pre-download and prep files">
70
    <parallel threadCount="5">
71
      <antcall target="ne_geopackage_download"/>
72
    </parallel>
73
  </target>
74
  
75
  <!-- process -->
76
  <target name="process" depends="download,init" 
77
          description="Prep files">
78
    <antcall target="ne_geopackage_process"/>
79
  </target>
80
  
81
  <target name="install" depends="process" description="Update release/data with processed data.">
82
      <copy 
83
        file="${process}/natural_earth.gpkg" todir="${data}/ne"/>
84
  </target>
85
  
86
  <!-- Natural Earth GeoPackage -->
87
  <target name="ne_geopackage_download" depends="init_download">
88
     <download
89
       url="https://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip"
90
       file="natural_earth_vector.gpkg.zip">
91
     </download>
92
  </target>
93

94
  <!-- check if custom (processed) geopackage is available -->
95
  <target name="ne_geopackage_check">
96
      <available file="${process}/natural_earth.gpkg" property="gpkg.processed"/>
97
  </target>
98
  
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}">
102
         <patternset>
103
            <include name="packages/*"/>
104
         </patternset>
105
         <mapper type="flatten"/>
106
      </unzip>
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"/>
111
      
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."/>
120
      </antcall>
121

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."/>
130
      </antcall>
131

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"/>
140
      </antcall>
141
      
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."/>
150
      </antcall>
151

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"/>
160
      </antcall>
161
      
162
      <!-- roads increases size from 900k to 3.6M -->
163
      <!--antcall target="-lines">
164
        <param name="table" value="roads"/>
165
        <param name="from" value="ne_10m_roads"/>
166
        <param name="select" value = "fid,geom,type,name,label,label2,local,localalt,labelrank,min_zoom,min_label"/>
167
        <param name="where" value ="min_zoom &lt; 6"/>
168
        <param name="options" value="-update"/>
169
        <param name="title" value="Roads"/>
170
        <param name="simplify" value ="0.15"/>
171
        <param name="description" value="Transportation."/>
172
      </antcall-->
173

174
  </target>
175
  
176
  <!-- processing -->
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}"/>
188
        <arg value="-sql"/>
189
        <arg value="SELECT ${select} FROM ${from} WHERE ${where}"/>
190
        <arg line="-simplify ${simplify}" unless:blank="${simplify}"/>
191
      </exec>
192
  </target>
193
  
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}"/>
206
        <arg value="-sql"/>
207
        <arg value="SELECT ${select} FROM ${from}"/>
208
      </exec>
209
  </target>
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}"/>
221
        <arg value="-sql"/>
222
        <arg value="SELECT ${select} FROM ${from}"/>
223
      </exec>
224
  </target>
225
    
226
</project>

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.