| Version 2 (modified by , 13 years ago) ( diff ) |
|---|
OpenStreetMap
Table of Contents
Wikipedia of Maps
Base Map
We have out-of-the-box the ability to use OpenStreetMap Tiles as base layer.
This can include local OSM sites (OSM Taiwan is included as an example)
Vector Overlays
Can have OSM Vectors displayed over the top of other Base Layers (e.g. Satellite Images)
Import
We have an XSLT stylesheet to import .osm files
e.g for hospitals and clinics:
osmosis --read-xml country.osm --tf accept-nodes amenity=hospital,clinic --tf reject-ways --tf reject-relations --write-xml nodes.osm osmosis --read-xml country.osm --tf reject-relations --tf accept-ways amenity=hospital,clinic --used-node --write-xml ways.osm osmosis --rx nodes.osm --rx ways.osm --merge --wx country_hospitals.osm http://myhost.com/eden/hms/hospital/create.osm?filename=country_hospitals.osm
This needs more work to understand the admin hierarchy properly to be able to import Places.
- http://wiki.openstreetmap.org/wiki/Map_Features#Places
- http://wiki.openstreetmap.org/wiki/Placename_hierachies is_in tag
Geofabrik have updated extracts daily for Pakistan:
Otherwise pull a BBOX directly using Osmosis:
Osmosis requires Java. Python options for filtering based on tag, which would be more suitable for integration within Sahana, however we need to add Polygon filtering using Shapely:
Ruby script to generate KML of recently-added locations by a group of users:
Polygons:
Basemap for Garmin GPS
Mirror
How to set up a local mirror for Africa with selected Feature types, suitable for use by Import PoI:
apt-get install -y postgresql-8.4-postgis postgresql-contrib
mkdir -p /home/osm/planet/replication
cd /home/osm
wget http://dev.openstreetmap.org/~bretth/osmosis-build/osmosis-latest.tgz
tar zxvf osmosis-latest.tgz
ln -sf /home/osm/osmosis-0.41 /home/osm/osmosis
chown -R postgres /home/osm
su postgres
psql
CREATE USER osm WITH PASSWORD 'planet';
\q
createdb -O osm -E UTF8 osm -T template0
createlang plpgsql -d osm
psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
psql -d osm -f /usr/share/postgresql/8.4/contrib/hstore.sql
psql -d osm -f /home/osm/osmosis/script/pgsnapshot_schema_0.6.sql
psql
\c osm
ALTER TABLE geography_columns OWNER TO osm;
ALTER TABLE geometry_columns OWNER TO osm;
ALTER TABLE nodes OWNER TO osm;
ALTER TABLE relation_members OWNER TO osm;
ALTER TABLE relations OWNER TO osm;
ALTER TABLE schema_info OWNER TO osm;
ALTER TABLE spatial_ref_sys OWNER TO osm;
ALTER TABLE users OWNER TO osm;
ALTER TABLE way_nodes OWNER TO osm;
ALTER TABLE ways OWNER TO osm;
\q
exit
cd /home/osm/planet
wget http://download.geofabrik.de/openstreetmap/africa.osm.pbf
/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/africa.osm.pbf --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --write-pbf /home/osm/planet/eurosha.osm.pbf
su postgres
/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/eurosha.osm.pbf --write-pgsql database=osm user=osm password=planet
cd /home/osm/planet/replication
/home/osm/osmosis/bin/osmosis --rrii
sudo -H -u postgres psql -d osm -c "select max(tstamp) from nodes";
http://toolserver.org/~mazder/replicate-sequences/
Put timestamp into site, select hourly
vim state.txt
# paste in contents from website
vim configuration.txt
baseUrl=http://planet.openstreetmap.org/replication/hour
/home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/eurosha.osm.pbf --ac --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --tf reject-relations --write-pbf /home/osm/planet/eurosha-new.osm.pbf
/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/eurosha-new.osm.pbf --read-pbf /home/osm/planet/eurosha.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
mv /home/osm/planet/eurosha-new.osm.pbf /home/osm/planet/eurosha.osm.pbf
vim /home/osm/replicate.sh
#!/bin/sh
n=`ps -ef | grep -v grep | grep /home/osm/osmosis/ | wc -l`
if [ $n -le 0 ]
then
if [ -s /home/osm/planet/eurosha-new.osm.pbf ]
then
mv /home/osm/planet/eurosha-new.osm.pbf /home/osm/planet/eurosha.osm.pbf
fi
/home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/eurosha.osm.pbf --ac --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --tf reject-relations --write-pbf /home/osm/planet/eurosha-new.osm.pbf
/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/eurosha-new.osm.pbf --read-pbf /home/osm/planet/eurosha.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
mv /home/osm/planet/eurosha-new.osm.pbf /home/osm/planet/eurosha.osm.pbf
fi
chmod 0755 /home/osm/replicate.sh
vim /etc/crontab
1 * * * * root /home/osm/replicate.sh
Monitor:
su postgres psql -d osm -c "select max(tstamp) from nodes";
Attachments (1)
-
chiwogs.py
(2.3 KB
) - added by 4 years ago.
Script to export Bhutan L3s from OSM
Download all attachments as: .zip

