Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fruminator/openstreetblock
Simple web service for turning a lat/lon into a block name (e.g. "5th avenue between president st and union st") using OpenStreetMap data
https://github.com/fruminator/openstreetblock
Last synced: 11 days ago
JSON representation
Simple web service for turning a lat/lon into a block name (e.g. "5th avenue between president st and union st") using OpenStreetMap data
- Host: GitHub
- URL: https://github.com/fruminator/openstreetblock
- Owner: fruminator
- License: other
- Created: 2011-03-19T20:22:12.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-05-01T23:48:50.000Z (over 13 years ago)
- Last Synced: 2024-08-02T14:10:50.901Z (4 months ago)
- Language: PHP
- Homepage: http://transit.frumin.net/openstreetblock
- Size: 2.47 MB
- Stars: 56
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
OpenStreetBlock is a simple web service for turning a lat/lon into a block name using OpenStreetMap data.
http://github.com/fruminator/openstreetblock
http://transit.frumin.net/openstreetblockDEPENDENCIES
-----------------------------------------------------------------------------
OpenStreetBlock depends on:
* PostgreSQL
* PostGIS
* Apache
* PHP
* Osmosis
* osm2pgsql
* git (to get the code)FGI my friend
Why PHP? Errr, well, ummm, hey, what's that over there?
INSTALLATION
-----------------------------------------------------------------------------
1. Install all the above dependencies
2. Get the code (for read-only download: "git clone git://github.com/fruminator/openstreetblock.git")
3. In the openstreetblock directory, mv conf.inc.php.default to conf.inc.php
4. Edit conf.inc.php to reflect your local configuration parameters (especially, your database connection)
5. Get, process, and load OpenStreetMap data as described below
6. Send requests to the osb.php script, as described in index.phpOPENSTREETMAP DATA
-----------------------------------------------------------------------------
1. Get some OpenStreetMap data in raw XML format (i.e. a .osm file).
Easiest way is to:
- Go to http://www.openstreetmap.org/
- Navigate to a pan/zoom for which you want data
- Click the "Export" tab
- Select the OpenStreetMap XML Data option
- Hit "Export"
- When this fails, because you have chosen too large a bounding box, copy the bbox=BBOX out of the resulting URL
- Use this bounding box to request bulk OSM data:
wget --timeout=SOME_LARGE_VALUE -O MY_FILE.osm "http://www.informationfreeway.org/api/0.6/map?bbox=BBOX
- Keep trying this until it eventually works...A reasonable BBOX for New York City (less Staten Island) could be:
-74.054,40.54,-73.709,40.92"So the request could be executed with:
wget --timeout=3600 -O nyc.osm "http://www.informationfreeway.org/api/0.6/map?bbox=-74.054,40.54,-73.709,40.92"2. Create a PostGIS-enabled database in your PostgreSQL instance.
Assume henceforth that this database was named 'osb'3. Use osm2pgsql to load the .osm file into PSQL:
osm2pgsql -d osb -l -s -p osm MY_FILE.osm
(may also need flags for host, username, password, etc)from this we will use only the following tables:
osm_line
osm_ways4. Use osmosis to load the .osm file into PSQL another way:
Create the schema osmosis looks for (to do this will require the 'hstore' psql module):
cat /usr/share/doc/osmosis/examples/pgsql_simple_schema_0.6.sql | psql osb
cat /usr/share/doc/osmosis/examples/pgsql_simple_schema_0.6_linestring.sql | psql osb
cat /usr/share/doc/osmosis/examples/pgsql_simple_schema_0.6_bbox.sql | psql osbThen import using osmosis:
osmosis --read-xml MY_FILE.osm --write-pgsql database=osb host=HOST user=USER
(likewise for more DB flags. Note, osmosis has no flag for DB port)From this we will use only:
nodes
way_nodes5. You probably want to VACUUM ANALYZE the whole thing after importing.