Geographic Information Systems Asked by Romeo Petruca on February 16, 2021
I have a problem.
Imported OSM in SQLite using spatialite_osm_map
Samples query
$select id,name,min(st_distance(geometry,st_point(22.908082,45.763242),0)) from roads limit 1;
564|Strada Muntenia|26.944248068482
Is ok, is my street
select id,name,min(st_distance(geometry,st_point(22.908082,45.763242),0)) from roads limit 1;
564|Strada Muntenia|26.944248068482
Same is ok, is my street again
select id,sub_type,name,min(st_distance(geometry,st_point(22.908082,45.763242),0)) from pg_building limit 1;
33042016|yes|Bloc D2|6.50190449190996
Is ok, my address is “Strada Muntenia Bloc D2”
I want to get the rest of data for my address, my city is Hunedoara
select id,country,city,postcode,street,housename,housenumber from pt_addresses where city like 'Hun%';
NULL
?!?!, no city Hunedoara in pt_addreses ??!?!
select id,country,city,postcode,street,housename,housenumber from pt_addresses where housename like '%D2%' or housenumber like '2A%' limit 1;
701843031|RO|Deva|330051|Aleea Militarilor||2a
Something, but wrong city and street.
I must understand Hunedoara is missing from pt_addresses ?
Solved,
curl https://download.geofabrik.de/europe/romania-latest.osm.bz2 --output romania-latest.osm.bz2 bzcat romania-latest.osm.bz2 | bin/osmosis --read-xml enableDateParsing=no file=- --bounding-box top=46.104185 left=22.744446 bottom=45.500572 right=24.245453 --write-xml file=- | bzip2 > hunedoara.osm.bz2
spatialite_osm_raw -o hunedoara.osm -d hunedoara.sqlite spatialite_osm_map -o hunedoara.osm -d hunedoara.sqlite spatialite_osm_net -o hunedoara.osm -d hunedoara.sqlite -T roads -m spatialite_network -d hunedoara.sqlite -T roads -g geometry -c cost -t node_to -f node_from -n name --oneway-fromto oneway_fromto --oneway-tofrom oneway_tofrom -o roads_net_data --overwrite-output spatialite hunedoara.sqlite 'CREATE VIRTUAL TABLE "roads_net" USING VirtualNetwork("roads_net_data")'
And now database is complete. SELECT way_id, sub, k, v FROM osm_way_tags AS ways_ref WHERE ( ways_ref.way_id IN (33042016) );
33042016 0 name Bloc D2 33042016 1 source Hunedoara Town Hall map 33042016 2 building yes 33042016 3 addr:street Strada Muntenia 33042016 4 addr:housename D2 33042016 5 addr:housenumber 2A
Answered by Romeo Petruca on February 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP