kopia lustrzana https://github.com/anitagraser/ogd-at-lab
Cleanup
rodzic
eabb98b0cb
commit
ffc0125d8c
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="970"
|
||||
height="240"
|
||||
viewBox="0 0 970.00001 240"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="ogdatlab.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.7"
|
||||
inkscape:cx="500.03524"
|
||||
inkscape:cy="-28.517649"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-width="1311"
|
||||
inkscape:window-height="1175"
|
||||
inkscape:window-x="1051"
|
||||
inkscape:window-y="98"
|
||||
inkscape:window-maximized="0">
|
||||
<sodipodi:guide
|
||||
position="435.71429,127.14286"
|
||||
orientation="0,1"
|
||||
id="guide4443" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-812.36214)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:2.5999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
x="484.28574"
|
||||
y="993.79071"
|
||||
id="text4144"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4146"
|
||||
x="484.28574"
|
||||
y="993.79071"
|
||||
style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:180px;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Heavy';fill:#d40000;stroke:none;stroke-width:2.5999999;stroke-miterlimit:4;stroke-dasharray:none">OG<tspan
|
||||
style="letter-spacing:-25px"
|
||||
id="tspan4191">D</tspan><tspan
|
||||
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:90px;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';fill:#999999;stroke:none"
|
||||
id="tspan4159">.<tspan
|
||||
style="-inkscape-font-specification:'Source Sans Pro';font-family:'Source Sans Pro';font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:102.5px"
|
||||
id="tspan4441">AT</tspan></tspan><tspan
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:168.75px;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Bold';fill:#999999;stroke:none"
|
||||
id="tspan4163"> Lab</tspan></tspan></text>
|
||||
</g>
|
||||
</svg>
|
Po Szerokość: | Wysokość: | Rozmiar: 3.4 KiB |
|
@ -23,8 +23,7 @@
|
|||
"source": [
|
||||
"import hvplot.pandas\n",
|
||||
"from geopy.geocoders import Nominatim\n",
|
||||
"from utils.ogc_io import gdf_from_wfs\n",
|
||||
"from utils.plotting import hvplot_with_buffer\n",
|
||||
"from utils.dataaccess import get_elevation\n",
|
||||
"from utils.converting import location_to_gdf"
|
||||
]
|
||||
},
|
||||
|
@ -35,7 +34,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"address = \"Stephansdom, Wien\"\n",
|
||||
"locator = Nominatim(user_agent=\"myGeocoder\")\n",
|
||||
"locator = Nominatim(user_agent=\"OGD.AT-Lab\")\n",
|
||||
"location = locator.geocode(address)\n",
|
||||
"print(location.address)\n",
|
||||
"print(\"Latitude = {}, Longitude = {}\".format(location.latitude, location.longitude))\n",
|
||||
|
@ -59,51 +58,6 @@
|
|||
"gdf"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"jupyter": {
|
||||
"source_hidden": true
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from os.path import exists\n",
|
||||
"from urllib.request import urlretrieve\n",
|
||||
"\n",
|
||||
"def get_elevation(point):\n",
|
||||
" \"\"\"\n",
|
||||
" Retrieve elevation info from the Austrian Elevation Service\n",
|
||||
" \n",
|
||||
" Implementation based on https://github.com/maegger/AustrianElevation/blob/6e0f468b6094caace6cd35f00704e4087e851cec/tree/AustrianElevation/AustrianElevation.py#L97\n",
|
||||
" \n",
|
||||
" Parameters\n",
|
||||
" ----------\n",
|
||||
" point : Shapely Point\n",
|
||||
" Point in EPSG:3857 \n",
|
||||
" \"\"\"\n",
|
||||
" x = point.x\n",
|
||||
" y = point.y\n",
|
||||
" mod_x_path = x % 20000;\n",
|
||||
" path_x = x - mod_x_path;\n",
|
||||
" database = int(path_x );\n",
|
||||
" mod_y = y % 10;\n",
|
||||
" raster_y = y - mod_y;\n",
|
||||
" mod_x = x % 10;\n",
|
||||
" raster_x = int(x - mod_x);\n",
|
||||
" file = f'{int(raster_y)}.txt'\n",
|
||||
" url = f\"https://raw.githubusercontent.com/maegger/{database}/master/{int(raster_y)}.txt\"\n",
|
||||
" if not exists(file):\n",
|
||||
" urlretrieve(url, file)\n",
|
||||
" data = open(file, 'r')\n",
|
||||
" for line in data:\n",
|
||||
" x_wert = int(line.split(' ', 1 )[0])\n",
|
||||
" if x_wert == raster_x:\n",
|
||||
" elevationall = line.split(' ', 1 )[1]\n",
|
||||
" return int(elevationall)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
@ -111,7 +65,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"gdf.loc[0, 'elevation'] = get_elevation(gdf.iloc[0].geometry)\n",
|
||||
"gdf"
|
||||
"gdf.to_crs('epsg:4326')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"source": [
|
||||
"import hvplot.pandas\n",
|
||||
"from geopy.geocoders import Nominatim\n",
|
||||
"from utils.ogc_io import gdf_from_wfs\n",
|
||||
"from utils.dataaccess import gdf_from_wfs\n",
|
||||
"from utils.plotting import hvplot_with_buffer\n",
|
||||
"from utils.converting import location_to_gdf"
|
||||
]
|
||||
|
@ -39,7 +39,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"locator = Nominatim(user_agent=\"myGeocoder\")\n",
|
||||
"locator = Nominatim(user_agent=\"OGD.AT-Lab\")\n",
|
||||
"location = locator.geocode(address)"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
from os.path import exists
|
||||
from urllib.request import urlretrieve
|
||||
import geopandas as gpd
|
||||
|
||||
def gdf_from_wfs(layer):
|
||||
"""
|
||||
Get GeoPandas GeoDataFrame from data.wien.gv.at WFS service based on layer name
|
||||
|
||||
Parameters
|
||||
----------
|
||||
layer : string
|
||||
WFS layer name
|
||||
"""
|
||||
file = f'{layer}.json'
|
||||
url = f"https://data.wien.gv.at/daten/geo?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:{layer}&srsName=EPSG:4326&outputFormat=json"
|
||||
if not exists(file):
|
||||
urlretrieve(url, file)
|
||||
return gpd.read_file(file)
|
||||
|
||||
def get_elevation(point):
|
||||
"""
|
||||
Retrieve elevation info from the Austrian Elevation Service
|
||||
|
||||
Implementation based on https://github.com/maegger/AustrianElevation/blob/6e0f468b6094caace6cd35f00704e4087e851cec/tree/AustrianElevation/AustrianElevation.py#L97
|
||||
|
||||
Parameters
|
||||
----------
|
||||
point : Shapely Point
|
||||
Point in EPSG:3857
|
||||
"""
|
||||
x = point.x
|
||||
y = point.y
|
||||
mod_x_path = x % 20000;
|
||||
path_x = x - mod_x_path;
|
||||
database = int(path_x );
|
||||
mod_y = y % 10;
|
||||
raster_y = y - mod_y;
|
||||
mod_x = x % 10;
|
||||
raster_x = int(x - mod_x);
|
||||
file = f'{int(raster_y)}.txt'
|
||||
url = f"https://raw.githubusercontent.com/maegger/{database}/master/{int(raster_y)}.txt"
|
||||
if not exists(file):
|
||||
urlretrieve(url, file)
|
||||
data = open(file, 'r')
|
||||
for line in data:
|
||||
x_wert = int(line.split(' ', 1 )[0])
|
||||
if x_wert == raster_x:
|
||||
elevationall = line.split(' ', 1 )[1]
|
||||
return int(elevationall)
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
from os.path import exists
|
||||
from urllib.request import urlretrieve
|
||||
import geopandas as gpd
|
||||
|
||||
def gdf_from_wfs(layer):
|
||||
"""
|
||||
Get GeoPandas GeoDataFrame from data.wien.gv.at WFS service based on layer name
|
||||
|
||||
Parameters
|
||||
----------
|
||||
layer : string
|
||||
WFS layer name
|
||||
"""
|
||||
file = f'{layer}.json'
|
||||
url = f"https://data.wien.gv.at/daten/geo?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:{layer}&srsName=EPSG:4326&outputFormat=json"
|
||||
if not exists(file):
|
||||
urlretrieve(url, file)
|
||||
return gpd.read_file(file)
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"import hvplot.pandas\n",
|
||||
"from utils.ogc_io import gdf_from_wfs\n",
|
||||
"from utils.dataaccess import gdf_from_wfs\n",
|
||||
"from utils.plotting import hvplot_with_buffer"
|
||||
]
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue