-
Notifications
You must be signed in to change notification settings - Fork 77
/
Import_OSM.groovy
1645 lines (1555 loc) · 61.1 KB
/
Import_OSM.groovy
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* NoiseModelling is an open-source tool designed to produce environmental noise maps on very large urban areas. It can be used as a Java library or be controlled through a user friendly web interface.
*
* This version is developed by Université Gustave Eiffel and CNRS
* <http://noise-planet.org/noisemodelling.html>
*
* NoiseModelling is distributed under GPL 3 license. You can read a copy of this License in the file LICENCE provided with this software.
*
* Contact: contact@noise-planet.org
*
*/
/**
* @Author Valentin Le Bescond, Université Gustave Eiffel
* @Author Nicolas Fortin, Université Gustave Eiffel
* @Author Gwendall Petit, Cerema
* @Author Pierre Aumond, Université Gustave Eiffel
* @Author buildingParams.json is from https://github.com/orbisgis/geoclimate/
*/
package org.noise_planet.noisemodelling.wps.Import_and_Export
import crosby.binary.osmosis.OsmosisReader
import geoserver.GeoServer
import geoserver.catalog.Store
import groovy.json.JsonSlurper
import groovy.sql.Sql
import org.geotools.jdbc.JDBCDataStore
import org.h2gis.utilities.wrapper.ConnectionWrapper
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.Geometry
import org.locationtech.jts.geom.GeometryFactory
import org.openstreetmap.osmosis.core.container.v0_6.EntityContainer
import org.openstreetmap.osmosis.core.container.v0_6.NodeContainer
import org.openstreetmap.osmosis.core.container.v0_6.RelationContainer
import org.openstreetmap.osmosis.core.container.v0_6.WayContainer
import org.openstreetmap.osmosis.core.domain.v0_6.*
import org.openstreetmap.osmosis.core.task.v0_6.Sink
import org.openstreetmap.osmosis.xml.common.CompressionMethod
import org.openstreetmap.osmosis.xml.v0_6.XmlReader
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.sql.Connection
title = 'Import BUILDINGS, GROUND and ROADS tables from OSM'
description = '➡️ Convert <b>.osm</b>, <b>.osm.gz</b> or <b>.osm.pbf</b> file into NoiseModelling input tables. We recommend using OSMBBBike : https://extract.bbbike.org/ </br>' +
'<hr>' +
'The following output tables will be created: <br>' +
'- <b> BUILDINGS </b>: a table containing the buildings<br>' +
'- <b> GROUND </b>: a table containing ground acoustic absorption, based on OSM landcover surfaces<br>' +
'- <b> ROADS </b>: a table containing the roads. As OSM does not include data on road traffic flows, default values are assigned according to the -Good Practice Guide for Strategic Noise Mapping and the Production of Associated Data on Noise Exposure - Version 2<br><br>' +
'💡 The user can choose to avoid creating some of these tables by checking the dedicated boxes </br> </br>' +
'<img src="/wps_images/import_osm_file.png" alt="Import OSM file" width="95%" align="center">'
inputs = [
pathFile : [
name : 'Path of the OSM file',
title : 'Path of the OSM file',
description: '📂 Path of the OSM file, including its extension (.osm, .osm.gz or .osm.pbf).<br>' +
'For example: c:/home/area.osm.pbf',
type : String.class
],
targetSRID : [
name : 'Target projection identifier',
title : 'Target projection identifier',
description: '🌍 Target projection identifier (also called SRID) of your table.<br>' +
'It should be an <a href="https://epsg.io/" target="_blank">EPSG</a> code, an integer with 4 or 5 digits (ex: <a href="https://epsg.io/3857" target="_blank">3857</a> is Web Mercator projection).<br><br>' +
'🚨 The target SRID must be in <b>metric</b> coordinates.',
type : Integer.class
],
ignoreBuilding : [
name : 'Do not import Buildings',
title : 'Do not import Buildings',
description: '✅ If the box is checked</i> → the table BUILDINGS will <b>NOT</b> be created.<br><br>' +
'🟩 If the box is <b>NOT</b> checked → the table BUILDINGS will be created and will contain:<br>' +
'- <b> PK </b> : An identifier. It shall be a primary key (INTEGER, PRIMARY KEY)<br>' +
'- <b> THE_GEOM </b> : The 2D geometry of the building (POLYGON or MULTIPOLYGON). <br>' +
'- <b> HEIGHT </b> : The height of the building (FLOAT). ' +
'If this information is not available then it is deduced from the number of floors (if available) with the addition of a small random variation from one building to another. ' +
'Finally, if no information is available, a height of 5m is set by default.',
min : 0,
max : 1,
type : Boolean.class
],
ignoreGround : [
name : 'Do not import Surface acoustic absorption',
title : 'Do not import Surface acoustic absorption',
description: '✅ If the box is checked → the table GROUND will <b>NOT</b> be created.<br><br>' +
'🟩 If the box is <b>NOT</b> checked → the table GROUND will be created and will contain: <br>' +
'- <b> PK </b> : An identifier. It shall be a primary key (INTEGER, PRIMARY KEY)<br>' +
'- <b> ID_WAY </b> : OSM identifier (INTEGER)<br>' +
'- <b> THE_GEOM </b> : The 2D geometry of the sources (POLYGON or MULTIPOLYGON)<br>' +
'- <b> PRIORITY </b> : Since NoiseModelling does not allowed overlapping geometries, if this is the case, this column is used to prioritize the geometry that will win over the other one when cutting. The order is given according to the type of land use<br>' +
'- <b> G </b> : The acoustic absorption of a ground (FLOAT) (between 0 : very hard and 1 : very soft)',
min : 0,
max : 1,
type : Boolean.class
],
ignoreRoads : [
name : 'Do not import Roads',
title : 'Do not import Roads',
description: '✅ If the box is checked → the table ROADS will <b>NOT</b> be created.<br><br>' +
'🟩 If the box is <b>NOT</b> checked → the table ROADS will be created and will contain:<br>' +
'- <b> PK </b> : An identifier. It shall be a primary key (INTEGER, PRIMARY KEY)<br>' +
'- <b> ID_WAY </b> : OSM identifier (INTEGER)<br>' +
'- <b> THE_GEOM </b> : The 2D geometry of the sources (LINESTRING or MULTILINESTRING)<br>' +
'- <b> LV_D </b> : Hourly average light and heavy vehicle count (6-18h) (DOUBLE)<br>' +
'- <b> LV_E </b> : Hourly average light and heavy vehicle count (18-22h) (DOUBLE)<br>' +
'- <b> LV_N </b> : Hourly average light and heavy vehicle count (22-6h) (DOUBLE)<br>' +
'- <b> HGV_D </b> : Hourly average heavy vehicle count (6-18h) (DOUBLE)<br>' +
'- <b> HGV_E </b> : Hourly average heavy vehicle count (18-22h) (DOUBLE)<br>' +
'- <b> HGV_N </b> : Hourly average heavy vehicle count (22-6h) (DOUBLE)<br>' +
'- <b> LV_SPD_D </b> : Hourly average light vehicle speed (6-18h) (DOUBLE)<br>' +
'- <b> LV_SPD_E </b> : Hourly average light vehicle speed (18-22h) (DOUBLE)<br>' +
'- <b> LV_SPD_N </b> : Hourly average light vehicle speed (22-6h) (DOUBLE)<br>' +
'- <b> HGV_SPD_D </b> : Hourly average heavy vehicle speed (6-18h) (DOUBLE)<br>' +
'- <b> HGV_SPD_E </b> : Hourly average heavy vehicle speed (18-22h) (DOUBLE)<br>' +
'- <b> HGV_SPD_N </b> : Hourly average heavy vehicle speed (22-6h) (DOUBLE)<br>' +
'- <b> PVMT </b> : CNOSSOS road pavement identifier (ex: NL05) (VARCHAR)<br> <br>' +
'💡 <b>These information are deduced from the roads importance in OSM.</b>.',
min : 0,
max : 1,
type : Boolean.class
],
removeTunnels : [
name : 'Remove tunnels from OSM data',
title : 'Remove tunnels from OSM data',
description: '✅ If checked, remove roads from OSM data that contain OSM tag <b>tunnel=yes</b>.',
min : 0,
max : 1,
type : Boolean.class
],
]
outputs = [
result : [
name: 'Result output string',
title: 'Result output string',
description: 'This type of result does not allow the blocks to be linked together.',
type: String.class
]
]
// Open Connection to Geoserver
static Connection openGeoserverDataStoreConnection(String dbName) {
if (dbName == null || dbName.isEmpty()) {
dbName = new GeoServer().catalog.getStoreNames().get(0)
}
Store store = new GeoServer().catalog.getStore(dbName)
JDBCDataStore jdbcDataStore = (JDBCDataStore) store.getDataStoreInfo().getDataStore(null)
return jdbcDataStore.getDataSource().getConnection()
}
// run the script
def run(input) {
// Get name of the database
// by default an embedded h2gis database is created
// Advanced user can replace this database for a postGis or h2Gis server database.
String dbName = "h2gisdb"
// Open connection
openGeoserverDataStoreConnection(dbName).withCloseable {
Connection connection ->
return [result: exec(connection, input)]
}
}
// main function of the script
def exec(Connection connection, input) {
//Map buildingsParamsMap = buildingsParams.toMap();
connection = new ConnectionWrapper(connection)
Sql sql = new Sql(connection)
String resultString
Logger logger = LoggerFactory.getLogger("org.noise_planet.noisemodelling")
logger.info('Start : Get Buildings from OSM')
logger.info("inputs {}", input)
// -------------------
// Get every inputs
// -------------------
String pathFile = input["pathFile"] as String
Boolean ignoreBuilding = false
if ('ignoreBuilding' in input) {
ignoreBuilding = input['ignoreBuilding'] as Boolean
}
Boolean ignoreGround = false
if ('ignoreGround' in input) {
ignoreGround = input['ignoreGround'] as Boolean
}
Boolean ignoreRoads = false
if ('ignoreRoads' in input) {
ignoreRoads = input['ignoreRoads'] as Boolean
}
Integer srid = 3857
if (input['targetSRID']) {
srid = input['targetSRID'] as Integer
}
Boolean removeTunnels = false
if ('removeTunnels' in input) {
removeTunnels = input['removeTunnels'] as Boolean
}
// Read the OSM file, depending on its extension
def reader
if (pathFile.endsWith(".pbf")) {
InputStream inputStream = new FileInputStream(pathFile);
reader = new OsmosisReader(inputStream);
} else if (pathFile.endsWith(".osm")) {
reader = new XmlReader(new File(pathFile), true, CompressionMethod.None);
} else if (pathFile.endsWith(".osm.gz")) {
reader = new XmlReader(new File(pathFile), true, CompressionMethod.GZip);
}
OsmHandler handler = new OsmHandler(logger, ignoreBuilding, ignoreRoads, ignoreGround, removeTunnels)
reader.setSink(handler);
reader.run();
logger.info('OSM Read done')
if (!ignoreBuilding) {
String tableName = "MAP_BUILDINGS_GEOM";
sql.execute("DROP TABLE IF EXISTS " + tableName)
sql.execute("CREATE TABLE " + tableName + '''(
ID_WAY integer PRIMARY KEY,
THE_GEOM geometry,
HEIGHT real
);''')
for (Building building: handler.buildings) {
sql.execute("INSERT INTO " + tableName + " VALUES (" + building.id + ", ST_MakeValid(ST_SIMPLIFYPRESERVETOPOLOGY(ST_Transform(ST_GeomFromText('" + building.geom + "', 4326), "+srid+"),0.1)), " + building.height + ")")
}
sql.execute('''
CREATE SPATIAL INDEX IF NOT EXISTS BUILDINGS_INDEX ON ''' + tableName + '''(the_geom);
-- List buildings that intersects with other buildings that have a greater area
DROP TABLE IF EXISTS tmp_relation_buildings_buildings;
CREATE TABLE tmp_relation_buildings_buildings AS SELECT s1.ID_WAY as PK_BUILDING, S2.ID_WAY as PK2_BUILDING FROM MAP_BUILDINGS_GEOM S1, MAP_BUILDINGS_GEOM S2 WHERE ST_AREA(S1.THE_GEOM) < ST_AREA(S2.THE_GEOM) AND S1.THE_GEOM && S2.THE_GEOM AND ST_DISTANCE(S1.THE_GEOM, S2.THE_GEOM) <= 0.1;
-- Alter that small area buildings by removing shared area
DROP TABLE IF EXISTS tmp_buildings_truncated;
CREATE TABLE tmp_buildings_truncated AS SELECT PK_BUILDING, ST_DIFFERENCE(s1.the_geom, ST_BUFFER(ST_Collect(s2.the_geom), 0.1, 'join=mitre')) the_geom, s1.HEIGHT HEIGHT from tmp_relation_buildings_buildings r, MAP_BUILDINGS_GEOM s1, MAP_BUILDINGS_GEOM s2 WHERE PK_BUILDING = S1.ID_WAY AND PK2_BUILDING = S2.ID_WAY GROUP BY PK_BUILDING;
-- Merge original buildings with altered buildings
DROP TABLE IF EXISTS BUILDINGS;
CREATE TABLE BUILDINGS(PK INTEGER PRIMARY KEY, THE_GEOM GEOMETRY, HEIGHT real) AS SELECT s.id_way, ST_SETSRID(s.the_geom, '''+srid+'''), s.HEIGHT from MAP_BUILDINGS_GEOM s where id_way not in (select PK_BUILDING from tmp_buildings_truncated) UNION ALL select PK_BUILDING, ST_SETSRID(the_geom, '''+srid+'''), HEIGHT from tmp_buildings_truncated WHERE NOT st_isempty(the_geom);
DROP TABLE IF EXISTS tmp_buildings_truncated;
DROP TABLE IF EXISTS tmp_relation_buildings_buildings;
DROP TABLE IF EXISTS MAP_BUILDINGS_GEOM;
''');
sql.execute("CREATE SPATIAL INDEX IF NOT EXISTS BUILDING_GEOM_INDEX ON " + "BUILDINGS" + "(THE_GEOM)")
}
if (!ignoreRoads) {
sql.execute("DROP TABLE IF EXISTS ROADS")
sql.execute("CREATE TABLE ROADS (PK serial PRIMARY KEY, ID_WAY integer, THE_GEOM geometry, TYPE varchar, LV_D integer, LV_E integer,LV_N integer,HGV_D integer,HGV_E integer,HGV_N integer,LV_SPD_D integer,LV_SPD_E integer,LV_SPD_N integer,HGV_SPD_D integer, HGV_SPD_E integer,HGV_SPD_N integer, PVMT varchar(10));")
for (Road road: handler.roads) {
if (road.geom.isEmpty()) {
continue;
}
String query = 'INSERT INTO ROADS(ID_WAY, ' +
'THE_GEOM, ' +
'TYPE, ' +
'LV_D, LV_E, LV_N, ' +
'HGV_D, HGV_E, HGV_N, ' +
'LV_SPD_D, LV_SPD_E, LV_SPD_N, ' +
'HGV_SPD_D, HGV_SPD_E, HGV_SPD_N, ' +
'PVMT) ' +
' VALUES (?,' +
'st_setsrid(st_updatez(ST_precisionreducer(ST_SIMPLIFYPRESERVETOPOLOGY(ST_TRANSFORM(ST_GeomFromText(?, 4326), '+srid+'),0.1),1), 0.05), ' + srid + '),' +
'?,?,?,?,?,?,?,?,?,?,?,?,?,?);'
sql.execute(query, [road.id, road.geom, road.type,
road.getNbLV("d"), road.getNbLV("e"), road.getNbLV("n"),
road.getNbHV("d"), road.getNbHV("e"), road.getNbHV("n"),
Road.speed[road.category], Road.speed[road.category], Road.speed[road.category],
Math.min(90, Road.speed[road.category]), Math.min(90, Road.speed[road.category]), Math.min(90, Road.speed[road.category]),
'NL08'])
}
sql.execute("CREATE SPATIAL INDEX IF NOT EXISTS ROADS_GEOM_INDEX ON " + "ROADS" + "(THE_GEOM)")
}
if (!ignoreGround) {
sql.execute("DROP TABLE IF EXISTS GROUND")
sql.execute("CREATE TABLE GROUND (PK serial PRIMARY KEY, ID_WAY int, THE_GEOM geometry, PRIORITY int, G double);")
for (Ground ground : handler.grounds) {
if (ground.priority == 0) {
continue
}
if (ground.geom.isEmpty()) {
continue
}
sql.execute("INSERT INTO GROUND (ID_WAY, THE_GEOM, PRIORITY, G) VALUES (" + ground.id + ", ST_Transform(ST_GeomFromText('" + ground.geom + "', 4326), " + srid + "), " + ground.priority + ", " + ground.coeff_G + ")")
}
sql.execute("CREATE SPATIAL INDEX IF NOT EXISTS GROUND_GEOM_INDEX ON " + "GROUND" + "(THE_GEOM)")
}
logger.info('SQL INSERT done')
resultString = "nodes : " + handler.nb_nodes
resultString += "<br>\n"
resultString += "ways : " + handler.nb_ways
resultString += "<br>\n"
resultString += "relations : " + handler.nb_relations
resultString += "<br>\n"
resultString += "buildings : " + handler.nb_buildings
resultString += "<br>\n"
resultString += "roads : " + handler.nb_roads
resultString += "<br>\n"
resultString += "grounds : " + handler.nb_grounds
resultString += "<br>\n"
logger.info('End : Get Buildings from OSM')
logger.info('Result : ' + resultString)
return resultString
}
public class OsmHandler implements Sink {
public int nb_ways = 0;
public int nb_nodes = 0;
public int nb_relations = 0;
public int nb_buildings = 0;
public int nb_roads = 0;
public int nb_grounds = 0;
Random rand = new Random();
public Map<Long, Node> nodes = new HashMap<Long, Node>();
public Map<Long, Way> ways = new HashMap<Long, Way>();
public Map<Long, Relation> relations = new HashMap<Long, Relation>();
public List<Building> buildings = new ArrayList<Building>();
public List<Road> roads = new ArrayList<Road>();
public List<Ground> grounds = new ArrayList<Ground>();
Logger logger
boolean ignoreBuildings
boolean ignoreRoads
boolean ignoreGround
boolean removeTunnels
OsmHandler(Logger logger, boolean ignoreBuildings, boolean ignoreRoads, boolean ignoreGround, boolean removeTunnels) {
this.logger = logger
this.ignoreBuildings = ignoreBuildings
this.ignoreRoads = ignoreRoads
this.ignoreGround = ignoreGround
this.removeTunnels = removeTunnels
}
@Override
public void initialize(Map<String, Object> arg0) {
}
@Override
public void process(EntityContainer entityContainer) {
if (entityContainer instanceof NodeContainer) {
nb_nodes++;
Node node = ((NodeContainer) entityContainer).getEntity();
nodes.put(node.getId(), node);
} else if (entityContainer instanceof WayContainer) {
// This is a copy of the GeoClimate file : buildingsParams.json (https://github.com/orbisgis/geoclimate/tree/master/osm/src/main/resources/org/orbisgis/geoclimate/osm)
String buildingParams = """{
"tags": {
"building": [],
"railway": [
"station",
"train_station"
]
},
"columns": [
"height",
"roof:height",
"building:levels",
"roof:levels",
"building",
"amenity",
"layer",
"aeroway",
"historic",
"leisure",
"monument",
"place_of_worship",
"military",
"railway",
"public_transport",
"barrier",
"government",
"historic:building",
"grandstand",
"house",
"shop",
"industrial",
"man_made",
"residential",
"apartments",
"ruins",
"agricultural",
"barn",
"healthcare",
"education",
"restaurant",
"sustenance",
"office",
"tourism",
"roof:shape"
],
"level": {
"building": 1,
"house": 1,
"detached": 1,
"residential": 1,
"apartments": 1,
"bungalow": 0,
"historic": 0,
"monument": 0,
"ruins": 0,
"castle": 0,
"agricultural": 0,
"farm": 0,
"farm_auxiliary": 0,
"barn": 0,
"greenhouse": 0,
"silo": 0,
"commercial": 2,
"industrial": 0,
"sport": 0,
"sports_centre": 0,
"grandstand": 0,
"transportation": 0,
"train_station": 0,
"toll_booth": 0,
"toll": 0,
"terminal": 0,
"healthcare": 1,
"education": 1,
"entertainment_arts_culture": 0,
"sustenance": 1,
"military": 0,
"religious": 0,
"chapel": 0,
"church": 0,
"government": 1,
"townhall": 1,
"office": 1,
"heavy_industry": 0,
"light_industry": 0,
"emergency": 0,
"hotel": 2,
"hospital": 2,
"parking": 1
},
"type": {
"terminal:transportation": {
"aeroway": [
"terminal",
"airport_terminal"
],
"amenity": [
"terminal",
"airport_terminal"
],
"building": [
"terminal",
"airport_terminal"
]
},
"parking:transportation": {
"building": [
"parking"
]
},
"monument": {
"building": [
"monument"
],
"historic": [
"monument"
],
"leisure": [
"monument"
],
"monument": [
"yes"
]
},
"chapel:religious": {
"building": [
"chapel"
],
"amenity": [
"chapel"
],
"place_of_worship": [
"chapel"
]
},
"church:religious": {
"building": [
"church"
],
"amenity": [
"church"
],
"place_of_worship": [
"church"
]
},
"castle:heritage": {
"building": [
"castle",
"fortress"
]
},
"religious": {
"building": [
"religious",
"abbey",
"cathedral",
"mosque",
"musalla",
"temple",
"synagogue",
"shrine",
"place_of_worship",
"wayside_shrine"
],
"amenity": [
"religious",
"abbey",
"cathedral",
"chapel",
"church",
"mosque",
"musalla",
"temple",
"synagogue",
"shrine",
"place_of_worship",
"wayside_shrine"
],
"place_of_worship": [
"! no",
"! chapel",
"! church"
]
},
"sport:entertainment_arts_culture": {
"building": [
"swimming_pool",
"fitness_centre",
"horse_riding",
"ice_rink",
"pitch",
"stadium",
"track"
],
"leisure": [
"swimming_pool",
"fitness_centre",
"horse_riding",
"ice_rink",
"pitch",
"stadium",
"track"
],
"amenity": [
"swimming_pool",
"fitness_centre",
"horse_riding",
"ice_rink",
"pitch",
"stadium",
"track"
]
},
"sports_centre:entertainment_arts_culture": {
"building": [
"sports_centre",
"sports_hall"
],
"leisure": [
"sports_centre",
"sports_hall"
],
"amenity": [
"sports_centre",
"sports_hall"
]
},
"military": {
"military": [
"ammunition",
"bunker",
"barracks",
"casemate",
"office",
"shelter"
],
"building": [
"ammunition",
"bunker",
"barracks",
"casemate",
"military",
"shelter"
],
"office": [
"military"
]
},
"train_station:transportation": {
"building": [
"train_station"
],
"railway": [
"station",
"train_station"
],
"public_transport": [
"train_station"
],
"amenity": [
"train_station"
]
},
"townhall:government": {
"amenity": [
"townhall"
],
"building": [
"townhall"
]
},
"toll:transportation": {
"barrier": [
"toll_booth"
],
"building": [
"toll_booth"
]
},
"government": {
"building": [
"government",
"government_office"
],
"government": [
"! no"
],
"office": [
"government"
]
},
"historic": {
"building": [
"historic"
],
"historic": [
],
"historic_building": [
"! no"
]
},
"grandstand:entertainment_arts_culture": {
"building": [
"grandstand"
],
"leisure": [
"grandstand"
],
"amenity": [
"grandstand"
],
"grandstand": [
"yes"
]
},
"detached:residential": {
"building": [
"detached"
],
"house": [
"detached"
]
},
"farm_auxiliary:agricultural": {
"building": [
"farm_auxiliary",
"barn",
"stable",
"sty",
"cowshed",
"digester",
"greenhouse"
]
},
"commercial": {
"building": [
"bank",
"bureau_de_change",
"boat_rental",
"car_rental",
"commercial",
"internet_cafe",
"kiosk",
"money_transfer",
"market",
"market_place",
"pharmacy",
"post_office",
"retail",
"shop",
"store",
"supermarket",
"warehouse"
],
"amenity": [
"bank",
"bureau_de_change",
"boat_rental",
"car_rental",
"commercial",
"internet_cafe",
"kiosk",
"money_transfer",
"market",
"market_place",
"pharmacy",
"post_office",
"retail",
"shop",
"store",
"supermarket",
"warehouse"
],
"shop": [
"!= no"
]
},
"light_industry:industrial": {
"building": [
"industrial",
"factory",
"warehouse"
],
"industrial": [
"factory"
],
"amenity": [
"factory"
]
},
"heavy_industry:industrial": {
"building": [
"digester"
],
"industrial": [
"gas",
"heating_station",
"oil_mill",
"oil",
"wellsite",
"well_cluster"
]
},
"greenhouse:agricultural": {
"building": [
"greenhouse"
],
"amenity": [
"greenhouse"
],
"industrial": [
"greenhouse"
]
},
"silo:agricultural": {
"building": [
"silo",
"grain_silo"
],
"man_made": [
"silo",
"grain_silo"
]
},
"house:residential": {
"building": [
"house"
],
"house": [
"! no",
"! detached",
"! residential",
"! villa",
"residential"
],
"amenity": [
"house"
]
},
"apartments:residential": {
"building": [
"apartments"
],
"residential": [
"apartments"
],
"amenity": [
"apartments"
],
"apartments": [
"yes"
]
},
"bungalow:residential": {
"building": [
"bungalow"
],
"house": [
"bungalow"
],
"amenity": [
"bungalow"
]
},
"residential": {
"building": [
"residential",
"villa",
"dormitory",
"condominium",
"sheltered_housing",
"workers_dormitory",
"terrace"
],
"residential": [
"university",
"detached",
"dormitory",
"condominium",
"sheltered_housing",
"workers_dormitory",
"building"
],
"house": [
"residential"
],
"amenity": [
"residential"
]
},
"ruins:heritage": {
"building": [
"ruins"
],
"ruins": [
"ruins"
]
},
"agricultural": {
"building": [
"agricultural"
],
"agricultural": [
"building"
]
},
"farm:agricultural": {
"building": [
"farm",
"farmhouse"
]
},
"barn:agricultural": {
"building": [
"barn"
],
"barn": [
"! no"
]
},
"transportation": {
"building": [
"train_station",
"transportation",
"station"
],
"aeroway": [
"hangar",
"tower",
"bunker",
"control_tower",
"building"
],
"railway": [
"station",
"train_station",
"building"
],
"public_transport": [
"train_station",
"station"
],
"amenity": [
"train_station",
"terminal"
]
},
"healthcare": {
"amenity": [
"healthcare",
"social_facility"
],
"building": [
"healthcare",
"hospital"
],
"healthcare": [
"! no"
]
},
"education": {
"amenity": [
"education",
"college",
"kindergarten",
"school",
"university",
"research_institute"
],
"building": [
"education",
"college",
"kindergarten",
"school",
"university"
],
"education": [
"college",
"kindergarten",
"school",
"university"
]
},
"entertainment_arts_culture": {
"leisure": [
"! no"
]
},
"sustenance:commercial": {
"amenity": [
"restaurant",
"bar",
"cafe",
"fast_food",
"ice_cream",
"pub"
],
"building": [
"restaurant",
"bar",
"cafe",
"fast_food",
"ice_cream",
"pub"
],
"restaurant": [
"! no"
],
"shop": [
"restaurant",
"bar",
"cafe",
"fast_food",
"ice_cream",
"pub"
],