[OSM-talk] Street/POI Index from OSM data
Alex Rollin
alex.rollin at gmail.com
Thu Aug 22 10:56:24 UTC 2013
Hi Jukka!
Thank you for the detailed instructions!
it took me a whole year to get this installed.
are you still doing mapping?
i wrote a number of scripts to parse pbf files for our charity maps for
indonesia. they are not very efficient.
On Sat, Sep 29, 2012 at 12:37 AM, Jukka Rahkonen <
jukka.rahkonen at latuviitta.fi> wrote:
> Alex Rollin <alex.rollin <at> gmail.com> writes:
>
> >
> >
> > Hello,
> >
> >
> > I am rather new to OSM data. I've enjoyed doing edits on the map and
> now I'd
> like to start learning how to arrange it on a printed page.
> >
> > I know there are lots and lots of tools out there.
> >
> >
> > Could I receive a few recommendations for getting some text data out?
> >
> > I was thinking I might need to use Osmosis. Some pointers would be
> very helpful.
> >
> >
> >
> > I would like to:
>
> Select a bounding box (I can produce lat/lon)
> Get a list of street names'
> Output a CSV file (or other text file)
>
> Select a bounding box (I can produce lat/lon)
> Get a list of POIs
>
> Output a CSV file (or other text file)
>
> For these I would also like to be able to get any other attributes/
> keys like
> description text or other things.
>
> > Thank you to each of you for all the work you do!
>
> Hi,
>
> Sorry for a bit delayed answer but GDAL/OGR OSM driver developer had
> to do a couple of fixes for making this task to perform well.
>
> So you can do all that with GDAL OSM driver and SQL query language. Output
> can be despite CSV any other format that is supported by GDAL/OGR for
> writing.
> http://www.gdal.org/ogr/drv_osm.html
> http://www.gdal.org/ogr/ogr_formats.html
>
> Install a very fresh GDAL development version, about rev. 24970 or higher.
> For Windows you can get it from gisinternals
> http://www.gisinternals.com/sdk/
>
> You want to query streetname from osm lines and name and probably some
> other
> attributes from osm points and from a limited area. It is possible but
> quite
> slow to create such CSV file directly from OSM data file that can be in
> osm-xml or pbf format with following command
>
> ogr2ogr -f CSV streets.csv finland.osm.pbf -sql "select distinct
> name from lines where highway is not null order by name"
> -spat 24.821 60.123 25.259 60.317
>
> However, it is faster, especially if you want to do more queries,
> to convert OSM data first into Spatialite database. Here is a quite
> optimised command to use as a template
>
> ogr2ogr -f SQLite -dsco spatialite=yes finland.sqlite finland.osm.pbf
> --config SQLITE_SYNCHRONOUS OFF --config OSM_COMPRESS_NODES YES
> -progress
>
> This conversion takes a few minutes with 130 MB finland.osm.pbf file.
> Then you can repeat the first streetname search and it will be pretty fast
>
> ogr2ogr -f CSV streets.csv finland.sqlite -sql "select distinct name
> from lines where highway is not null order by name"
> -spat 24.821 60.123 25.259 60.317
>
> The poi file can be created in a similar way. Let's say you want to
> get all the amenities and names for those. The command is
>
> ogr2ogr -f CSV poi.csv finland.sqlite -sql "select name, amenity
> from points where amenity is not null order by amenity"
> -spat 24.821 60.123 25.259 60.317
>
> Note 1. Read the OSM driver manual page. The second command does not
> work before editing the defauld osmconf.ini file so that "amenity"
> is included in the points layer attributes.
>
> Note 2. There is a little bug in ogr2ogr CSV driver that may prevent
> creating a new csv file if there is already another CSV file with an
> uncommon structure in the same directory. The one-column CSV file that
> was created in the first example has such a structure. Delete the file
> or rename it with another extension before running the second example.
>
> Regards,
>
> -Jukka Rahkonen-
>
>
>
>
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20130822/51c98d20/attachment-0001.html>
More information about the talk
mailing list