Shape failai gaunami iš OSM duomenų bazės tokiomis komandomis:
#!/bin/bash echo Visa Lietuva # polygons export PGCLIENTENCODING=UTF8 pgsql2shp -f vanduo_p gis "select osm_id, \"natural\", wetland, landuse, waterway, name, \"ref:lt:old_code\", \"ref:lt:code\", st_transform(way, 4326) as way from planet_osm_polygon where \"natural\" in ('water', 'wetland') or landuse in ('reservoir', 'basin') or waterway in ('riverbank')" pgsql2shp -f zeme gis "select osm_id, landuse, \"natural\", name, st_transform(way, 4326) as way from planet_osm_polygon where landuse in ('forest', 'meadow', 'residential', 'commercial', 'industrial', 'allotments', 'grass', 'cemetery', 'construction', 'military') or \"natural\" in ('beach', 'scrub')" pgsql2shp -f laisva gis "select osm_id, leisure, name, st_transform(way, 4326) as way from planet_osm_polygon where leisure in ('stadium', 'pitch', 'park')" pgsql2shp -f pastatai gis "select osm_id, building, st_transform(way, 4326) as way from planet_osm_polygon where building is not null" pgsql2shp -f admin_ribos gis "select osm_id, name, admin_level, st_transform(way, 4326) as way from planet_osm_polygon where admin_level is not null" # ways pgsql2shp -f keliai gis "select osm_id, highway, name, st_transform(way, 4326) as way from planet_osm_line where highway is not null" pgsql2shp -f gelzkelis gis "select osm_id, railway, name, service, st_transform(way, 4326) as way from planet_osm_line where railway is not null" pgsql2shp -f vanduo_v gis "select osm_id, waterway, name, st_transform(way, 4326) as way from planet_osm_line where waterway is not null" # nodes pgsql2shp -f gyvenvietes gis "select osm_id, place, name, population, st_transform(way, 4326) as way from planet_osm_point where place is not null and place not in ('country', 'region', 'island', 'neighbourhood', 'municipality')" pgsql2shp -f stoteles gis "select osm_id, name, st_transform(way, 4326) as way from planet_osm_point where highway='bus_stop'" pgsql2shp -f taskai gis "select osm_id, name, amenity, operator, shop, st_transform(way, 4326) as way from planet_osm_point where amenity in ('pub', 'cafe', 'restaurant', 'bicycle_rental', 'bicycle_parking') or shop = 'bicycle' union all select osm_id, name, amenity, operator, shop, st_transform(st_centroid(way), 4326) as way from planet_osm_polygon where amenity in ('pub', 'cafe', 'restaurant', 'bicycle_rental', 'bicycle_parking') or shop = 'bicycle'"
Adresų informacija traukiama tokiomis komandomis:
export PGCLIENTENCODING=UTF8 echo ======= echo Adresai echo ======= query=$(cat >>EOF select a.gyvenviete ,a.gatve ,a.numeris ,st_transform(st_centroid(st_collect(a.way)), 4326) way from (select "addr:city" gyvenviete ,"addr:street" gatve ,"addr:housenumber" numeris ,way way from planet_osm_point where "addr:city" is not null and "addr:housenumber" is not null and ("addr:street" is not null or "addr:nostreet" = 'yes') union all select "addr:city" gyvenviete ,"addr:street" gatve ,"addr:housenumber" numeris ,st_centroid(way) way from planet_osm_polygon where "addr:city" is not null and "addr:housenumber" is not null and ("addr:street" is not null or "addr:nostreet" = 'yes') ) a group by a.gyvenviete, a.gatve, a.numeris EOF ) pgsql2shp -f adresai gis "$query" printf "$(printf '\\x%02X' 00)" | dd of="adresai.dbf" bs=1 seek=29 count=1 conv=notrunc &> /dev/null