[OSM-dev] adding custom symbology into the map generation process?
Hi, I'm trying to get my own custom mapnik symbology rules into the open street map map generation process. By the map generation process, I mean what is described here: http://wiki.openstreetmap.org/wiki/Mapnik basically what I'm aiming for: - import the planet.osm file into a pgsql database, using osm2pgsql - import my custom .osm file on top of that, into the same pgsql database, using osm2pgsql - run generate_xml.py to generate an osm.xml, that would include the 'usual' symbology rules, and also my own symbology rules - run generate_tiles.py to generate tiles, which would show both the 'usual' open street map content, and also mine on top of that, on the same set of tiles. for all this, I already have my .osm file that describes my content, and also my mapnik XML file, that describes the mapnik symbology needed for the rendering. (I can provide samples of these in case) my content uses a custom tag k=.../ tag to identify the type of content I create (for now, these are polygons). the mapnik symbology rules filter on this tag for rendering. but I wonder, is there anything special to be done to import my custom .osm file into a pgsql database, and then how would my rendering rules by taken into account when generate_xml.py is run? all pointers are welcome, Akos ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] adding custom symbology into the map generation process?
Peter, To import your own .osm file you'll need osm2pgsql in append mode (specify --append on the command line). I tried, and it seems some data is left out of the import. this is the osm XML file I have: ?xml version='1.0' encoding='UTF-8'? osm version='0.6' node id=-6 lat=47.934167 lon=18.831667/ node id=-5 lat=47.883889 lon=18.765/ node id=-4 lat=47.8675 lon=18.865/ node id=-3 lat=47.884167 lon=18.931667/ node id=-2 lat=47.934167 lon=18.898333/ node id=-1 lat=47.934167 lon=18.831667/ way id=-7 visible=true nd ref=-1/ nd ref=-2/ nd ref=-3/ nd ref=-4/ nd ref=-5/ nd ref=-6/ nd ref=-1/ tag k=name v=LHD34/ tag k=area v=yes/ tag k=aviation_area v=danger/ /way /osm and this is what I have in the gis database after doing osm2pgsql: # select * from planet_osm_ways where id = -7; id | nodes | tags | pending ++---+- -7 | {-1,-2,-3,-4,-5,-6,-1} | {area,yes,name,LHD34} | f (1 row) thus, it seems my custom tag of aviation_area=danger is omitted in the import. To add your own rendering rules, look at the osm.xml after running generate_xml.py. It includes a whole set of other styles (located in the inc/ directory). You can include your own styles that way, too (or, if you're in a hurry, just copy'n'past your own styles into osm.xml). I'm looking at the osm.xml file, and it seems that each layer has an elaborate Datasource.../Datasource definition, with queries on the planet_osm_roads, _polygon, etc. tables, which seem to have special columns, seemengly created out of the key-value pairs of the imported data. but here again, my custom key is not listed there. is there something special I have to do for the process to take my custom tag into account? Akos ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] adding custom symbology into the map generation process?
Am 18.08.2010 15:48, schrieb Ákos Maróy: thus, it seems my custom tag of aviation_area=danger is omitted in the import. First, there's in normal use cases no need to query planet_osm_ways, planet_osm_nodes and planet_osm_rels -- they're for internal use by osm2pgsql's slim mode. Use planet_osm_line, planet_osm_polygon and planet_osm_point, these are the tables that the mapnik style uses. Next, osm2pgsql will throw any tags away that aren't listed in the style file. The default style file looks like [1]. For your case it would be the easiest way to add the columns needed for your style to this file and specify it on the osm2pgsql command line. To add your own rendering rules, look at the osm.xml after running generate_xml.py. It includes a whole set of other styles (located in the inc/ directory). You can include your own styles that way, too (or, if you're in a hurry, just copy'n'past your own styles into osm.xml). I'm looking at the osm.xml file, and it seems that each layer has an elaborateDatasource.../Datasource definition, with queries on the planet_osm_roads, _polygon, etc. tables, which seem to have special columns, seemengly created out of the key-value pairs of the imported data. but here again, my custom key is not listed there. See above. is there something special I have to do for the process to take my custom tag into account? Yes, see above. Peter [1] http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/default.style ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] adding custom symbology into the map generation process?
It sounds like your problem was with the osm2pgsql style, as someone else has said. One other thing to watch is that there are a couple of tags excluded by osm2pgsql even if they are in the style file. From memory I think they are source= and note=. That caught me out a couple of weeks ago when I was rendering based on the source tag - had to modify the osm2pgsql code to get it to work. Graham On Aug 18, 2010 4:52 PM, Peter Körner osm-li...@mazdermind.de wrote: Am 18.08.2010 15:48, schrieb Ákos Maróy: thus, it seems my custom tag of aviation_area=danger is omitted in the import. First, there's in normal use cases no need to query planet_osm_ways, planet_osm_nodes and planet_osm_rels -- they're for internal use by osm2pgsql's slim mode. Use planet_osm_line, planet_osm_polygon and planet_osm_point, these are the tables that the mapnik style uses. Next, osm2pgsql will throw any tags away that aren't listed in the style file. The default style file looks like [1]. For your case it would be the easiest way to add the columns needed for your style to this file and specify it on the osm2pgsql command line. To add your own rendering rules, look at the osm.xml after running generate_xml.py. It inclu... See above. is there something special I have to do for the process to take my custom tag into account? Yes, see above. Peter [1] http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/default.style ___ dev mailing list dev@openstreetmap.org http://list... ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev