mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 19:27:49 +00:00
Update overpass_py_fn, improve geo location detection, first check against area, then find around with 400m
This commit is contained in:
@@ -442,7 +442,7 @@ CREATE OR REPLACE FUNCTION overpass_py_fn(IN lon NUMERIC, IN lat NUMERIC,
|
|||||||
AS $overpass_py$
|
AS $overpass_py$
|
||||||
"""
|
"""
|
||||||
Return https://overpass-turbo.eu seamark details within 400m
|
Return https://overpass-turbo.eu seamark details within 400m
|
||||||
https://overpass-turbo.eu/s/1D91
|
https://overpass-turbo.eu/s/1E9I
|
||||||
https://wiki.openstreetmap.org/wiki/Key:seamark:type
|
https://wiki.openstreetmap.org/wiki/Key:seamark:type
|
||||||
"""
|
"""
|
||||||
import requests
|
import requests
|
||||||
@@ -452,6 +452,12 @@ AS $overpass_py$
|
|||||||
headers = {'User-Agent': 'PostgSail', 'From': 'xbgmsharp@gmail.com'}
|
headers = {'User-Agent': 'PostgSail', 'From': 'xbgmsharp@gmail.com'}
|
||||||
payload = """
|
payload = """
|
||||||
[out:json][timeout:20];
|
[out:json][timeout:20];
|
||||||
|
is_in({0},{1})->.result_areas;
|
||||||
|
(
|
||||||
|
area.result_areas["seamark:type"~"(mooring|harbour)"][~"^seamark:.*:category$"~"."];
|
||||||
|
area.result_areas["leisure"="marina"];
|
||||||
|
);
|
||||||
|
out tags;
|
||||||
nwr(around:400.0,{0},{1})->.all;
|
nwr(around:400.0,{0},{1})->.all;
|
||||||
(
|
(
|
||||||
nwr.all["seamark:type"~"(mooring|harbour)"][~"^seamark:.*:category$"~"."];
|
nwr.all["seamark:type"~"(mooring|harbour)"][~"^seamark:.*:category$"~"."];
|
||||||
@@ -459,7 +465,7 @@ AS $overpass_py$
|
|||||||
nwr.all["leisure"="marina"];
|
nwr.all["leisure"="marina"];
|
||||||
nwr.all["natural"~"(bay|beach)"];
|
nwr.all["natural"~"(bay|beach)"];
|
||||||
);
|
);
|
||||||
out tags qt;
|
out tags;
|
||||||
""".format(lat, lon)
|
""".format(lat, lon)
|
||||||
data = urllib.parse.quote(payload, safe="");
|
data = urllib.parse.quote(payload, safe="");
|
||||||
url = f'https://overpass-api.de/api/interpreter?data={data}'.format(data)
|
url = f'https://overpass-api.de/api/interpreter?data={data}'.format(data)
|
||||||
|
Reference in New Issue
Block a user