[OSM-dev] Writing an OSM map application

Jon Burgess jburgess777 at googlemail.com
Fri Apr 13 12:29:21 BST 2007


On 12/04/07, Andreas Volz <lists at brachttal.net> wrote:
> Am Wed, 11 Apr 2007 23:39:41 +0100 schrieb Jon Burgess:
>
> > 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...
>
> Hm, I don't see the E-Mail in this thread.
>

http://lists.openstreetmap.org/pipermail/dev/2007-March/003852.html

> > 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 |
>
> Many thanks. Now I understood how to define a bounding box. I inserted
> it into my application. Now it works really great. My next step is to
> combine it with my gpsd code and show the bounding box and current
> GPS position while driving around. I think a first prototype should be
> not so hard.
>
> regards
> Andreas
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>




More information about the dev mailing list