[OSM-dev] Writing an OSM map application
jburgess777 at googlemail.com
Fri Mar 23 22:43:42 GMT 2007
On Fri, 2007-03-23 at 22:03 +0000, Nick Whitelegg wrote:
> On Friday 23 Mar 2007 21:54, you wrote:
> > On Fri, 2007-03-23 at 21:07 +0000, Nick Whitelegg wrote:
> > > On Friday 23 Mar 2007 20:09, Jon Burgess wrote:
> > > > On Fri, 2007-03-23 at 20:26 +0100, Andreas Volz wrote:
> > > > > - Are there any libraries (C/C++) which give me a higher level of
> > > > > abstraction on the map data then operating with SQL queries?
> > > >
> > > > I don't think there are any C/C++ libraries specifically for processing
> > > > OSM data directly although you could extract the relevant pieces from
> > > > several existing utilities like mapnik (C++) or osm2pgsql (C) and then
> > > > build upon these.
> > >
> > > There is libosm which is in SVN. It's a C++ library which contains
> > > functionality for reading .osm files, also for fetching live OSM data
> > > from the internet.
> > >
> > > See utils/libosm in SVN. Ask me if you need any help with it.
> > > Note it's still early in development and might have the odd bug or two...
> > libs/libosm ?
> > Jon
> yes - sorry.
A couple of points. I have patches for some of these, let me know if you
want me to apply them to SVN.
- The test2 targets in Makefile is missing dependencies on libosmnet.a
- Perhaps add "-L../ccoord/" to pick up compile from other dir instead
on relying on installed version (could even add this as a dependency and
get it built automatically, but i've not implemented this).
- When printing nodes you only get the default 6 significant digits
which loses some accuracy, e.g.
Input: <node id="237430" lat="51.0497120481462" lon="-0.721973106832593" visible="true" timestamp="2005-11-07 18:08:04"/>
Output: <node id='237430' lat='51.0497' lon='-0.721973'>
- Could output self-closing XML tag when an element has no sub tags.
i.e. <node id='237430' lat='51.0497' lon='-0.721973'/>
- Maybe could consider "pretty printing" the XML output, i.e. adding
spaces to make the XML hierarchy more obvious (like xmllint)
- I've written a trivial test3 which just take a .osm file in and writes
it out again using toXML().
- When outputting XML you need to escape some characters in key/values.
Like the Perl below from utils/perl/Geo/OSM/Write.pm. I have an
example .osm test file to test this.
# character escaping as per http://www.w3.org/TR/REC-xml/
$v =~ s/&/&/g;
$v =~ s/\'/'/g;
$v =~ s/</</g;
$v =~ s/>/>/g;
$v =~ s/\"/"/g;
Or maybe we should move over to a formal XML generator which does all
this for us.
That is enough for now :-)
More information about the dev