[OSM-dev] Writing an OSM map application
Jon Burgess
jburgess777 at googlemail.com
Wed Apr 11 23:39:41 BST 2007
On Thu, 2007-04-12 at 00:11 +0200, Andreas Volz wrote:
> Am Thu, 29 Mar 2007 17:40:57 +0000 (UTC) schrieb Martin Spott:
>
> > Andreas Volz wrote:
> >
> > > I got all working and could search in the database with psql. It's
> > > really eays to understand simple searches. But do you've some docs
> > > about the database scheme or example queries? There're three tables
> > > which are in some way linked. But without documentation the complex
> > > searches aren't so easy.
> >
> > The structure of the 'osm2pgsql'-generated tables is written in the
> > head of the respective SQL dump, which you are actually using.
> >
> > In fact, the structure is pretty simple, just look at the "create
> > table" statements. With basic knowledge of SQL you should easily
> > figure how to retrieve the information you are looking for.
> >
> > > How could I get e.g. all highways in a given bounding box?
> >
> > http://postgis.refractions.net/documentation/
>
> Quote from docs:
>
> > Boundary(geometry)
> >
> > Returns the closure of the combinatorial boundary of this
> > Geometry. The combinatorial boundary is defined as described in
> > section 3.12.3.2 of the OGC SPEC. Because the result of this function
> > is a closure, and hence topologically closed, the resulting boundary
> > can be represented using representational geometry primitives as
> > discussed in the OGC SPEC, section 3.12.2.
> >
> > Performed by the GEOS module
> >
> > OGC SPEC s2.1.1.1
>
> There're a lot of specs at OGC, but I'm not able to find the correct
> spec with section 3.12.2.
>
> So any ideas where to find this spec? Or any hints how practicaly
> define a combinatorial boundary? I tried a polygon, but that doesn't
> work.
>
I don't know the OGC docs.
Did you see the email I wrote earlier in this thread? I included the
following example which works for me...
The 'way' column contains the geo info and is the one which you need to
use in your WHERE clause. e.g.
gis=> select osm_id,highway,name from planet_osm_line where highway is
not null and way && GeomFromText('POLYGON((0 52, 0.1 52, 0.1 52.1, 0
52.1, 0 52))',4326);
osm_id | highway | name
---------+--------------+------------------
4273848 | unclassified |
3977133 | trunk | to Royston (tbc)
4004841 | trunk |
4019198 | trunk |
4019199 | trunk |
4238966 | unclassified |
See the Postgis docs for details, e.g.
http://postgis.refractions.net/docs/ch04.html#id2764520
Jon
More information about the dev
mailing list