comparison flys-artifacts/doc/conf/meta-data.xml @ 5515:87dab419b924

Properly handle hydr_boundaries and hydr_boundaries_poly in datacage This also fixes hydr_boundaries_poly which refered to the wrong table
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 28 Mar 2013 17:13:53 +0100
parents 23d8f2700b38
children 56d18ecc7d41
comparison
equal deleted inserted replaced
5514:4c4fed23693f 5515:87dab419b924
1236 </dc:elements> 1236 </dc:elements>
1237 </other> 1237 </other>
1238 </dc:if> 1238 </dc:if>
1239 </dc:context> 1239 </dc:context>
1240 </dc:macro> 1240 </dc:macro>
1241 <dc:macro name="flood-map-hydr-boundaries"> 1241 <dc:macro name="flood-map-hydr-boundaries-state">
1242 <hydr_boundaries_lines> 1242 <dc:context>
1243 <dc:call-macro name="flood-map-hydr-boundaries-lines"/> 1243 <dc:statement>
1244 </hydr_boundaries_lines> 1244 SELECT DISTINCT
1245 <hydr_boundaries_polygons> 1245 name
1246 <dc:call-macro name="flood-map-hydr-boundaries-poly"/> 1246 FROM hydr_boundaries
1247 </hydr_boundaries_polygons> 1247 WHERE river_id = ${river_id}
1248 AND kind = 2
1249 </dc:statement>
1250 <dc:elements>
1251 <line factory="wmshydrboundariesfactory"
1252 ids="{$river_id};{$name};2"
1253 name="{$name}"/>
1254 </dc:elements>
1255 </dc:context>
1256 <dc:context>
1257 <dc:statement>
1258 SELECT DISTINCT
1259 name
1260 FROM hydr_boundaries_poly
1261 WHERE river_id = ${river_id}
1262 AND kind = 2
1263 </dc:statement>
1264 <dc:elements>
1265 <line factory="wmshydrboundariespolyfactory"
1266 ids="{$river_id};{$name};2"
1267 name="{$name}"/>
1268 </dc:elements>
1269 </dc:context>
1248 </dc:macro> 1270 </dc:macro>
1249 <dc:macro name="flood-map-hydr-boundaries-lines"> 1271 <dc:macro name="flood-map-hydr-boundaries-lines">
1250 <bfg> 1272 <dc:context>
1251 <dc:context> 1273 <dc:statement>
1252 <dc:statement> 1274 SELECT DISTINCT
1253 SELECT count(*) as km_exists, name as name 1275 name
1254 FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 1 GROUP BY name 1276 FROM hydr_boundaries
1255 </dc:statement> 1277 WHERE river_id = ${river_id}
1256 <dc:elements> 1278 AND kind = 1
1257 <dc:if test="$km_exists>0"> 1279 </dc:statement>
1258 <hydrboundary> 1280 <dc:comment> What about all other line kinds?</dc:comment>
1259 <dc:attribute name="factory" value="wmshydrboundariesfactory"/> 1281 <dc:if test="dc:has-result()">
1260 <dc:attribute name="ids" value="${river_id};${name}"/> 1282 <lines>
1261 <dc:attribute name="name" value="${name}"/> 1283 <dc:elements>
1262 </hydrboundary> 1284 <line factory="wmshydrboundariesfactory"
1263 </dc:if> 1285 ids="{$river_id};{$name};1"
1264 </dc:elements> 1286 name="{$name}"/>
1265 </dc:context> 1287 </dc:elements>
1266 </bfg> 1288 </lines>
1267 <land> 1289 </dc:if>
1268 <dc:context> 1290 </dc:context>
1269 <dc:statement>
1270 SELECT count(*) as km_exists, name as name
1271 FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 2 GROUP BY name
1272 </dc:statement>
1273 <dc:elements>
1274 <dc:if test="$km_exists>0">
1275 <hydrboundary>
1276 <dc:attribute name="factory" value="wmshydrboundariesfactory"/>
1277 <dc:attribute name="ids" value="${river_id};${name}"/>
1278 <dc:attribute name="name" value="${name}"/>
1279 </hydrboundary>
1280 </dc:if>
1281 </dc:elements>
1282 </dc:context>
1283 </land>
1284 </dc:macro> 1291 </dc:macro>
1285 <dc:macro name="flood-map-hydr-boundaries-poly"> 1292 <dc:macro name="flood-map-hydr-boundaries-poly">
1286 <bfg> 1293 <dc:context>
1287 <dc:context> 1294 <dc:statement>
1288 <dc:statement> 1295 SELECT DISTINCT
1289 SELECT count(*) as km_exists, name as name 1296 b.sectie AS sectie_id,
1290 FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 1 GROUP BY name 1297 sk.name AS sectie
1291 </dc:statement> 1298 FROM hydr_boundaries_poly b
1292 <dc:elements> 1299 JOIN sectie_kinds sk ON b.sectie = sk.id
1293 <dc:if test="$km_exists>0"> 1300 WHERE b.river_id = ${river_id}
1294 <hws> 1301 AND b.kind = 1
1295 <dc:attribute name="factory" value="wmshydrboundariespolyfactory"/> 1302 </dc:statement>
1296 <dc:attribute name="ids" value="${river_id};${name}"/> 1303 <dc:if test="dc:has-result()">
1297 <dc:attribute name="name" value="${name}"/> 1304 <sobek_areas>
1298 </hws> 1305 <dc:elements>
1299 </dc:if> 1306 <boundary name="{$sectie}"
1300 </dc:elements> 1307 factory="wmshydrboundariespolyfactory"
1301 </dc:context> 1308 ids="{$river_id};{$sectie};1;{$sectie_id};-1"/>
1302 </bfg> 1309 </dc:elements>
1303 <land> 1310 </sobek_areas>
1304 <dc:context> 1311 </dc:if>
1305 <dc:statement> 1312 </dc:context>
1306 SELECT count(*) as km_exists, name as name 1313 <dc:context>
1307 FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 2 GROUP BY name 1314 <dc:statement>
1308 </dc:statement> 1315 SELECT DISTINCT
1309 <dc:elements> 1316 b.sobek AS sobek_id,
1310 <dc:if test="$km_exists>0"> 1317 sk.name AS sobek
1311 <hws> 1318 FROM hydr_boundaries_poly b
1312 <dc:attribute name="factory" value="wmshydrboundariespolyfactory"/> 1319 JOIN sobek_kinds sk ON b.sobek = sk.id
1313 <dc:attribute name="ids" value="${river_id};${name}"/> 1320 WHERE b.river_id = ${river_id}
1314 <dc:attribute name="name" value="${name}"/> 1321 AND b.kind = 1
1315 </hws> 1322 </dc:statement>
1316 </dc:if> 1323 <dc:if test="dc:has-result()">
1317 </dc:elements> 1324 <sobek_flooded>
1318 </dc:context> 1325 <dc:elements>
1319 </land> 1326 <boundary name="{$sobek}"
1327 factory="wmshydrboundariespolyfactory"
1328 ids="{$river_id};{$sobek};1;-1;{$sobek_id}"/>
1329 </dc:elements>
1330 </sobek_flooded>
1331 </dc:if>
1332 </dc:context>
1333 </dc:macro>
1334 <dc:macro name="flood-map-hydr-boundaries">
1335 <bfg_model>
1336 <areas>
1337 <dc:call-macro name="flood-map-hydr-boundaries-poly"/>
1338 </areas>
1339 <dc:call-macro name="flood-map-hydr-boundaries-lines"/>
1340 </bfg_model>
1341 <federal>
1342 <dc:call-macro name="flood-map-hydr-boundaries-state"/>
1343 </federal>
1320 </dc:macro> 1344 </dc:macro>
1321 <dc:macro name="flood-map-floodplain"> 1345 <dc:macro name="flood-map-floodplain">
1322 <dc:context> 1346 <dc:context>
1323 <dc:statement> 1347 <dc:statement>
1324 SELECT DISTINCT 1348 SELECT DISTINCT

http://dive4elements.wald.intevation.org