Merge branch 'master' into roundtrip
This commit is contained in:
commit
ec41cf5769
@ -15,7 +15,10 @@ final class KinematicPrePath extends OsmPrePath {
|
||||
|
||||
protected void initPrePath(OsmPath origin, RoutingContext rc) {
|
||||
byte[] description = link.descriptionBitmap;
|
||||
if (description == null) throw new IllegalArgumentException("null description for: " + link);
|
||||
if (description == null) {
|
||||
//throw new IllegalArgumentException("null description for: " + link);
|
||||
description = (targetNode.descriptionBitmap != null ? targetNode.descriptionBitmap : new byte[] {0, 1, 0});
|
||||
}
|
||||
|
||||
// extract the 3 positions of the first section
|
||||
int lon0 = origin.originLon;
|
||||
|
||||
94
brouter-routing-app/src/main/res/values-cs/strings.xml
Normal file
94
brouter-routing-app/src/main/res/values-cs/strings.xml
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<plurals name="numberOfSegments" tools:ignore="MissingQuantity">
|
||||
<item quantity="one">%d segment</item>
|
||||
<item quantity="other">%d segmentů</item>
|
||||
</plurals>
|
||||
<string name="cancel_download">Zrušit stahování</string>
|
||||
<string name="import_profile">Import profilu</string>
|
||||
<string name="action_download">Stáhnout %s</string>
|
||||
<string name="action_delete">Smazat %s</string>
|
||||
<string name="action_update">Aktualizovat %s</string>
|
||||
<string name="action_select">Výběr segmentů</string>
|
||||
<string name="action_cancel">Zastavení stahování</string>
|
||||
<string name="summary_segments">Velikost=%1$s\nVolných=%2$s</string>
|
||||
<string name="notification_title">Stahování segmentů</string>
|
||||
|
||||
<string name="action_choose_folder">Výběr adresáře databáze brouteru:</string>
|
||||
<string name="action_select_profile">Výběr profilu trasování</string>
|
||||
<string name="main_action">Výběr hlavní akce</string>
|
||||
<string name="main_action_1">Správce stahování</string>
|
||||
<string name="main_action_2">Aplikace BRouter</string>
|
||||
|
||||
<string name="cancel">Zrušit</string>
|
||||
<string name="i_know">Vím</string>
|
||||
<string name="close">Zavřít</string>
|
||||
<string name="exit">Ukončit</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="success">Úspěch</string>
|
||||
<string name="error">Došlo k chybě</string>
|
||||
|
||||
<string name="title_download">Správce stahování BRouter</string>
|
||||
<string name="summary_download">*** Pozor:***
|
||||
\n\nSprávce stahování slouží ke stahování trasovacích dat.
|
||||
které mohou mít velikost až 170 MB. Nespouštějte Správce stahování
|
||||
na mobilním datovém připojení bez datového tarifu!
|
||||
Rychlost stahování je omezena na 16 MBit/s.</string>
|
||||
<string name="title_timeoutfree">Úspěšně připraven výpočet bez časového limitu</string>
|
||||
<string name="summary_timeoutfree">Úspěšně jste zopakovali výpočet, který předtím narazil na časový limit
|
||||
při spuštění z vašeho mapového nástroje. Pokud zopakujete stejný požadavek ze svého
|
||||
mapového nástroje, s tím samým cílovým bodem a blízkým výchozím bodem,
|
||||
je zaručeno, že tento požadavek nevyprší.</string>
|
||||
<string name="title_sdcard">Zadejte adresář na SDCARD:</string>
|
||||
<string name="title_action">Výběr akce</string>
|
||||
|
||||
<string name="action_via_select">Zkontrolovat PŘES výběr:</string>
|
||||
<string name="action_nogo_select">Zkontrolovat výběr NoGo:</string>
|
||||
<string name="action_servermode">Režim serveru</string>
|
||||
<string name="action_info">Info</string>
|
||||
<string name="action_calc_route">Výpočet trasy</string>
|
||||
<string name="action_profile_settings">Nastavení profilu</string>
|
||||
<string name="action_share">Sdílet GPX</string>
|
||||
<string name="action_select_from">Vyberte z</string>
|
||||
<string name="action_select_to">Vyberte do/přes</string>
|
||||
|
||||
<string name="msg_no_profile">žádná data profilu</string>
|
||||
<string name="msg_too_much_data">Příliš mnoho dat ke stažení. Vyberte prosím méně.</string>
|
||||
<string name="msg_download_start">Stahování naplánováno. Pokud se nespustí, zkontrolujte připojení k internetu.</string>
|
||||
<string name="msg_wpt_selection">aktuální výběr bodů trasy:\n</string>
|
||||
<string name="msg_no_wpt_selection">Očekává se výběr bpdů trasy\n</string>
|
||||
<string name="msg_alternative">Alternativy</string>
|
||||
<string name="msg_status_result">verze = BRouter-%1$s \n
|
||||
mem = %2$s \n
|
||||
vzdálenost = %3$s km\n
|
||||
vybrané stoupání = %4$s m\n
|
||||
čisté stoupání = %5$s m\n
|
||||
odhadovaný čas = %6$s</string>
|
||||
<string name="msg_read_wpt_error">Chyba při čtení bodů trasy</string>
|
||||
<string name="msg_no_wpt">zdroj souřadnic neobsahuje žádné body trasy!</string>
|
||||
<string name="msg_too_much_wpts">zdroj souřadnic obsahuje příliš mnoho bodů trasy: %1$d (použijte prosím názvy od/do/přes)</string>
|
||||
|
||||
<string name="no">Ne</string>
|
||||
<string name="yes">Ano</string>
|
||||
|
||||
<string name="title_delete">Potvrdit smazání</string>
|
||||
<string name="summary_delete">Opravdu smazat?</string>
|
||||
<string name="title_version">Problém s verzí</string>
|
||||
<string name="summary_version">Změnila se základní verze podkladů. Co dělat?</string>
|
||||
<string name="action_version1">Pokračovat v aktuálním stahování, stará data smazat</string>
|
||||
<string name="action_version2">Vyberte vše ke stažení a spusťte</string>
|
||||
<string name="action_version3">Zrušit nyní, dokončit v jiný den</string>
|
||||
<string name="title_version_diff">Rozdílné verze</string>
|
||||
<string name="summary_version_diff">Základní verze některých dlaždic se liší. Co dělat?</string>
|
||||
<string name="action_version_diff1">Stáhnout všechny odlišné dlaždice</string>
|
||||
<string name="action_version_diff2">Odstranit všechny různé dlaždice</string>
|
||||
<string name="action_version_diff3">Zrušit nyní, dokončit v jiný den</string>
|
||||
<string name="summary_new_version">Nová verze dat potřebuje novou aplikaci. Nejprve prosím aktualizujte BRouter</string>
|
||||
|
||||
<string name="msg_download_failed">Stahování se nezdařilo</string>
|
||||
<string name="msg_download_cancel">Stahování zrušeno</string>
|
||||
<string name="msg_download_succeed">Stahování úspěšné</string>
|
||||
<string name="msg_download_started">Stahuji…</string>
|
||||
|
||||
|
||||
</resources>
|
||||
@ -6,7 +6,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.7.2'
|
||||
classpath 'com.android.tools.build:gradle:8.7.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@ -116,14 +116,18 @@ Some variable names are pre-defined and accessed by the routing engine:
|
||||
table exported as CSV. Setting it to true/1, Brouter-web Data page will
|
||||
list all tags present in the RD5 file.
|
||||
|
||||
- `use_dynamic_range` default=false
|
||||
- `use_dynamic_range` default=true
|
||||
|
||||
To find the start / end points for a route, BRouter normally uses the
|
||||
variable `waypointCatchingRange` with a default value of 250 m. In some
|
||||
To find the start / end points for a route, BRouter normally uses for all
|
||||
waypoint matches the dynamic range logic instead of the variable
|
||||
`waypointCatchingRange` with a default value of 250 m. In some
|
||||
situations, adding a few meters here is not enough to find a point.
|
||||
With this new variable, it goes deeper and could reach a radius of about 50 km.
|
||||
From this point, the more distant road connection is established as the beeline
|
||||
and included in the calculation.
|
||||
|
||||
- `add_beeline` default=false
|
||||
|
||||
This enables on dynamic range search the output for the more distant road connection
|
||||
as a beeline.
|
||||
This is helpful in areas with less road coverage like in the Arabic world or
|
||||
similar areas.
|
||||
|
||||
|
||||
@ -17,7 +17,8 @@ assign avoid_toll = false # %avoid_toll% | Avoid paid roads | boolean
|
||||
assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean
|
||||
assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean
|
||||
|
||||
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
assign use_offroad = false # %use_offroad% | Enable additional roads | boolean
|
||||
|
||||
# Kinematic model parameters
|
||||
assign vmax = 90 # %vmax% | Target speed (in km/h) | number
|
||||
@ -61,8 +62,8 @@ assign caraccess
|
||||
switch highway=secondary|secondary_link 1
|
||||
switch highway=tertiary|tertiary_link 1
|
||||
switch highway=unclassified 1
|
||||
switch and highway=track use_dynamic_range 1
|
||||
switch and highway=road use_dynamic_range 1
|
||||
switch and highway=track use_offroad 1
|
||||
switch and highway=road use_offroad 1
|
||||
switch route=ferry 1
|
||||
switch isresidentialorliving 1
|
||||
switch highway=service 1
|
||||
|
||||
@ -1,110 +1,106 @@
|
||||
# "fastbike-verylowtraffic.brf" -- Version 23.08.2021
|
||||
# This profile, developed by Ess Bee, is based on the "fastbike-lowtraffic" profile
|
||||
# it is intended for road cyclists who ride alone and / or in the middle of the week: thus trucks and high traffic are avoided
|
||||
# (cyclists in group at the weekend will rather use "fastbike.brf" or "fastbike-lowprofile.brf" as groups are better respected by cars and trucks)
|
||||
#
|
||||
# ==> where ever possible, choose:
|
||||
# - an asphalted way (with good smoothness)
|
||||
# - cycleways are prefered
|
||||
# - on highway=tertiary, secondary or primary whithout any cycle_way:
|
||||
# - avoid segments with maxspeed > 50 kmh (reduce the risk)
|
||||
# - avoid segments with high-traffic
|
||||
# A fastbike could be a racing bike or a speed pedelec.
|
||||
# But also at night or in rainy weather you might want
|
||||
# to fallback to this one.
|
||||
#
|
||||
# The route is calculated using the taggs of the OSM map (such as highway, surface, smoothness, maxspeed, traffic_class...)
|
||||
# Structure is similar to trekking.brf, see this for documenation.
|
||||
#
|
||||
# With default configuration (tested for Europe), trunks are
|
||||
# strongly avoided even if there's no bike restriction
|
||||
# (assuming implicit bicycle=no), and motorways are not allowed
|
||||
# even with bicycle=yes). This is not the expected behavior for some countries
|
||||
# such as Japan or Australia.
|
||||
# Then, you should switch allow_motorways variable to true for these regions.
|
||||
#
|
||||
|
||||
---context:global # following code refers to global config
|
||||
assign processUnusedTags false # set to true if you want to display all tags in the "data"
|
||||
|
||||
# to generate turn instructions, adapt the mode by need
|
||||
assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style]
|
||||
# Bike profile
|
||||
assign validForBikes = true
|
||||
|
||||
# Use the following switches to change behaviour
|
||||
assign allow_steps = true # %allow_steps% | Set to false to disallow steps | boolean
|
||||
assign allow_ferries = true # %allow_ferries% | set to false to disallow ferries | boolean
|
||||
assign allow_motorways = false # %allow_motorways% | Set to true to allow motorways (useful in Asia / Oceania for example) | boolean
|
||||
|
||||
assign consider_elevation = false # %consider_elevation% | set to true to consider costs for elevation | boolean
|
||||
assign avoid_path = false # %avoid_path% | set to true to avoid pathes | boolean
|
||||
assign consider_traffic = 1 # %consider_traffic% | 0 => no cost for "traffic_class" or "maxspeed", 1 => costs are considered!: value example 0.3 | number
|
||||
assign consider_traffic = true # %consider_traffic% | Activate to avoid traffic | boolean
|
||||
assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean
|
||||
assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean
|
||||
assign consider_forest = false # %consider_forest% | Activate to prefer a route in forest or parks | boolean
|
||||
assign consider_town = false # %consider_town% | Activate to bypass cities / big towns as far as possible | boolean
|
||||
|
||||
assign cycleway_lane_penalty = 0 # 0 => when lane, no cost for traffic or max speed, 1 => same cost as on the highway itself: example 0.3
|
||||
# Change elevation parameters
|
||||
assign consider_elevation = true # %consider_elevation% | Set to false to ignore elevation in routing | boolean
|
||||
assign downhillcost = 60 # %downhillcost% | Cost for going downhill | number
|
||||
assign downhillcutoff = 1.5 # %downhillcutoff% | Gradients below this value in percents are not counted. | number
|
||||
assign uphillcost = 0 # %uphillcost% | Cost for going uphill | number
|
||||
assign uphillcutoff = 1.5 # %uphillcutoff% | Gradients below this value in percents are not counted. | number
|
||||
|
||||
assign turnInstructionCatchingRange = 8 # 2 turn instructions are generated only when distance > 8 m
|
||||
assign turnInstructionRoundabouts = false # roundabout, no "take exit N" (as "N" may be confusing compared to car)
|
||||
assign considerTurnRestrictions = true # turn restrictions are considered
|
||||
assign downhillcost = if consider_elevation then downhillcost else 0
|
||||
assign uphillcost = if consider_elevation then uphillcost else 0
|
||||
|
||||
assign validForBikes 1
|
||||
# Kinematic model parameters (travel time computation)
|
||||
assign totalMass = 90 # %totalMass% | Mass (in kg) of the bike + biker, for travel time computation | number
|
||||
assign maxSpeed = 45 # %maxSpeed% | Absolute maximum speed (in km/h), for travel time computation | number
|
||||
assign S_C_x = 0.225 # %S_C_x% | Drag coefficient times the reference area (in m^2), for travel time computation | number
|
||||
assign C_r = 0.01 # %C_r% | Rolling resistance coefficient (dimensionless), for travel time computation | number
|
||||
assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number
|
||||
|
||||
# the elevation parameters
|
||||
# Turn instructions settings
|
||||
assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style]
|
||||
assign turnInstructionCatchingRange = 40 # %turnInstructionCatchingRange% | Within this distance (in m) several turning instructions are combined into one and the turning angles are better approximated to the general direction | number
|
||||
assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean
|
||||
assign considerTurnRestrictions = true # %considerTurnRestrictions% | Set to true to take turn restrictions into account | boolean
|
||||
|
||||
# assign downhillcost switch consider_elevation 60 0
|
||||
# assign downhillcutoff 1.5
|
||||
# assign uphillcost switch consider_elevation 100 0
|
||||
# assign uphillcutoff 1.5
|
||||
|
||||
assign downhillcost 60
|
||||
assign downhillcutoff switch consider_elevation 1.5 15
|
||||
assign uphillcost 100
|
||||
assign uphillcutoff switch consider_elevation 1.5 15
|
||||
|
||||
|
||||
# extention...(not supported yet)
|
||||
assign jonctionToLeftCost_HL = 151 # turn left from High to Low prio
|
||||
assign jonctionToLeftCost_LH = 77 # turn left from Low to High prio
|
||||
assign processUnusedTags = false # %processUnusedTags% | Set to true to output unused tags in data tab | boolean
|
||||
|
||||
---context:way # following code refers to way-tags
|
||||
|
||||
# when "cycleway" only on 1 side of the road, use it only if it is on the right side in the direction of travel!
|
||||
assign cycleway_right if reversedirection=yes
|
||||
then if cycleway:left=track|lane|shared_lane then 1 else 0
|
||||
else if cycleway:right=track|lane|shared_lane then 1 else 0
|
||||
|
||||
assign any_cycleway or cycleway=track|lane|shared_lane|shared cycleway_right
|
||||
# as soon it is supported in lookup, add ==> bicycle_road=yes in any_cycleway
|
||||
|
||||
# in relation with "route=bicycle" ?
|
||||
assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
|
||||
|
||||
assign nodeaccessgranted or any_cycleroute lcn=yes
|
||||
|
||||
assign ispaved or surface=paved surface=asphalt
|
||||
assign isunpaved surface=unpaved|gravel|dirt|earth|ground|sand
|
||||
|
||||
assign isfine_gravel surface=fine_gravel|cobblestone|compacted|paving_stones
|
||||
assign isconcrete surface=concrete
|
||||
assign ispaved or surface=paved or surface=asphalt or surface=concrete or surface=paving_stones surface=sett
|
||||
assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobblestone
|
||||
|
||||
assign turncost = if junction=roundabout then 0
|
||||
else 10
|
||||
#
|
||||
else 90
|
||||
assign initialclassifier =
|
||||
switch route=ferry 2 1
|
||||
assign initialcost =
|
||||
switch route=ferry 4999 0
|
||||
if route=ferry then 1
|
||||
else 0
|
||||
|
||||
assign initialcost switch route=ferry 10000 0
|
||||
|
||||
#
|
||||
# implicit access here just from the motorroad tag
|
||||
# (implicit access rules from highway tag handled elsewhere)
|
||||
#
|
||||
assign defaultaccess
|
||||
switch access=
|
||||
not motorroad=yes
|
||||
(
|
||||
if motorroad=yes then false
|
||||
else if highway=motorway|motorway_link then false
|
||||
else true
|
||||
)
|
||||
switch or access=private access=no
|
||||
0
|
||||
1
|
||||
false
|
||||
true
|
||||
|
||||
#
|
||||
# calculate logical bike access
|
||||
#
|
||||
assign bikeaccess
|
||||
or any_cycleroute
|
||||
assign bikeaccess =
|
||||
switch bicycle=
|
||||
switch bicycle_road=yes
|
||||
true
|
||||
switch vehicle=
|
||||
defaultaccess
|
||||
switch or vehicle=private vehicle=no
|
||||
0
|
||||
1
|
||||
( if highway=footway then false else defaultaccess )
|
||||
not vehicle=private|no
|
||||
not or bicycle=private or bicycle=no bicycle=dismount
|
||||
|
||||
#
|
||||
# calculate logical foot access
|
||||
#
|
||||
assign footaccess
|
||||
assign footaccess =
|
||||
or bikeaccess
|
||||
or bicycle=dismount
|
||||
switch foot=
|
||||
@ -120,6 +116,8 @@ assign accesspenalty
|
||||
0
|
||||
switch footaccess
|
||||
6
|
||||
switch any_cycleroute
|
||||
15
|
||||
10000
|
||||
|
||||
#
|
||||
@ -152,207 +150,126 @@ assign onewaypenalty =
|
||||
)
|
||||
else 0.0
|
||||
|
||||
assign surfacepenalty =
|
||||
# if "surface" is not defined...
|
||||
switch surface=
|
||||
# then, for Primary, secondary and tertiary asphalt is very probable
|
||||
switch highway=primary|primary_link|secondary|secondary_link|tertiary|tertiary_link 0
|
||||
# then, for residential & Co. probably asphalt..
|
||||
switch highway=road|residential|unclassified 0.1
|
||||
# then, for living_street something paved ..
|
||||
switch highway=living_street 0.3
|
||||
# then, for "service & cycleway" possibly good (but not sure!) ...
|
||||
switch highway=service|cycleway 0.5
|
||||
# in some cases only smoothness is tagged but surface not!
|
||||
switch smoothness=intermediate|good|excellent 0
|
||||
# else, check if tracktype=grade1, then it is "something" paved, so middle penalty
|
||||
switch tracktype=grade1 0.2
|
||||
# if a cycleroute is defined, surface can not be horrible...
|
||||
switch any_cycleroute 3.5 5
|
||||
switch surface=asphalt 0
|
||||
switch surface=paved switch smoothness=good|excellent 0.1 0.3 # befestigte(harte)Oberfl sche
|
||||
switch surface=gravel|sand|pebblestone|unpaved 10 # Schotter, Sand, Kies, unbefestigt
|
||||
switch surface=ground|grass|dirt|earth|mud|clay 25 # naturbelassene Oberfl sche, Gras, Schutz Schlamm...
|
||||
switch surface=fine_gravel|compacted switch smoothness=good|excellent 1 4 # Splitt,verdichtete Oberflaesche
|
||||
switch surface=sett switch smoothness=good|excellent 0.1 0.3 # behauene Pflastersteine
|
||||
switch concrete=plates 1 # Betonplattenwege
|
||||
switch surface=concrete|paving_stones|wood|metal 0.8 # Beton, Pflastersteine (geschnitzt), Holz, Metall
|
||||
switch surface=cobblestone|sett switch smoothness=good|excellent 1 2 # Kopfsteinpflaster
|
||||
# switch surface=unhewn_cobblestone 3 # ungeschnitzter Pflasterstein
|
||||
switch concrete=lanes 3 # Betonspurplatten
|
||||
switch surface=grass_paver 5 # Rasengittersteine
|
||||
# Eventually compute traffic penalty
|
||||
assign hascycleway = not
|
||||
and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) ( or cycleway:right= cycleway:right=no )
|
||||
|
||||
# surface not known and probably not paved / no asphalt...
|
||||
8
|
||||
|
||||
assign tracktypepenalty
|
||||
switch tracktype= 0
|
||||
switch tracktype=grade2 1
|
||||
switch tracktype=grade3 8
|
||||
switch tracktype=grade4 15
|
||||
switch tracktype=grade5 50 0
|
||||
|
||||
|
||||
assign trafficpenalty =
|
||||
# if any_cycleway then 0
|
||||
# else
|
||||
assign trafficpenalty0 =
|
||||
if consider_traffic then
|
||||
(
|
||||
if highway=primary|primary_link then
|
||||
(
|
||||
if estimated_traffic_class=1|2 then 0
|
||||
else if estimated_traffic_class=3 then multiply 0.4 consider_traffic
|
||||
else if estimated_traffic_class=4 then multiply 0.8 consider_traffic
|
||||
else if estimated_traffic_class=5 then multiply 1 consider_traffic
|
||||
else if estimated_traffic_class=6|7 then multiply 2 consider_traffic
|
||||
else multiply 0.6 consider_traffic
|
||||
if estimated_traffic_class=4 then 0.2
|
||||
else if estimated_traffic_class=5 then 0.4
|
||||
else if estimated_traffic_class=6|7 then 0.6
|
||||
else 0
|
||||
)
|
||||
else if highway=secondary|secondary_link then
|
||||
(
|
||||
if estimated_traffic_class=1|2 then multiply 0.1 consider_traffic
|
||||
else if estimated_traffic_class=3 then multiply 0.3 consider_traffic
|
||||
else if estimated_traffic_class=4 then multiply 0.7 consider_traffic
|
||||
else if estimated_traffic_class=5 then multiply 1 consider_traffic
|
||||
else if estimated_traffic_class=6|7 then multiply 1.5 consider_traffic
|
||||
else multiply 0.2 consider_traffic
|
||||
if estimated_traffic_class=3 then 0.2
|
||||
else if estimated_traffic_class=4 then 0.4
|
||||
else if estimated_traffic_class=5 then 0.6
|
||||
else if estimated_traffic_class=6|7 then 1
|
||||
else 0
|
||||
)
|
||||
else if highway=tertiary|tertiary_link then
|
||||
(
|
||||
if estimated_traffic_class=1|2 then multiply 0.1 consider_traffic
|
||||
else if estimated_traffic_class=3 then multiply 0.2 consider_traffic
|
||||
else if estimated_traffic_class=4 then multiply 0.5 consider_traffic
|
||||
else multiply if estimated_traffic_class=5|6|7 then multiply 1 consider_traffic
|
||||
else 0.1 consider_traffic
|
||||
if estimated_traffic_class=2 then 0.1
|
||||
else if estimated_traffic_class=3 then 0.3
|
||||
else if estimated_traffic_class=4 then 0.5
|
||||
else if estimated_traffic_class=5|6|7 then 1
|
||||
else 0
|
||||
)
|
||||
else 0
|
||||
)
|
||||
else 0
|
||||
|
||||
assign smoothnesspenalty =
|
||||
switch smoothness=intermediate 0.3
|
||||
switch smoothness=bad 1
|
||||
switch smoothness=very_bad 2
|
||||
switch smoothness=horrible 4.5
|
||||
0
|
||||
assign trafficpenalty =
|
||||
if consider_traffic then
|
||||
(
|
||||
if hascycleway then min 0.3 trafficpenalty0
|
||||
else trafficpenalty0
|
||||
)
|
||||
else 0
|
||||
|
||||
assign maxspeedpenalty =
|
||||
switch or highway=primary highway=primary_link
|
||||
# as soon "name" is supported in lookup, replace with "switch maxspeed= switch name= 2.2 1
|
||||
switch maxspeed=50 multiply 0.2 consider_traffic
|
||||
# switch any_cycleway multiply 0.2 consider_traffic
|
||||
switch maxspeed=60 multiply 0.7 consider_traffic
|
||||
switch maxspeed=70 multiply 1.2 consider_traffic
|
||||
switch maxspeed=80 multiply 1.5 consider_traffic
|
||||
switch maxspeed=90 multiply 2.0 consider_traffic
|
||||
switch maxspeed=100 multiply 3.0 consider_traffic
|
||||
switch maxspeed=110 multiply 11 consider_traffic
|
||||
switch maxspeed=120 multiply 12 consider_traffic
|
||||
switch maxspeed=130 multiply 13 consider_traffic
|
||||
switch maxspeed= multiply 2.2 consider_traffic 0
|
||||
switch or highway=secondary highway=secondary_link
|
||||
# as soon "name" is supported in lookup, replace with "switch maxspeed= switch name= 0.9 0.2
|
||||
switch maxspeed=50 multiply 0.1 consider_traffic
|
||||
# switch any_cycleway multiply 0.1 consider_traffic
|
||||
switch maxspeed=60 multiply 0.2 consider_traffic
|
||||
switch maxspeed=70 multiply 0.9 consider_traffic
|
||||
switch maxspeed=80 multiply 1.5 consider_traffic
|
||||
switch maxspeed=90 multiply 2 consider_traffic
|
||||
switch maxspeed=100 multiply 2.5 consider_traffic
|
||||
switch maxspeed=110 multiply 11 consider_traffic
|
||||
switch maxspeed=120 multiply 12 consider_traffic
|
||||
switch maxspeed=130 multiply 13 consider_traffic
|
||||
switch maxspeed= multiply 0.9 consider_traffic 0
|
||||
switch or highway=tertiary highway=tertiary_link
|
||||
# as soon "name" is supported in lookup, replace with "switch maxspeed= switch name= 0.2 0.1
|
||||
switch maxspeed=50 0
|
||||
switch maxspeed=60 multiply 0.1 consider_traffic
|
||||
# switch any_cycleway 0.05 consider_traffic
|
||||
switch maxspeed=70 multiply 0.2 consider_traffic
|
||||
switch maxspeed=80 multiply 0.2 consider_traffic
|
||||
switch maxspeed=90 multiply 0.3 consider_traffic
|
||||
switch maxspeed=100 multiply 0.4 consider_traffic
|
||||
switch maxspeed=110 multiply 11 consider_traffic
|
||||
switch maxspeed=120 multiply 12 consider_traffic
|
||||
switch maxspeed=130 multiply 13 consider_traffic
|
||||
switch maxspeed= multiply 0.2 consider_traffic 0
|
||||
0
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
# if bicycle=use_sidepath, then try to prefer the (hopefully!) existing sidepath with a penalty on this highway (only if avoid_path is not set)
|
||||
assign usesidepathpenalty =
|
||||
switch bicycle=use_sidepath switch avoid_path 0 0.5 0
|
||||
# add estimate tags
|
||||
assign noise_penalty
|
||||
switch consider_noise
|
||||
switch estimated_noise_class= 0
|
||||
switch estimated_noise_class=1 0.3
|
||||
switch estimated_noise_class=2 0.5
|
||||
switch estimated_noise_class=3 0.7
|
||||
switch estimated_noise_class=4 1
|
||||
switch estimated_noise_class=5 1.2
|
||||
switch estimated_noise_class=6 1.5 0 0
|
||||
|
||||
# give a light advantage to highways with a relation cycleroute
|
||||
assign nocycleroute_penalty switch any_cycleroute 0 0.05
|
||||
assign no_river_penalty
|
||||
switch consider_river
|
||||
switch estimated_river_class= 3
|
||||
switch estimated_river_class=1 2
|
||||
switch estimated_river_class=2 1.5
|
||||
switch estimated_river_class=3 1
|
||||
switch estimated_river_class=4 0.5
|
||||
switch estimated_river_class=5 0.2
|
||||
switch estimated_river_class=6 0 99 0
|
||||
|
||||
assign not_bicycle_designatedpenalty switch bicycle=designated 0 0.1
|
||||
assign no_forest_penalty
|
||||
switch consider_forest
|
||||
switch estimated_forest_class= 1
|
||||
switch estimated_forest_class=1 0.5
|
||||
switch estimated_forest_class=2 0.4
|
||||
switch estimated_forest_class=3 0.25
|
||||
switch estimated_forest_class=4 0.15
|
||||
switch estimated_forest_class=5 0.1
|
||||
switch estimated_forest_class=6 0 99 0
|
||||
|
||||
assign sum_highwaypenalty
|
||||
add surfacepenalty
|
||||
add tracktypepenalty
|
||||
add trafficpenalty
|
||||
add smoothnesspenalty
|
||||
add maxspeedpenalty
|
||||
add usesidepathpenalty
|
||||
add nocycleroute_penalty
|
||||
not_bicycle_designatedpenalty
|
||||
|
||||
# penalties differ when a cycleway is associated to the highway with "cycleway=yes"
|
||||
|
||||
assign cycleway_surfacepenalty
|
||||
switch any_cycleway
|
||||
switch cycleway:surface= surfacepenalty # if not specified, same as highway
|
||||
switch cycleway:surface=asphalt 0
|
||||
switch cycleway:surface=sett 0.3 # behauene Pflastersteine
|
||||
switch cycleway:surface=paved 0.3 # befestigte(harte)Oberflaesche
|
||||
switch cycleway:surface=concrete|paving_stones 0.8 # Beton, Pflastersteine (geschnitzt)
|
||||
switch cycleway:surface=cobblestone|sett 2 # Kopfsteinpflaster
|
||||
switch cycleway:surface=fine_gravel|compacted 4 # Splitt,verdichtete Oberflaesche
|
||||
switch cycleway:surface=gravel 10 # Schotter
|
||||
0 # unknown value...
|
||||
1000 # noc cycleway
|
||||
|
||||
# to be activated after implementation of #241
|
||||
#assign cycleway_smoothnesspenalty
|
||||
# switch cycleway:smoothness= smoothnesspenalty # if not specified, same as highway
|
||||
# switch cycleway:smoothness=intermediate 0.3
|
||||
# switch cycleway:smoothness=bad 1
|
||||
# switch cycleway:smoothness=very_bad 2
|
||||
# switch cycleway:smoothness=horrible 4.5
|
||||
# 0
|
||||
|
||||
# temporary...
|
||||
assign cycleway_smoothnesspenalty smoothnesspenalty # temporray same as highway
|
||||
|
||||
assign sum_cyclewaypenalty
|
||||
switch any_cycleway # cycleway exists
|
||||
add multiply maxspeedpenalty cycleway_lane_penalty
|
||||
add multiply trafficpenalty cycleway_lane_penalty
|
||||
add cycleway_surfacepenalty
|
||||
add cycleway_smoothnesspenalty
|
||||
usesidepathpenalty
|
||||
# add nocycleroute_penalty
|
||||
# add not_bicycle_designatedpenalty
|
||||
10000 # no cycleway
|
||||
assign town_penalty
|
||||
switch consider_town
|
||||
switch estimated_town_class= 0
|
||||
switch estimated_town_class=1 0.2
|
||||
switch estimated_town_class=2 0.4
|
||||
switch estimated_town_class=3 0.6
|
||||
switch estimated_town_class=4 0.7
|
||||
switch estimated_town_class=5 0.8
|
||||
switch estimated_town_class=6 1 99 0
|
||||
|
||||
assign costfactor
|
||||
add min sum_highwaypenalty sum_cyclewaypenalty
|
||||
switch and highway= not route=ferry 10000
|
||||
switch or highway=proposed highway=abandoned 10000
|
||||
|
||||
min 9999
|
||||
add max onewaypenalty accesspenalty
|
||||
switch or highway=motorway highway=motorway_link 10000
|
||||
switch or highway=trunk highway=trunk_link 30
|
||||
add trafficpenalty
|
||||
add town_penalty
|
||||
add no_forest_penalty
|
||||
add no_river_penalty
|
||||
add noise_penalty
|
||||
|
||||
|
||||
switch or highway=motorway highway=motorway_link switch allow_motorways 1.5 10000
|
||||
switch or highway=trunk highway=trunk_link switch allow_motorways 1.5 10
|
||||
switch or highway=primary highway=primary_link 1.2
|
||||
switch or highway=secondary highway=secondary_link 1.1
|
||||
switch or highway=tertiary highway=tertiary_link 1.0
|
||||
switch highway=unclassified 1.1
|
||||
switch highway=pedestrian 8
|
||||
switch highway=steps 100
|
||||
switch route=ferry 11
|
||||
switch highway=bridleway 31
|
||||
switch highway=cycleway 0.9
|
||||
switch highway=living_street 1.2
|
||||
switch highway=residential switch bicycle_road=yes 1 1.4
|
||||
switch highway=service switch ( or service= service=alley ) 1.1 11
|
||||
switch highway=track|road 0.9
|
||||
switch highway=path switch avoid_path 2 1
|
||||
switch highway=footway switch bicycle=yes 1.7 4.7
|
||||
19.9
|
||||
switch highway=unclassified switch isunpaved 10 1.1
|
||||
switch highway=pedestrian 10
|
||||
switch highway=steps switch allow_steps 1000 10000
|
||||
switch route=ferry switch allow_ferries 5.67 10000
|
||||
switch highway=bridleway 5
|
||||
switch highway=cycleway 1.3
|
||||
switch isresidentialorliving switch isunpaved 10 1.2
|
||||
switch highway=service switch isunpaved 10 1.2
|
||||
switch or highway=track or highway=road or highway=path highway=footway
|
||||
switch tracktype=grade1 switch isunpaved 3 1.2
|
||||
switch tracktype=grade2 switch isunpaved 10 3
|
||||
switch tracktype=grade3 10.0
|
||||
switch tracktype=grade4 20.0
|
||||
switch tracktype=grade5 30.0
|
||||
switch or bicycle=designated bicycle_road=yes 2.0
|
||||
switch ispaved 2.0 100.0
|
||||
10.0
|
||||
|
||||
# way priorities used for voice hint generation
|
||||
|
||||
@ -362,23 +279,24 @@ assign priorityclassifier =
|
||||
else if ( highway=motorway_link ) then 29
|
||||
else if ( highway=trunk ) then 28
|
||||
else if ( highway=trunk_link ) then 27
|
||||
else if ( highway=primary ) then 23
|
||||
else if ( highway=primary_link ) then 9
|
||||
else if ( highway=secondary ) then 22
|
||||
else if ( highway=secondary_link ) then 9
|
||||
else if ( highway=tertiary ) then 21
|
||||
else if ( highway=tertiary_link ) then 9
|
||||
else if ( highway=residential|living_street ) then 8
|
||||
else if ( highway=unclassified ) then 8
|
||||
else if ( highway=service ) then 8
|
||||
else if ( highway=cycleway ) then 8
|
||||
else if ( bicycle=designated ) then 8
|
||||
else if ( highway=track|road|path )
|
||||
then if or surface=asphalt|paved|paving_stones|concrete|wood|metal tracktype=grade1 then 8 else 6
|
||||
else if ( highway=primary ) then 26
|
||||
else if ( highway=primary_link ) then 25
|
||||
else if ( highway=secondary ) then 24
|
||||
else if ( highway=secondary_link ) then 23
|
||||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
else if ( highway=pedestrian ) then 2
|
||||
else 0
|
||||
|
||||
|
||||
# some more classifying bits used for voice hint generation...
|
||||
|
||||
assign isbadoneway = not equal onewaypenalty 0
|
||||
@ -387,19 +305,21 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
||||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
# ... encoded into a bitmask
|
||||
|
||||
assign classifiermask
|
||||
# add isbadoneway # no voice hint if 1 of the 2 possibilities is badoneway
|
||||
assign classifiermask add isbadoneway
|
||||
add multiply isgoodoneway 2
|
||||
add multiply isroundabout 4
|
||||
add multiply islinktype 8
|
||||
multiply isgoodforcars 16
|
||||
|
||||
# include `smoothness=` tags in the response's WayTags for track analysis
|
||||
assign dummyUsage = smoothness=
|
||||
|
||||
|
||||
---context:node # following code refers to node tags
|
||||
|
||||
@ -430,18 +350,7 @@ assign footaccess
|
||||
0
|
||||
1
|
||||
|
||||
assign railwaypenalty switch railway= 0 155
|
||||
# assign signalpenalty switch highway=traffic_signals 99
|
||||
# switch crossing=traffic_signals 49 0
|
||||
# note: in case of a "left-turn" at the traffic-signal the penalty is counted twice...
|
||||
|
||||
assign barrierpenalty switch barrier= 0
|
||||
switch barrier=block|bollard 59 139
|
||||
|
||||
assign initialcost
|
||||
add railwaypenalty
|
||||
# add signalpenalty
|
||||
add barrierpenalty
|
||||
switch bikeaccess
|
||||
0
|
||||
switch footaccess
|
||||
|
||||
@ -8,7 +8,7 @@ assign turnInstructionRoundabouts true # %turnInstructionRoundabouts% | Special
|
||||
assign considerTurnRestrictions true
|
||||
assign turnInstructionMode 1 # %turnInstructionMode% | Mode for the generated turn-by-turn directions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=oruxmaps-style]
|
||||
|
||||
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
|
||||
#assign processUnusedTags true
|
||||
assign pass1coefficient 4
|
||||
|
||||
@ -44,7 +44,7 @@ assign initialcost_value 0 # not used now
|
||||
assign allow_steps true # %allow_steps% | Set to false to disallow steps | boolean
|
||||
assign allow_ferries true # %allow_ferries% | set to false to disallow ferries | boolean
|
||||
|
||||
assign use_dynamic_range false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
|
||||
assign cost_of_unknown 2 # 2 as default
|
||||
|
||||
@ -164,11 +164,11 @@ assign bikeaccess
|
||||
|
||||
assign footaccess or any_hiking_route
|
||||
or issidewalk
|
||||
or and bikeaccess not foot=no
|
||||
or and bikeaccess not foot=no|use_sidepath
|
||||
or bicycle=dismount
|
||||
switch foot= defaultaccess not foot=private|no
|
||||
switch foot= defaultaccess not foot=private|no|use_sidepath
|
||||
|
||||
assign accesspenalty switch footaccess 0 switch bikeaccess 4 100000
|
||||
assign accesspenalty switch footaccess 0 switch bikeaccess 4 switch foot=use_sidepath 10 100000
|
||||
|
||||
assign badoneway = 0
|
||||
assign onewaypenalty = 0
|
||||
|
||||
@ -16,7 +16,7 @@ assign uphillcutoff 0
|
||||
assign validForBikes 1
|
||||
assign validForCars 1
|
||||
|
||||
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
|
||||
assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style]
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
# bstart /global
|
||||
---context:global
|
||||
|
||||
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
|
||||
assign iswet 0 # 0 as default, *) flag for weather conditions
|
||||
assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
# the elevation parameters
|
||||
|
||||
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
|
||||
assign downhillcost 0
|
||||
assign downhillcutoff 1.5
|
||||
|
||||
@ -15,7 +15,7 @@ assign ignore_cycleroutes = false # %ignore_cycleroutes% | Set true for
|
||||
assign stick_to_cycleroutes = false # %stick_to_cycleroutes% | Set true to just follow cycleroutes | boolean
|
||||
assign avoid_unsafe = false # %avoid_unsafe% | Set true to avoid standard highways | boolean
|
||||
|
||||
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean
|
||||
assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
|
||||
|
||||
assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean
|
||||
assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean
|
||||
@ -135,10 +135,9 @@ assign bikeaccess =
|
||||
# calculate logical foot access
|
||||
#
|
||||
assign footaccess =
|
||||
if bikeaccess then true
|
||||
else if bicycle=dismount then true
|
||||
if bicycle=dismount then true
|
||||
else if foot= then defaultaccess
|
||||
else not foot=private|no
|
||||
else not foot=private|no|use_sidepath
|
||||
|
||||
#
|
||||
# if not bike-, but foot-acess, just a moderate penalty,
|
||||
@ -172,6 +171,7 @@ assign onewaypenalty =
|
||||
else if ( oneway:bicycle=no ) then 0
|
||||
else if ( cycleway:left:oneway=no ) then 0
|
||||
else if ( cycleway:right:oneway=no ) then 0
|
||||
else if ( not footaccess ) then 100
|
||||
else if ( junction=roundabout|circular ) then 60
|
||||
else if ( highway=primary|primary_link ) then 50
|
||||
else if ( highway=secondary|secondary_link ) then 30
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
-- calculation of new tags (estimated_noise_class, estimated_river_class,estimated_forest_class, estimated_town_class, estimated_traffic_class)
|
||||
-- formatted by https://sqlformat.darold.net/
|
||||
|
||||
SET client_encoding TO UTF8;
|
||||
|
||||
SELECT
|
||||
@ -23,10 +22,12 @@ LANGUAGE plpgsql
|
||||
SECURITY INVOKER;
|
||||
|
||||
-- create new tables for tuning
|
||||
--
|
||||
SELECT
|
||||
osm_id::bigint,
|
||||
highway,
|
||||
waterway,
|
||||
li.natural,
|
||||
width,
|
||||
maxspeed,
|
||||
CASE WHEN maxspeed IS NULL THEN
|
||||
@ -44,12 +45,15 @@ SELECT
|
||||
-- "buffer radius" was initially created with 50 meters at a lat 50 degrees.... ==> ST_Buffer(way,50)
|
||||
-- but, using geometry "projection", to get same results by a calculation of the planet (latitude between -80, +85) this value should be adapted to the latitude of the highways...
|
||||
,
|
||||
--
|
||||
ST_Buffer (way, 32.15 * st_length (ST_Transform (way, 3857)) / st_length (ST_Transform (way, 4326)::geography)) AS way INTO TABLE osm_line_buf_50
|
||||
FROM
|
||||
lines
|
||||
lines li
|
||||
WHERE
|
||||
highway IS NOT NULL
|
||||
OR waterway IN ('river', 'canal');
|
||||
OR waterway IN ('river', 'canal', 'fairway')
|
||||
OR (li.natural = 'coastline'
|
||||
AND st_length (way) < 100000);
|
||||
|
||||
SELECT
|
||||
now();
|
||||
@ -63,7 +67,8 @@ WHERE
|
||||
waterway = 'river'
|
||||
AND width IS NOT NULL
|
||||
AND (width ~ '^[0-9\.]+$')
|
||||
AND width::numeric > 15;
|
||||
AND width::numeric > 15
|
||||
AND width::numeric < 2500;
|
||||
|
||||
SELECT
|
||||
osm_id::bigint,
|
||||
@ -76,11 +81,12 @@ FROM
|
||||
polygons p
|
||||
WHERE
|
||||
-- do not consider small surfaces
|
||||
st_area (st_transform (p.way, 4326)::geography) > 1000
|
||||
AND p.natural IN ('water')
|
||||
OR (p.landuse IN ('forest', 'allotments', 'flowerbed', 'orchard', 'vineyard', 'recreation_ground', 'village_green')
|
||||
st_area (p.way) > 1000
|
||||
AND (p.natural IN ('water', 'bay', 'beach', 'wetland')
|
||||
OR p.landuse IN ('forest', 'allotments', 'flowerbed', 'orchard', 'vineyard', 'recreation_ground', 'village_green')
|
||||
OR p.leisure IN ('garden', 'park', 'nature_reserve'));
|
||||
|
||||
-- by forest no buffer !
|
||||
SELECT
|
||||
osm_id::bigint,
|
||||
leisure,
|
||||
@ -92,9 +98,9 @@ FROM
|
||||
polygons p
|
||||
WHERE
|
||||
-- do not consider small surfaces
|
||||
st_area (st_transform (p.way, 4326)::geography) > 1000
|
||||
AND p.natural IN ('water')
|
||||
OR (p.landuse IN ('forest', 'allotments', 'flowerbed', 'orchard', 'vineyard', 'recreation_ground', 'village_green')
|
||||
st_area (p.way) > 1000
|
||||
AND (p.natural IN ('water', 'bay', 'beach', 'costline', 'wetland')
|
||||
OR p.landuse IN ('forest', 'allotments', 'flowerbed', 'orchard', 'vineyard', 'recreation_ground', 'village_green')
|
||||
OR p.leisure IN ('garden', 'park', 'nature_reserve'));
|
||||
|
||||
SELECT
|
||||
@ -107,6 +113,33 @@ SELECT
|
||||
FROM
|
||||
osm_poly_buf_50 p;
|
||||
|
||||
-- for coastline special case
|
||||
SELECT
|
||||
osm_id::bigint,
|
||||
leisure,
|
||||
landuse,
|
||||
p.natural,
|
||||
p.water,
|
||||
ST_Buffer (ST_ExteriorRing (way), 64 * st_length (ST_Transform (st_makeline (st_startpoint (way), st_centroid (way)), 3857)) / st_length (ST_Transform (st_makeline (st_startpoint (way), st_centroid (way)), 4326)::geography)) AS way INTO TABLE osm_poly_coastline_buf_100
|
||||
FROM
|
||||
polygons p
|
||||
WHERE
|
||||
-- do not consider small surfaces
|
||||
st_area (p.way) > 1000
|
||||
AND (p.natural IN ('coastline')
|
||||
AND st_length (way) < 100000);
|
||||
|
||||
--CREATE INDEX osm_poly_coastline_ind ON public.osm_poly_coastline_buf_100 USING gist (way) WITH (fillfactor='100');
|
||||
SELECT
|
||||
* INTO TABLE osm_line_water
|
||||
FROM
|
||||
osm_line_buf_50 q
|
||||
WHERE
|
||||
q.waterway IN ('river', 'canal', 'fairway')
|
||||
OR q.natural IN ('coastline');
|
||||
|
||||
CREATE INDEX osm_line_water_ind ON public.osm_line_water USING gist (way) WITH (fillfactor = '100');
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
@ -140,7 +173,7 @@ SELECT
|
||||
-- clean the cities table (when population is null or population is not numeric or unusable)
|
||||
SELECT
|
||||
a.name,
|
||||
REPLACE(a.population, '.', '')::bigint population,
|
||||
replace(a.population, '.', '')::bigint population,
|
||||
a.way INTO cities_ok
|
||||
FROM
|
||||
cities a
|
||||
@ -162,13 +195,16 @@ SELECT
|
||||
END AS population,
|
||||
a.way INTO cities_rel_ok
|
||||
FROM
|
||||
cities_rel a;
|
||||
cities_rel a
|
||||
WHERE
|
||||
boundary = 'administrative';
|
||||
|
||||
CREATE INDEX cities_ok_idx ON public.cities_ok USING gist (way) WITH (fillfactor = '100');
|
||||
|
||||
CREATE INDEX cities_rel_ok_idx ON public.cities_rel_ok USING gist (way) WITH (fillfactor = '100');
|
||||
|
||||
-- select town + population + way starting with cities_ok .... (to catch specials cases as ex. "Berlin" which is tagged with "admin_level=4")
|
||||
--
|
||||
SELECT
|
||||
a.name AS name,
|
||||
st_x (a.way),
|
||||
@ -181,7 +217,8 @@ SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '8'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '8'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1) IS NOT NULL THEN
|
||||
@ -190,7 +227,8 @@ SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '8'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '8'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1)
|
||||
@ -200,7 +238,8 @@ LIMIT 1)
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '7'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '7'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1) IS NOT NULL THEN
|
||||
@ -209,17 +248,19 @@ LIMIT 1)
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '7'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '7'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1)
|
||||
-- Paris admin_level=6
|
||||
-- Paris admin_level=6 (old !)
|
||||
WHEN (
|
||||
SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '6'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '6'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1) IS NOT NULL THEN
|
||||
@ -228,17 +269,19 @@ LIMIT 1)
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '6'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '6'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1)
|
||||
-- Berlin admin_level=4
|
||||
-- Bengkulu admin_level=5!
|
||||
WHEN (
|
||||
SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '4'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '5'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1) IS NOT NULL THEN
|
||||
@ -247,7 +290,29 @@ LIMIT 1)
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level = '4'
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '5'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1)
|
||||
-- Berlin admin_level=4!
|
||||
WHEN (
|
||||
SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '4'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1) IS NOT NULL THEN
|
||||
(
|
||||
SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '4'
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1)
|
||||
@ -257,7 +322,8 @@ LIMIT 1)
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level IS NULL
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level IS NULL
|
||||
AND b.place IN ('city', 'town')
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
@ -267,7 +333,31 @@ LIMIT 1)
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (b.admin_level IS NULL
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level IS NULL
|
||||
AND b.place IN ('city', 'town')
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1)
|
||||
-- Singapore admin_level is 2, place=city in cities_rel
|
||||
WHEN (
|
||||
SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '2'
|
||||
AND b.place IN ('city', 'town')
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
LIMIT 1) IS NOT NULL THEN
|
||||
(
|
||||
SELECT
|
||||
way
|
||||
FROM
|
||||
cities_rel_ok b
|
||||
WHERE (st_area (b.way) / 1000000 < 10000
|
||||
AND b.admin_level = '2'
|
||||
AND b.place IN ('city', 'town')
|
||||
AND a.name = b.name
|
||||
AND st_intersects (a.way, b.way))
|
||||
@ -363,33 +453,31 @@ SELECT
|
||||
-- create raw data for noise coming from cars
|
||||
-- when several highways-segments are producing noise, aggregate the noises using the "ST_Union" of the segments!
|
||||
-- (better as using "sum" or "max" that do not deliver good factors)
|
||||
SELECT
|
||||
* INTO TABLE osm_line_noise
|
||||
FROM
|
||||
osm_line_buf_50 q
|
||||
WHERE
|
||||
q.highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary');
|
||||
|
||||
CREATE INDEX osm_line_noise_ind ON public.osm_line_noise USING gist (way) WITH (fillfactor = '100');
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
q.highway AS qhighway,
|
||||
q.maxspeed_class,
|
||||
CASE WHEN q.highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link')
|
||||
AND q.maxspeed_class < 1.1 THEN
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / st_area (m.way)
|
||||
WHEN q.highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link') THEN
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (1.5 * st_area (m.way))
|
||||
WHEN q.highway IN ('primary', 'primary_link')
|
||||
AND q.maxspeed_class < 2.1 THEN
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (2 * st_area (m.way))
|
||||
WHEN q.highway IN ('primary', 'primary_link') THEN
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (3 * st_area (m.way))
|
||||
WHEN q.highway IN ('secondary')
|
||||
AND q.maxspeed_class < 2.1 THEN
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (3 * st_area (m.way))
|
||||
WHEN q.highway IN ('secondary') THEN
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (5 * st_area (m.way))
|
||||
END AS noise_factor INTO TABLE noise_tmp
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / st_area (m.way) AS noise_factor INTO TABLE noise_part0
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_buf_50 AS q ON ST_Intersects (m.way, q.way)
|
||||
INNER JOIN osm_line_noise AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary')
|
||||
AND q.highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link')
|
||||
AND q.maxspeed_class < 1.1
|
||||
GROUP BY
|
||||
losmid,
|
||||
lhighway,
|
||||
@ -402,21 +490,179 @@ ORDER BY
|
||||
SELECT
|
||||
now();
|
||||
|
||||
-- aggregate data:
|
||||
-- on "maxspeed_class take the sum of several highways (having different maxspeed-class) union is then not done, but not very frequent
|
||||
-- on "phighway" take the sum of several highways (as probably several highways are producing noise at the point!
|
||||
SELECT
|
||||
losmid,
|
||||
lhighway,
|
||||
sum(noise_factor) AS sum_noise_factor INTO TABLE noise_tmp2
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
q.highway AS qhighway,
|
||||
q.maxspeed_class,
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (1.5 * st_area (m.way)) AS noise_factor INTO TABLE noise_part1
|
||||
FROM
|
||||
noise_tmp
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_noise AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link')
|
||||
AND q.maxspeed_class >= 1.1
|
||||
GROUP BY
|
||||
losmid,
|
||||
lhighway
|
||||
lhighway,
|
||||
m.way,
|
||||
q.highway,
|
||||
q.maxspeed_class
|
||||
ORDER BY
|
||||
noise_factor DESC;
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
q.highway AS qhighway,
|
||||
q.maxspeed_class,
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (2 * st_area (m.way)) AS noise_factor INTO TABLE noise_part2
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_noise AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.highway IN ('primary', 'primary_link')
|
||||
AND q.maxspeed_class < 2.1
|
||||
GROUP BY
|
||||
losmid,
|
||||
lhighway,
|
||||
m.way,
|
||||
q.highway,
|
||||
q.maxspeed_class
|
||||
ORDER BY
|
||||
noise_factor DESC;
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
q.highway AS qhighway,
|
||||
q.maxspeed_class,
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (3 * st_area (m.way)) AS noise_factor INTO TABLE noise_part3
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_noise AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.highway IN ('primary', 'primary_link')
|
||||
AND q.maxspeed_class >= 2.1
|
||||
GROUP BY
|
||||
losmid,
|
||||
lhighway,
|
||||
m.way,
|
||||
q.highway,
|
||||
q.maxspeed_class
|
||||
ORDER BY
|
||||
noise_factor DESC;
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
q.highway AS qhighway,
|
||||
q.maxspeed_class,
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (3 * st_area (m.way)) AS noise_factor INTO TABLE noise_part4
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_noise AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.highway IN ('secondary')
|
||||
AND q.maxspeed_class < 2.1
|
||||
GROUP BY
|
||||
losmid,
|
||||
lhighway,
|
||||
m.way,
|
||||
q.highway,
|
||||
q.maxspeed_class
|
||||
ORDER BY
|
||||
noise_factor DESC;
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
q.highway AS qhighway,
|
||||
q.maxspeed_class,
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / (5 * st_area (m.way)) AS noise_factor INTO TABLE noise_part5
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_noise AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.highway IN ('secondary')
|
||||
AND q.maxspeed_class >= 2.1
|
||||
GROUP BY
|
||||
losmid,
|
||||
lhighway,
|
||||
m.way,
|
||||
q.highway,
|
||||
q.maxspeed_class
|
||||
ORDER BY
|
||||
noise_factor DESC;
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
-- MERGE
|
||||
SELECT
|
||||
losmid,
|
||||
sum(noise_factor) AS sum_noise_factor INTO TABLE noise_tmp2
|
||||
FROM (
|
||||
SELECT
|
||||
losmid,
|
||||
noise_factor
|
||||
FROM
|
||||
noise_part0
|
||||
UNION
|
||||
SELECT
|
||||
losmid,
|
||||
noise_factor
|
||||
FROM
|
||||
noise_part1
|
||||
UNION
|
||||
SELECT
|
||||
losmid,
|
||||
noise_factor
|
||||
FROM
|
||||
noise_part2
|
||||
UNION
|
||||
SELECT
|
||||
losmid,
|
||||
noise_factor
|
||||
FROM
|
||||
noise_part3
|
||||
UNION
|
||||
SELECT
|
||||
losmid,
|
||||
noise_factor
|
||||
FROM
|
||||
noise_part4
|
||||
UNION
|
||||
SELECT
|
||||
losmid,
|
||||
noise_factor
|
||||
FROM
|
||||
noise_part5) AS abcd
|
||||
GROUP BY
|
||||
losmid
|
||||
ORDER BY
|
||||
sum_noise_factor DESC;
|
||||
|
||||
SELECT
|
||||
now();
|
||||
|
||||
-- noise coming from airports
|
||||
SELECT
|
||||
name,
|
||||
@ -513,9 +759,10 @@ FROM (
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
-- and st_area(q.way) > 90746 !!! filter on very small surfaces was set above !!!!!!!!!
|
||||
AND q.natural IN ('water')
|
||||
AND q.natural IN ('water', 'bay', 'beach', 'wetland')
|
||||
AND (q.water IS NULL
|
||||
OR q.water NOT IN ('wastewater'))
|
||||
AND (st_area (ST_Transform (q.way, 4326)::geography) / 1000000) < 5000
|
||||
GROUP BY
|
||||
m.osm_id,
|
||||
m.way
|
||||
@ -525,10 +772,23 @@ FROM (
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / st_area (m.way) AS water_river_see
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_buf_50 AS q ON ST_Intersects (m.way, q.way)
|
||||
INNER JOIN osm_poly_coastline_buf_100 AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.waterway IN ('river', 'canal')
|
||||
-- and st_area(q.way) > 90746 !!! filter on very small surfaces was set above !!!!!!!!!
|
||||
GROUP BY
|
||||
m.osm_id,
|
||||
m.way
|
||||
UNION
|
||||
SELECT
|
||||
m.osm_id AS xid,
|
||||
st_area (st_intersection (m.way, ST_Union (q.way))) / st_area (m.way) AS water_river_see
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN osm_line_water AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND (st_area (ST_Transform (q.way, 4326)::geography) / 1000000) < 5000
|
||||
GROUP BY
|
||||
m.osm_id,
|
||||
m.way) AS abcd
|
||||
@ -637,7 +897,7 @@ SELECT
|
||||
now();
|
||||
|
||||
-- create "town" tags
|
||||
-- get the highways which intersect the town
|
||||
-- get the highways within the town
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway lhighway,
|
||||
@ -656,7 +916,8 @@ SELECT
|
||||
END AS town_factor INTO TABLE town_tmp
|
||||
FROM
|
||||
osm_line_buf_50 AS m
|
||||
INNER JOIN cities_all AS q ON ST_Intersects (m.way, q.way)
|
||||
--INNER JOIN cities_all AS q ON ST_Intersects(m.way, q.way)
|
||||
INNER JOIN cities_all AS q ON ST_Within (m.way, q.way)
|
||||
WHERE
|
||||
m.highway IS NOT NULL
|
||||
AND q.population > '50000'
|
||||
@ -788,6 +1049,13 @@ SELECT
|
||||
|
||||
-- prepare some special tables
|
||||
-- the intersections motorway_link with primary/secondary/tertiary deliver the motorway acccesses....
|
||||
SELECT
|
||||
* INTO TABLE lines_link
|
||||
FROM
|
||||
lines
|
||||
WHERE
|
||||
highway IN ('motorway_link', 'trunk_link');
|
||||
|
||||
SELECT
|
||||
m.osm_id losmid,
|
||||
m.highway,
|
||||
@ -797,10 +1065,9 @@ SELECT
|
||||
st_length (ST_Transform (m.way, 3857)) / st_length (ST_Transform (m.way, 4326)::geography) AS merca_coef INTO TABLE motorway_access
|
||||
FROM
|
||||
lines AS m
|
||||
INNER JOIN lines AS q ON ST_Intersects (m.way, q.way)
|
||||
INNER JOIN lines_link AS q ON ST_Intersects (m.way, q.way)
|
||||
WHERE
|
||||
q.highway IN ('motorway_link', 'trunk_link')
|
||||
AND m.highway IN ('primary', 'secondary', 'tertiary')
|
||||
m.highway IN ('primary', 'secondary', 'tertiary')
|
||||
GROUP BY
|
||||
m.osm_id,
|
||||
m.highway,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
-- special config to calcule pseudo-tags / "Brouter project"
|
||||
-- EssBee version 08/05/2023
|
||||
|
||||
local srid = 3857
|
||||
--local srid = 4326
|
||||
|
||||
|
||||
-- 3857 (projection) SHOULD BE USED here for distance calculation ... (not srid = 4326 !)
|
||||
@ -14,6 +16,7 @@ tables.lines = osm2pgsql.define_way_table('lines', {
|
||||
{ column = 'highway', type = 'text' },
|
||||
{ column = 'maxspeed', type = 'text' },
|
||||
{ column = 'waterway', type = 'text' },
|
||||
{ column = 'natural', type = 'text' },
|
||||
{ column = 'width', type = 'text' },
|
||||
{ column = 'way', type = 'linestring', projection = srid, not_null = true },
|
||||
})
|
||||
@ -130,15 +133,13 @@ function osm2pgsql.process_node(object)
|
||||
osm_id = object.id,
|
||||
way = object:as_point()
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function osm2pgsql.process_way(object)
|
||||
local way_type = object:grab_tag('type')
|
||||
|
||||
if ( object.tags.natural == 'water') or (object.tags.landuse ~= nil ) or (object.tags.leisure ~= nil ) then
|
||||
if (object.tags.natural == 'water') or ( object.tags.natural == 'bay') or ( object.tags.natural == 'beach') or ( object.tags.natural == 'coastline') or ( object.tags.natural == 'wetland') or ( object.tags.landuse ~= nil ) or (object.tags.leisure ~= nil ) then
|
||||
tables.polygons:insert({
|
||||
name = object.tags.name,
|
||||
osm_id = object.id,
|
||||
@ -156,12 +157,13 @@ function osm2pgsql.process_way(object)
|
||||
})
|
||||
end
|
||||
|
||||
if ( object.tags.highway ~= nil) or ( object.tags.waterway ~= nil) then
|
||||
if (object.tags.highway ~= nil) or ( object.tags.waterway ~= nil) or ( object.tags.natural == 'coastline') then
|
||||
tables.lines:insert({
|
||||
name = object.tags.name,
|
||||
osm_id = object.id,
|
||||
highway = object.tags.highway,
|
||||
waterway = object.tags.waterway,
|
||||
natural = object.tags.natural,
|
||||
width = object.tags.width,
|
||||
maxspeed = object.tags.maxspeed,
|
||||
way = object:as_linestring()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user