-
Notifications
You must be signed in to change notification settings - Fork 0
/
transform_03.lua
10509 lines (9480 loc) · 488 KB
/
transform_03.lua
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
-- ----------------------------------------------------------------------------
-- transform_03.lua
--
-- Copyright (C) 2018-2024 Andy Townsend
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- Apply "name" transformations to ways for "map style 03"
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- "all" function
-- ----------------------------------------------------------------------------
function process_all( objtype, object )
-- ----------------------------------------------------------------------------
-- Some changes based on style.lua
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- Treat "was:" as "disused:"
-- ----------------------------------------------------------------------------
if (( object.tags["was:amenity"] ~= nil ) and
( object.tags["disused:amenity"] == nil )) then
object.tags["disused:amenity"] = object.tags["was:amenity"]
end
if (( object.tags["was:waterway"] ~= nil ) and
( object.tags["disused:waterway"] == nil )) then
object.tags["disused:waterway"] = object.tags["was:waterway"]
end
if (( object.tags["was:railway"] ~= nil ) and
( object.tags["disused:railway"] == nil )) then
object.tags["disused:railway"] = object.tags["was:railway"]
end
if (( object.tags["was:aeroway"] ~= nil ) and
( object.tags["disused:aeroway"] == nil )) then
object.tags["disused:aeroway"] = object.tags["was:aeroway"]
end
if (( object.tags["was:landuse"] ~= nil ) and
( object.tags["disused:landuse"] == nil )) then
object.tags["disused:landuse"] = object.tags["was:landuse"]
end
if (( object.tags["was:shop"] ~= nil ) and
( object.tags["disused:shop"] == nil )) then
object.tags["disused:shop"] = object.tags["was:shop"]
end
-- ----------------------------------------------------------------------------
-- Treat "closed:" as "disused:"
-- ----------------------------------------------------------------------------
if (( object.tags["closed:amenity"] ~= nil ) and
( object.tags["disused:amenity"] == nil )) then
object.tags["disused:amenity"] = object.tags["closed:amenity"]
end
if (( object.tags["closed:shop"] ~= nil ) and
( object.tags["disused:shop"] == nil )) then
object.tags["disused:shop"] = object.tags["closed:shop"]
end
-- ----------------------------------------------------------------------------
-- Treat "status=abandoned" as "disused=yes"
-- ----------------------------------------------------------------------------
if ( object.tags["status"] == "abandoned" ) then
object.tags["disused"] = "yes"
end
-- ----------------------------------------------------------------------------
-- If we have an est_width but no width, use the est_width
-- ----------------------------------------------------------------------------
if (( object.tags["width"] == nil ) and
( object.tags["est_width"] ~= nil )) then
object.tags["width"] = object.tags["est_width"]
end
-- ----------------------------------------------------------------------------
-- If name does not exist but name:en does, use it.
-- ----------------------------------------------------------------------------
if (( object.tags["name"] == nil ) and
( object.tags["name:en"] ~= nil )) then
object.tags["name"] = object.tags["name:en"]
end
-- ----------------------------------------------------------------------------
-- Move refs to consider as "official" to official_ref
-- ----------------------------------------------------------------------------
if (( object.tags["official_ref"] == nil ) and
( object.tags["highway_authority_ref"] ~= nil )) then
object.tags["official_ref"] = object.tags["highway_authority_ref"]
object.tags["highway_authority_ref"] = nil
end
if (( object.tags["official_ref"] == nil ) and
( object.tags["highway_ref"] ~= nil )) then
object.tags["official_ref"] = object.tags["highway_ref"]
object.tags["highway_ref"] = nil
end
if (( object.tags["official_ref"] == nil ) and
( object.tags["admin_ref"] ~= nil )) then
object.tags["official_ref"] = object.tags["admin_ref"]
object.tags["admin_ref"] = nil
end
if (( object.tags["official_ref"] == nil ) and
( object.tags["admin:ref"] ~= nil )) then
object.tags["official_ref"] = object.tags["admin:ref"]
object.tags["admin:ref"] = nil
end
if (( object.tags["official_ref"] == nil ) and
( object.tags["loc_ref"] ~= nil ) and
( object.tags["loc_ref"] ~= object.tags["ref"] )) then
object.tags["official_ref"] = object.tags["loc_ref"]
object.tags["loc_ref"] = nil
end
-- ----------------------------------------------------------------------------
-- If "disused=yes" is set on highways, remove the highway tag.
-- ----------------------------------------------------------------------------
if (( object.tags["highway"] ~= nil ) and
( object.tags["disused"] == "yes" )) then
object.tags["highway"] = nil
end
-- ----------------------------------------------------------------------------
-- "highway=proposed" and "highway=construction" - append any proposed or
-- construction value
-- ----------------------------------------------------------------------------
if (( object.tags["highway"] == "proposed" ) or
( object.tags["highway"] == "construction" )) then
if ( object.tags["proposed"] ~= nil ) then
object = append_nonqa( object, object.tags["proposed"] )
end
if ( object.tags["construction"] ~= nil ) then
object = append_nonqa( object, object.tags["construction"] )
end
end
-- ----------------------------------------------------------------------------
-- Cater for unusual link values on the off chance
-- ----------------------------------------------------------------------------
if ( object.tags["highway"] == "living_street_link" ) then
object.tags["highway"] = "living_street"
end
if ( object.tags["highway"] == "service_link" ) then
object.tags["highway"] = "service"
end
-- ----------------------------------------------------------------------------
-- By default, trunk roads are mapped to roads you can't walk along, as if
-- it was in Germany.
-- If there's a sidewalk, obviously you can, so map to primary.
-- ----------------------------------------------------------------------------
if ((( object.tags["highway"] == "trunk" ) or
( object.tags["highway"] == "trunk_link" )) and
((( object.tags["sidewalk"] ~= nil ) and
( object.tags["sidewalk"] ~= "no" ) and
( object.tags["sidewalk"] ~= "none" )) or
(( object.tags["sidewalk:left"] ~= nil ) and
( object.tags["sidewalk:left"] ~= "no" ) and
( object.tags["sidewalk:left"] ~= "none" )) or
(( object.tags["sidewalk:right"] ~= nil ) and
( object.tags["sidewalk:right"] ~= "no" ) and
( object.tags["sidewalk:right"] ~= "none" )) or
(( object.tags["sidewalk:both"] ~= nil ) and
( object.tags["sidewalk:both"] ~= "no" ) and
( object.tags["sidewalk:both"] ~= "none" )) or
(( object.tags["sidewalk:separate"] ~= nil ) and
( object.tags["sidewalk:separate"] ~= "no" ) and
( object.tags["sidewalk:separate"] ~= "none" )))) then
object.tags["highway"] = "primary"
end
-- ----------------------------------------------------------------------------
-- Move unsigned road refs to the name, in brackets.
-- ----------------------------------------------------------------------------
if (( object.tags["highway"] == "motorway" ) or
( object.tags["highway"] == "motorway_link" ) or
( object.tags["highway"] == "trunk" ) or
( object.tags["highway"] == "trunk_link" ) or
( object.tags["highway"] == "primary" ) or
( object.tags["highway"] == "primary_link" ) or
( object.tags["highway"] == "secondary" ) or
( object.tags["highway"] == "secondary_link" ) or
( object.tags["highway"] == "tertiary" ) or
( object.tags["highway"] == "tertiary_link" ) or
( object.tags["highway"] == "unclassified" ) or
( object.tags["highway"] == "unclassified_link" ) or
( object.tags["highway"] == "residential" ) or
( object.tags["highway"] == "residential_link" ) or
( object.tags["highway"] == "service" ) or
( object.tags["highway"] == "road" ) or
( object.tags["highway"] == "track" ) or
( object.tags["highway"] == "cycleway" ) or
( object.tags["highway"] == "bridleway" ) or
( object.tags["highway"] == "footway" ) or
( object.tags["highway"] == "path" )) then
if ( object.tags["name"] == nil ) then
if (( object.tags["ref"] ~= nil ) and
( object.tags["ref:signed"] == "no" )) then
object.tags["name"] = "(" .. object.tags["ref"] .. ")"
object.tags["ref"] = nil
object.tags["ref:signed"] = nil
else
if ( object.tags["official_ref"] ~= nil ) then
object.tags["name"] = "(" .. object.tags["official_ref"] .. ")"
object.tags["official_ref"] = nil
end
end
else
if (( object.tags["name:signed"] == "no" ) or
( object.tags["unsigned"] == "yes" )) then
object.tags["name"] = "(" .. object.tags["name"]
object.tags["name:signed"] = nil
if ( object.tags["ref:signed"] == "no" ) then
if ( object.tags["ref"] ~= nil ) then
object.tags["name"] = object.tags["name"] .. ", " .. object.tags["ref"]
end
object.tags["ref"] = nil
object.tags["ref:signed"] = nil
else
if ( object.tags["official_ref"] ~= nil ) then
object.tags["name"] = object.tags["name"] .. ", " .. object.tags["official_ref"]
object.tags["official_ref"] = nil
end
end
object.tags["name"] = object.tags["name"] .. ")"
else
if (( object.tags["ref"] ~= nil ) and
( object.tags["ref:signed"] == "no" )) then
object.tags["name"] = object.tags["name"] .. " (" .. object.tags["ref"] .. ")"
object.tags["ref"] = nil
object.tags["ref:signed"] = nil
else
if ( object.tags["official_ref"] ~= nil ) then
object.tags["name"] = object.tags["name"] .. " (" .. object.tags["official_ref"] .. ")"
object.tags["official_ref"] = nil
end
end
end
end
end
-- ----------------------------------------------------------------------------
-- Add "area=yes" if "place=square" - we can't rely on a list of polygon tags
-- to do that for us.
-- ----------------------------------------------------------------------------
if (( object.tags["place"] == "square" ) and
( object.tags["highway"] ~= nil )) then
object.tags["area"] = "yes"
end
-- ----------------------------------------------------------------------------
-- natural=tree
-- in "points" as "0x6600"
-- 0x6600 is searchable via "Geographic Points / Land Features"
-- ----------------------------------------------------------------------------
if ( object.tags["natural"] == "tree" ) then
object = append_nonqa( object, object.tags["natural"] )
end
-- ----------------------------------------------------------------------------
-- landuse=forest
-- natural=wood
-- (and a few outlier tags for the same thing)
-- Both are in "points" as "0x6618" and in polygons as "0x50"
-- On landuse=forest, append main tag and operator (if set)
-- On natural=wood, append B, C, M or just "()", based on leaf_type.
-- "0x6618" is searchable via "Geographic Points / Manmade Places"
-- A mid-green colour is used in QMapShack.
-- A "woodland" land cover appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if ( object.tags["natural"] == "forest" ) then
object.tags["landuse"] = "forest"
object.tags["natural"] = nil
end
if ( object.tags["boundary"] == "forest" ) then
object.tags["landuse"] = "forest"
object.tags["boundary"] = nil
end
if (( object.tags["landuse"] == "forest" ) or
( object.tags["landuse"] == "forestry" )) then
object = append_nonqa( object, object.tags["landuse"] )
if ( object.tags["operator"] ~= nil ) then
object = append_nonqa( object, object.tags["operator"] )
end
end
if ( object.tags["natural"] == "wood" ) then
leaf_type_appendix = ""
if ( object.tags["leaf_type"] == "broadleaved" ) then
leaf_type_appendix = "B"
end
if ( object.tags["leaf_type"] == "needleleaved" ) then
leaf_type_appendix = "C"
end
if ( object.tags["leaf_type"] == "mixed" ) then
leaf_type_appendix = "M"
end
if ( leaf_type_appendix ~= nil ) then
object = append_nonqa( object, leaf_type_appendix )
end
end
-- ----------------------------------------------------------------------------
-- Remove "real_ale" tag on industrial and craft breweries that aren't also
-- a pub, bar, restaurant, cafe etc. or hotel.
-- ----------------------------------------------------------------------------
if ((( object.tags["industrial"] == "brewery" ) or
( object.tags["craft"] == "brewery" )) and
( object.tags["real_ale"] ~= nil ) and
( object.tags["real_ale"] ~= "maybe" ) and
( object.tags["real_ale"] ~= "no" ) and
( object.tags["amenity"] == nil ) and
( object.tags["tourism"] ~= "hotel" )) then
object.tags["real_ale"] = nil
object.tags["real_cider"] = nil
end
-- ----------------------------------------------------------------------------
-- Remove "shop" tag on industrial or craft breweries.
-- We pick one thing to display them as, and in this case it's "brewery"...
-- ----------------------------------------------------------------------------
if ((( object.tags["industrial"] == "brewery" ) or
( object.tags["craft"] == "brewery" ) or
( object.tags["craft"] == "cider" )) and
( object.tags["shop"] ~= nil )) then
object.tags["shop"] = nil
end
-- ----------------------------------------------------------------------------
-- Mistaggings for wastewater_plant
-- "(sewage)" is appended below.
-- ----------------------------------------------------------------------------
if (( object.tags["man_made"] == "sewage_works" ) or
( object.tags["man_made"] == "wastewater_works" )) then
object.tags["man_made"] = "wastewater_plant"
end
-- ----------------------------------------------------------------------------
-- Electricity substations
-- ----------------------------------------------------------------------------
if (( object.tags["power"] == "substation" ) or
( object.tags["power"] == "sub_station" )) then
object.tags["power"] = nil
if (( object.tags["building"] == nil ) or
( object.tags["building"] == "no" )) then
object.tags["landuse"] = "industrial"
else
object.tags["building"] = "yes"
end
object = append_nonqa( object, "el.sub" )
end
-- ----------------------------------------------------------------------------
-- Append (sewage) to sewage works.
-- ----------------------------------------------------------------------------
if ( object.tags["man_made"] == "wastewater_plant" ) then
object.tags["man_made"] = nil
object.tags["landuse"] = "industrial"
object = append_nonqa( object, "sewage" )
end
-- ----------------------------------------------------------------------------
-- Bus depots
-- "0x6405 Civil" is in points as "amenity=bus_depot"
-- and is searchable via "Geographic Points / Manmade Places"
-- ----------------------------------------------------------------------------
if ( object.tags["amenity"] == "bus_depot" ) then
object = append_nonqa( object, "amenity" )
object = append_nonqa( object, object.tags["amenity"] )
object.tags["landuse"] = nil
object = building_or_landuse( objtype, object )
end
if (( object.tags["landuse"] == "industrial" ) and
( object.tags["industrial"] == "bus_depot" )) then
object = append_nonqa( object, object.tags["landuse"] )
object = append_nonqa( object, object.tags["industrial"] )
object.tags["landuse"] = nil
object.tags["amenity"] = "bus_depot"
object = building_or_landuse( objtype, object )
end
-- ----------------------------------------------------------------------------
-- Other depots and fuel depots etc.
-- "0x6405 Civil" is in points as "amenity=depot"
-- and is searchable via "Geographic Points / Manmade Places"
-- ----------------------------------------------------------------------------
if (( object.tags["amenity"] == "depot" ) or
( object.tags["amenity"] == "fuel_depot" ) or
( object.tags["amenity"] == "scrapyard" )) then
object = append_nonqa( object, "amenity" )
object = append_nonqa( object, object.tags["amenity"] )
object.tags["amenity"] = "depot"
object.tags["landuse"] = nil
object = building_or_landuse( objtype, object )
end
if (( object.tags["landuse"] == "industrial" ) and
(( object.tags["industrial"] == "depot" ) or
( object.tags["industrial"] == "fuel_depot" ))) then
object = append_nonqa( object, object.tags["landuse"] )
object = append_nonqa( object, object.tags["industrial"] )
object.tags["landuse"] = nil
object.tags["amenity"] = "depot"
object = building_or_landuse( objtype, object )
end
if ( object.tags["landuse"] == "depot" ) then
object = append_nonqa( object, "landuse" )
object = append_nonqa( object, object.tags["landuse"] )
object.tags["landuse"] = nil
object.tags["amenity"] = "depot"
object = building_or_landuse( objtype, object )
end
-- ----------------------------------------------------------------------------
-- Various industrial landuse
-- Add a suffix for any existing landuse=industrial, and also for some other
-- tags that map through.
-- This tag is also used by the building_or_landuse function (no suffix there
-- obviously as it's not representing industrial landuse there)
--
-- Also append suffix for landuse=brownfield and landuse=construction
-- 0x0c is used in polygons for these
-- ----------------------------------------------------------------------------
if ((( object.tags["landuse"] == "industrial" ) and
( object.tags["industrial"] ~= "bus_depot" ) and
( object.tags["industrial"] ~= "depot" )) or
( object.tags["landuse"] == "brownfield" ) or
( object.tags["landuse"] == "construction" )) then
object = append_nonqa( object, object.tags["landuse"] )
object.tags["landuse"] = "industrial"
end
if (( object.tags["craft"] == "bakery" ) or
( object.tags["craft"] == "distillery" ) or
( object.tags["craft"] == "sawmill" )) then
object = append_nonqa( object, object.tags["craft"] )
object.tags["craft"] = nil
object.tags["landuse"] = "industrial"
end
if (( object.tags["industrial"] == "auto_wrecker" ) or
( object.tags["industrial"] == "automotive_industry" ) or
( object.tags["industrial"] == "bakery" ) or
( object.tags["industrial"] == "checkpoint" ) or
( object.tags["industrial"] == "chemical" ) or
( object.tags["industrial"] == "concrete_plant" ) or
( object.tags["industrial"] == "construction" ) or
( object.tags["industrial"] == "distillery" ) or
( object.tags["industrial"] == "distributor" ) or
( object.tags["industrial"] == "electrical" ) or
( object.tags["industrial"] == "engineering" ) or
( object.tags["industrial"] == "factory" ) or
( object.tags["industrial"] == "fish_farm" ) or
( object.tags["industrial"] == "furniture" ) or
( object.tags["industrial"] == "gas" ) or
( object.tags["industrial"] == "haulage" ) or
( object.tags["industrial"] == "machine_shop" ) or
( object.tags["industrial"] == "machinery" ) or
( object.tags["industrial"] == "metal_finishing" ) or
( object.tags["industrial"] == "mobile_equipment" ) or
( object.tags["industrial"] == "oil" ) or
( object.tags["industrial"] == "packaging" ) or
( object.tags["industrial"] == "sawmill" ) or
( object.tags["industrial"] == "scaffolding" ) or
( object.tags["industrial"] == "scrap_yard" ) or
( object.tags["industrial"] == "shop_fitters" ) or
( object.tags["industrial"] == "waste_handling" ) or
( object.tags["industrial"] == "warehouse" ) or
( object.tags["industrial"] == "woodworking" ) or
( object.tags["industrial"] == "yard" ) or
( object.tags["industrial"] == "yes" )) then
object = append_nonqa( object, object.tags["industrial"] )
end
if (( object.tags["man_made"] == "gas_station" ) or
( object.tags["man_made"] == "gas_works" ) or
( object.tags["man_made"] == "water_treatment" )) then
object = append_nonqa( object, object.tags["man_made"] )
object.tags["man_made"] = nil
object.tags["landuse"] = "industrial"
end
if ( object.tags["power"] == "plant" ) then
object = append_nonqa( object, object.tags["power"] )
object.tags["power"] = nil
object.tags["landuse"] = "industrial"
end
if ( object.tags["parking"] == "depot" ) then
object = append_nonqa( object, object.tags["parking"] )
object.tags["landuse"] = "industrial"
object.tags["parking"] = nil
end
-- ----------------------------------------------------------------------------
-- Add suffix for landfill
-- 0x0c is used in polygons
-- ----------------------------------------------------------------------------
if ( object.tags["landuse"] == "landfill" ) then
object = append_nonqa( object, object.tags["landuse"] )
end
-- ----------------------------------------------------------------------------
-- Handle spoil heaps as landfill
-- ----------------------------------------------------------------------------
if ( object.tags["man_made"] == "spoil_heap" ) then
object = append_nonqa( object, object.tags["man_made"] )
object.tags["landuse"] = "landfill"
object.tags["man_made"] = nil
end
-- ----------------------------------------------------------------------------
-- Handle place=quarter
-- ----------------------------------------------------------------------------
if ( object.tags["place"] == "quarter" ) then
object.tags["place"] = "neighbourhood"
end
-- ----------------------------------------------------------------------------
-- Handle natural=cape
-- ----------------------------------------------------------------------------
if ( object.tags["natural"] == "cape" ) then
object.tags["place"] = "locality"
end
-- ----------------------------------------------------------------------------
-- man_made=marker etc.
-- For historic markers see "Historic markers" below.
-- In "points" as "0x4c00"
-- "0x4c00" is searchable via "Geographic Points / Manmade Places"
-- No icon is visible in QMapShack
-- A "tourist information" icon appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if ( object.tags["man_made"] == "marker" ) then
object = append_nonqa( object, "marker" )
end
-- ----------------------------------------------------------------------------
-- amenity=bbq and other small amenities
-- "man_made=thing" is in "points" as "0x2f14"
-- "0x2f14" is searchable via "Others / Social Service"
-- A dot appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if (( object.tags["amenity"] == "hunting_stand" ) and
( object.tags["hunting_stand"] == "grouse_butt" )) then
object.tags["amenity"] = object.tags["hunting_stand"]
end
if ( object.tags["man_made"] == "grouse_butt" ) then
object.tags["amenity"] = object.tags["man_made"]
object.tags["man_made"] = nil
end
if (( object.tags["amenity"] == "bbq" ) or
( object.tags["amenity"] == "compressed_air" ) or
( object.tags["amenity"] == "grit_bin" ) or
( object.tags["amenity"] == "grouse_butt" ) or
( object.tags["amenity"] == "hunting_stand" ) or
(( object.tags["amenity"] == "waste_basket" ) and
( object.tags["highway"] == nil )) or
( object.tags["amenity"] == "watering_place" )) then
object = append_nonqa( object, object.tags["amenity"] )
object.tags["man_made"] = "thing"
object.tags["amenity"] = nil
end
-- ----------------------------------------------------------------------------
-- Non-utility posts
-- (for utility posts see below)
-- ----------------------------------------------------------------------------
if (( object.tags["marker"] == "post" ) and
(( object.tags["utility"] == nil ) or
( object.tags["utility"] == "yes" ))) then
object = append_nonqa( object, "post" )
object.tags["man_made"] = "marker"
end
-- ----------------------------------------------------------------------------
-- Handle various sorts of milestones.
-- man_made=marker
-- In "points" as "0x4c00"
-- "0x4c00" is searchable via "Geographic Points / Manmade Places"
-- A "tourist information" icon appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if (( object.tags["historic"] == "milestone" ) or
( object.tags["historic"] == "milepost" ) or
( object.tags["highway"] == "milestone" ) or
( object.tags["railway"] == "milestone" ) or
( object.tags["waterway"] == "milestone" )) then
object = append_nonqa( object, "milestone" )
object.tags["man_made"] = "marker"
end
-- ----------------------------------------------------------------------------
-- Aerial markers for pipelines etc. and other utilities
-- Non-utility marker posts are handled above
-- Non-utility "marker=yes", "marker=pedestal", "marker=plate" and
-- "marker=pole" are ignored.
-- In "points" as "0x4c00"
-- "0x4c00" is searchable via "Geographic Points / Manmade Places"
-- No icon is visible in QMapShack
-- A "tourist information" icon appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if (( object.tags["marker"] == "aerial" ) or
( object.tags["marker"] == "pipeline" ) or
( object.tags["man_made"] == "marker" ) or
( object.tags["man_made"] == "pipeline_marker" ) or
( object.tags["pipeline"] == "marker" ) or
((( object.tags["marker"] == "post" ) or
( object.tags["marker"] == "yes" ) or
( object.tags["marker"] == "pedestal" ) or
( object.tags["marker"] == "plate" ) or
( object.tags["marker"] == "pole" )) and
( object.tags["utility"] ~= nil ) and
( object.tags["utility"] ~= "yes" ))) then
object = append_nonqa( object, "utility/pipeline marker" )
if ( object.tags["utility"] ~= nil ) then
append_nonqa( object, object.tags["utility"] )
end
if ( object.tags["ref"] ~= nil ) then
append_nonqa( object, object.tags["ref"] )
end
object.tags["man_made"] = "marker"
end
-- ----------------------------------------------------------------------------
-- Boundary stones. If they're already tagged as tourism=attraction, remove
-- that tag.
-- Note that "marker=stone" (for "non boundary stones") are handled elsewhere.
-- ----------------------------------------------------------------------------
if (( object.tags["historic"] == "boundary_stone" ) or
( object.tags["historic"] == "boundary_marker" ) or
( object.tags["man_made"] == "boundary_marker" ) or
( object.tags["man_made"] == "boundary_stone" ) or
( object.tags["marker"] == "boundary_stone" ) or
( object.tags["boundary"] == "marker" ) or
( object.tags["designation"] == "March Stone" )) then
object.tags["man_made"] = "marker"
object.tags["tourism"] = nil
if ( object.tags["inscription"] ~= nil ) then
object = append_nonqa( object, object.tags["inscription"] )
end
object = append_nonqa( object, "boundary stone" )
end
-- ----------------------------------------------------------------------------
-- Stones that are not boundary stones.
-- Note that "marker=boundary_stone" are handled elsewhere.
-- ----------------------------------------------------------------------------
if (( object.tags["marker"] == "stone" ) or
( object.tags["natural"] == "stone" ) or
( object.tags["man_made"] == "stone" ) or
( object.tags["man_made"] == "standing_stone" )) then
object.tags["man_made"] = "marker"
if ( object.tags["inscription"] ~= nil ) then
object = append_nonqa( object, object.tags["inscription"] )
end
object = append_nonqa( object, "historic stone" )
end
if (( object.tags["historic"] == "bullaun_stone" ) or
( object.tags["historic"] == "stone" )) then
object = append_nonqa( object, "historic" )
object = append_nonqa( object, object.tags["historic"] )
object.tags["man_made"] = "marker"
if ( object.tags["inscription"] ~= nil ) then
object = append_nonqa( object, object.tags["inscription"] )
end
end
-- ----------------------------------------------------------------------------
-- Some tumuli are tagged as tombs, so dig those out first.
-- ----------------------------------------------------------------------------
if (( object.tags["historic"] == "tomb" ) and
( object.tags["tomb"] == "tumulus" )) then
object.tags["historic"] = "archaeological_site"
object.tags["archaeological_site"] = "tumulus"
end
if (( object.tags["historic"] == "standing_stone" ) or
(( object.tags["historic"] == "archaeological_site" ) and
(( object.tags["archaeological_site"] == "standing_stone" ) or
( object.tags["archaeological_site"] == "megalith" ) or
( object.tags["site_type"] == "standing_stone" ) or
( object.tags["site_type"] == "megalith" )))) then
object.tags["man_made"] = "marker"
if ( object.tags["inscription"] ~= nil ) then
object = append_nonqa( object, object.tags["inscription"] )
end
object = append_nonqa( object, "standing stone" )
object.tags["tourism"] = nil
end
if ( object.tags["historic"] == "rune_stone" ) then
object.tags["man_made"] = "marker"
if ( object.tags["inscription"] ~= nil ) then
object = append_nonqa( object, object.tags["inscription"] )
end
object = append_nonqa( object, "standing stone" )
end
if ( object.tags["place_of_worship"] == "mass_rock" ) then
object.tags["man_made"] = "marker"
object.tags["amenity"] = nil
object = append_nonqa( object, "mass rock" )
end
-- ----------------------------------------------------------------------------
-- Telephone boxes and former telephone boxes
--
-- amenity=telephone
-- In "points" as "0x5100"
-- "0x5100" is searchable via "Geographic Points / Manmade Places",
-- No icon appears in QMapShack
-- A "telephone" icon appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if ((( object.tags["covered"] == "booth" ) and
( object.tags["booth"] ~= "K1" ) and
( object.tags["booth"] ~= "KX100" ) and
( object.tags["booth"] ~= "KX200" ) and
( object.tags["booth"] ~= "KX300" ) and
( object.tags["booth"] ~= "KXPlus" ) and
( object.tags["booth"] ~= "KX410" ) and
( object.tags["booth"] ~= "KX420" ) and
( object.tags["booth"] ~= "KX520" ) and
( object.tags["booth"] ~= "oakham" ) and
( object.tags["booth"] ~= "ST6" )) or
( object.tags["booth"] == "K2" ) or
( object.tags["booth"] == "K4 Post Office" ) or
( object.tags["booth"] == "K6" ) or
( object.tags["booth"] == "K8" ) or
( object.tags["telephone_kiosk"] == "K6" ) or
( object.tags["man_made"] == "telephone_box" ) or
( object.tags["building"] == "telephone_box" ) or
( object.tags["historic"] == "telephone" ) or
( object.tags["disused:amenity"] == "telephone" ) or
( object.tags["removed:amenity"] == "telephone" )) then
if ((( object.tags["amenity"] == "telephone" ) or
( object.tags["amenity"] == "phone" )) and
( object.tags["emergency"] ~= "defibrillator" ) and
( object.tags["emergency"] ~= "phone" ) and
( object.tags["tourism"] ~= "information" ) and
( object.tags["tourism"] ~= "artwork" ) and
( object.tags["tourism"] ~= "museum" )) then
object = append_nonqa( object, object.tags["amenity"] )
if ( object.tags["colour"] ~= nil ) then
object = append_nonqa( object, object.tags["colour"] )
end
object.tags["amenity"] = "telephone"
object.tags["tourism"] = nil
object.tags["emergency"] = nil
else
if ( object.tags["emergency"] == "defibrillator" ) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone defib" )
else
if (( object.tags["amenity"] == "public_bookcase" ) or
( object.tags["amenity"] == "library" )) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone book exchange" )
else
if ( object.tags["amenity"] == "bicycle_repair_station" ) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone bicycle repair" )
else
if ( object.tags["amenity"] == "atm" ) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone atm" )
else
if ( object.tags["tourism"] == "information" ) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone tourist info" )
else
if ( object.tags["tourism"] == "artwork" ) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone artwork" )
else
if ( object.tags["tourism"] == "museum" ) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone museum" )
else
if (( object.tags["disused:amenity"] == "telephone" ) or
( object.tags["removed:amenity"] == "telephone" ) or
( object.tags["abandoned:amenity"] == "telephone" ) or
( object.tags["demolished:amenity"] == "telephone" ) or
( object.tags["razed:amenity"] == "telephone" ) or
( object.tags["old_amenity"] == "telephone" ) or
( object.tags["historic:amenity"] == "telephone" ) or
( object.tags["disused"] == "telephone" ) or
( object.tags["was:amenity"] == "telephone" ) or
( object.tags["old:amenity"] == "telephone" ) or
( object.tags["amenity"] == "former_telephone" ) or
( object.tags["historic"] == "telephone" )) then
object.tags["amenity"] = "telephone"
object = append_nonqa( object, "fmr phone" )
end
end
end
end
end
end
end
end
end
end
-- ----------------------------------------------------------------------------
-- amenity=courthouse
-- In "points" as "0x3004"
-- "0x3004" is searchable via "Community / Court House"
-- A "public building" icon appears on a GPSMAP64s
-- ----------------------------------------------------------------------------
if ( object.tags["amenity"] == "courthouse" ) then
object = append_nonqa( object, object.tags["amenity"] )
object = building_or_landuse( objtype, object )
end
-- ----------------------------------------------------------------------------
-- Community Centres etc.
-- "0x3005" is searchable via "Community / Community Center"
-- ----------------------------------------------------------------------------
if ((( object.tags["building"] == "community_centre" ) or
( object.tags["building"] == "scout_hut" ) or
( object.tags["building"] == "clubhouse" ) or
( object.tags["building"] == "club_house" ) or
(( object.tags["building"] ~= nil ) and
(( object.tags["name"] == "Scout Hut" ) or
( object.tags["name"] == "Scout hut" ) or
( object.tags["name"] == "Scout Hall" )))) and
(( object.tags["amenity"] == nil ) and
( object.tags["leisure"] == nil ) and
( object.tags["office"] == nil ) and
( object.tags["shop"] == nil ))) then
object.tags["amenity"] = object.tags["building"]
end
if (( object.tags["leisure"] == "social_club" ) or
(( object.tags["leisure"] == "sport" ) and
( object.tags["sport"] ~= "golf" ))) then
object.tags["amenity"] = object.tags["leisure"]
end
if ( object.tags["healthcare"] == "health_centre" ) then
object.tags["amenity"] = object.tags["healthcare"]
end
if (( object.tags["amenity"] == "care_home" ) or
( object.tags["amenity"] == "childcare" ) or
( object.tags["amenity"] == "childrens_centre" ) or
( object.tags["amenity"] == "church_hall" ) or
( object.tags["amenity"] == "club" ) or
( object.tags["amenity"] == "club_house" ) or
( object.tags["amenity"] == "clubhouse" ) or
( object.tags["amenity"] == "community_centre" ) or
( object.tags["amenity"] == "community_hall" ) or
( object.tags["amenity"] == "dancing_school" ) or
( object.tags["amenity"] == "daycare" ) or
( object.tags["amenity"] == "function_room" ) or
( object.tags["amenity"] == "health_centre" ) or
( object.tags["amenity"] == "hospice" ) or
( object.tags["amenity"] == "medical_centre" ) or
( object.tags["amenity"] == "nursery" ) or
( object.tags["amenity"] == "nursery_school" ) or
( object.tags["amenity"] == "nursing_home" ) or
( object.tags["amenity"] == "outdoor_education_centre" ) or
( object.tags["amenity"] == "preschool" ) or
( object.tags["amenity"] == "public_bath" ) or
( object.tags["amenity"] == "residential_home" ) or
( object.tags["amenity"] == "retirement_home" ) or
( object.tags["amenity"] == "scout_hall" ) or
( object.tags["amenity"] == "scout_hut" ) or
( object.tags["amenity"] == "sheltered_housing" ) or
( object.tags["amenity"] == "social_centre" ) or
(( object.tags["amenity"] == "social_facility" ) and
( object.tags["social_facility"] == nil )) or
( object.tags["amenity"] == "social_club" ) or
( object.tags["amenity"] == "sport" ) or
( object.tags["amenity"] == "working_mens_club" ) or
( object.tags["amenity"] == "youth_centre" ) or
( object.tags["amenity"] == "youth_club" )) then
object = append_nonqa( object, object.tags["amenity"] )
if ( object.tags["community_centre"] ~= nil ) then
object = append_nonqa( object, object.tags["community_centre"] )
end
if ( object.tags["community_centre:for"] ~= nil ) then
object = append_nonqa( object, object.tags["community_centre:for"] )
end
if ( object.tags["social_centre"] ~= nil ) then
object = append_nonqa( object, object.tags["social_centre"] )
end
if ( object.tags["social_centre:for"] ~= nil ) then
object = append_nonqa( object, object.tags["social_centre:for"] )
end
if ( object.tags["social_facility"] ~= nil ) then
object = append_nonqa( object, object.tags["social_facility"] )
end
if ( object.tags["social_facility:for"] ~= nil ) then
object = append_nonqa( object, object.tags["social_facility:for"] )
end
if ( object.tags["club"] ~= nil ) then
object = append_nonqa( object, object.tags["club"] )
end
object.tags["amenity"] = "community_centre"
object = building_or_landuse( objtype, object )
end
if (( object.tags["club"] == "scout" ) or
( object.tags["club"] == "scouts" ) or
( object.tags["club"] == "sport" ) or
((( object.tags["club"] == "yes" ) or
( object.tags["club"] == "social" ) or
( object.tags["club"] == "freemasonry" ) or
( object.tags["club"] == "sailing" ) or
( object.tags["club"] == "youth" ) or
( object.tags["club"] == "politics" ) or
( object.tags["club"] == "veterans" ) or
( object.tags["club"] == "social_club" ) or
( object.tags["club"] == "music" ) or
( object.tags["club"] == "working_men" ) or
( object.tags["club"] == "yachting" ) or
( object.tags["club"] == "tennis" ) or
( object.tags["club"] == "army_cadets" ) or
( object.tags["club"] == "sports" ) or
( object.tags["club"] == "rowing" ) or
( object.tags["club"] == "football" ) or
( object.tags["club"] == "snooker" ) or
( object.tags["club"] == "fishing" ) or
( object.tags["club"] == "sea_scout" ) or
( object.tags["club"] == "conservative" ) or
( object.tags["club"] == "golf" ) or
( object.tags["club"] == "cadet" ) or
( object.tags["club"] == "youth_movement" ) or
( object.tags["club"] == "bridge" ) or
( object.tags["club"] == "bowling" ) or
( object.tags["club"] == "air_cadets" ) or
( object.tags["club"] == "scuba_diving" ) or
( object.tags["club"] == "model_railway" ) or
( object.tags["club"] == "boat" ) or
( object.tags["club"] == "card_games" ) or
( object.tags["club"] == "girlguiding" ) or
( object.tags["club"] == "guide" ) or
( object.tags["club"] == "photography" ) or
( object.tags["club"] == "sea_cadets" ) or
( object.tags["club"] == "theatre" ) or