You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <pg...@us...> - 2016-09-04 21:59:38
|
Revision: 2999 http://sourceforge.net/p/roadmap/code/2999 Author: pgf Date: 2016-09-04 21:59:35 +0000 (Sun, 04 Sep 2016) Log Message: ----------- reduce thickness of service roads Modified Paths: -------------- trunk/roadmap/src/default/All Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2016-09-04 21:59:33 UTC (rev 2998) +++ trunk/roadmap/src/default/All 2016-09-04 21:59:35 UTC (rev 2999) @@ -37,7 +37,7 @@ .Color1: lightgrey .Delta1: -2 .Declutter: 100 - .Thickness: 2 + .Thickness: 1 .Speed: 50 Tracks.Color: brown .Color1: white This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2016-09-04 21:59:35
|
Revision: 2998 http://sourceforge.net/p/roadmap/code/2998 Author: pgf Date: 2016-09-04 21:59:33 +0000 (Sun, 04 Sep 2016) Log Message: ----------- buildmap_osm: differentiate between streets, tracks, and service roads Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layer_list.h trunk/roadmap/src/buildmap_osm_layers.h trunk/roadmap/src/default/All Modified: trunk/roadmap/src/buildmap_osm_layer_list.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layer_list.h 2015-10-20 15:08:33 UTC (rev 2997) +++ trunk/roadmap/src/buildmap_osm_layer_list.h 2016-09-04 21:59:33 UTC (rev 2998) @@ -9,6 +9,8 @@ // layer_define( Ramps ) layer_define( Highways ) layer_define( Streets ) +layer_define( Tracks ) +layer_define( Service ) layer_define( Trails ) layer_define( Railroads ) Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:33 UTC (rev 2997) +++ trunk/roadmap/src/buildmap_osm_layers.h 2016-09-04 21:59:33 UTC (rev 2998) @@ -64,10 +64,10 @@ { "unclassified", &Streets, LINE }, { "minor", &Streets, LINE }, { "residential", &Streets, LINE }, - { "service", &Streets, LINE }, { "road", &Streets, LINE }, { "secondary_link", &Streets, LINE }, - { "track", &Trails, LINE }, + { "service", &Service, LINE }, + { "track", &Tracks, LINE }, { "cycleway", &Trails, LINE }, { "bridleway", &Trails, LINE }, { "footway", &Trails, LINE }, Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-10-20 15:08:33 UTC (rev 2997) +++ trunk/roadmap/src/default/All 2016-09-04 21:59:33 UTC (rev 2998) @@ -1,5 +1,5 @@ Class.Name: All -Class.Lines: Freeways Ramps Highways Streets Trails Rivers Shore Railroads Boundaries +Class.Lines: Freeways Ramps Highways Streets Service Tracks Trails Rivers Shore Railroads Boundaries Class.Polygons: Islands Lakes Sea Parks Hospitals Airports Stations Schools Malls Nature Amenity Class.Places: City Town Village Hamlet Suburbs Food Cafe Drinks Fuel ATM Hotel Motel Guesthouse Hostel Class.NavigationModes: Car Bike Foot Boat @@ -33,11 +33,25 @@ .Declutter: 160 .Thickness: 2 .Speed: 90 -Trails.Color: DarkGrey +Service.Color: darkgrey + .Color1: lightgrey + .Delta1: -2 + .Declutter: 100 + .Thickness: 2 + .Speed: 50 +Tracks.Color: brown + .Color1: white + .Delta1: -2 + .Declutter: 100 + .Thickness: 2 + .Style: dashed + .Speed: 50 +Trails.Color: Brown .LabelFontColor: Black .LabelFontSize: 10 .Declutter: 160 .Thickness: 1 + .Style: dashed .Speed: 50 Railroads.Color: black .Declutter: 250 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:36
|
Revision: 2997 http://sourceforge.net/p/roadmap/code/2997 Author: pgf Date: 2015-10-20 15:08:33 +0000 (Tue, 20 Oct 2015) Log Message: ----------- initial commit Added Paths: ----------- trunk/roadmap/src/rebuild_osm Added: trunk/roadmap/src/rebuild_osm =================================================================== --- trunk/roadmap/src/rebuild_osm (rev 0) +++ trunk/roadmap/src/rebuild_osm 2015-10-20 15:08:33 UTC (rev 2997) @@ -0,0 +1,103 @@ +#!/bin/sh + +# this script is a work in progress, used for rebuilding all +# of the OSM maps stored under the current directory. + +me=${0##*/} +mydir=${0%/*} + +# mydir=/usr/local/bin + +export LD_LIBRARY_PATH=/usr/local/lib + +bits=19 +classfile=/tmp/All +classfile=/usr/local/share/roadmap/default/All + +while : +do + case $1 in + -f) force=--download; shift ;; + -i) ignorelist=true; shift ;; + -F) ignorelist=true; force=--download; shift ;; + -g) ignorelist=true; gdb=yes; shift ;; + -n) dryrun=':'; shift ;; + -b) bits=$2; shift 2;; + *) break ;; + esac +done + +if [ "$gdb" ] +then + dogdb="gdb $mydir/buildmap_osm --args" +fi + +hex2file() +{ + $mydir/buildmap_osm -l --class $classfile -t $1 | sed 's/[[:space:]].*//' +} +file2hex() +{ + echo $1 | sed 's;.*/qt\(........\)\.\(osm\|rdm\).*;0x\1;' +} + +do_build() +{ + if test -z "$ignorelist" -a -s /tmp/rebuild_osm.log && \ + grep -q $1 /tmp/rebuild_osm.log && \ + test -e $(hex2file $1) + then + echo Already rebuilt $1, skipping + return + fi + set -x + $dryrun $dogdb $mydir/buildmap_osm $force --replace \ + --fetcher $mydir/rdm_osm_fetch_tile \ + --class $classfile \ + --tileid $1 || exit 1 + r=$? + set +x +# --verbose --debug \ + + if [ $r = 0 -a -z "$ignorelist" ] + then + echo $1 >>/tmp/rebuild_osm.log + fi +} + +if [ "$1" ] +then + for x + do + case $x in + qt*|./qt*) + do_build $(file2hex $x) + ;; + 0x*) + do_build $x + ;; + esac + done + exit +fi + +started=$(date) +tiles=$( + for x in $(find qt$bits -name '*.osm.gz' -or -name '*.rdm') + do + file2hex $x # convert all filenames to tileid + done | sort -u # sort/uniq in case we have both .rdm and .osm.gz files +) + +for t in $tiles +do + do_build $t +done + +finished=$(date) + +echo started at $started +echo finished at $finished + +exit + Property changes on: trunk/roadmap/src/rebuild_osm ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:33
|
Revision: 2996 http://sourceforge.net/p/roadmap/code/2996 Author: pgf Date: 2015-10-20 15:08:31 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: simplify all water handling into parse_relation_final() Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:28 UTC (rev 2995) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:31 UTC (rev 2996) @@ -1134,8 +1134,6 @@ if (polygon) buildmap_polygon_add_line (0, PolygonId, LineId, POLYGON_SIDE_RIGHT); } -// FIXME see comment below about lineids from ways that have been -// split in two. we should be recording both LineIds. return LineId; } /** @@ -1169,7 +1167,6 @@ int minlat, minlon, maxlat, maxlon; minlat = minlon = 180000000; maxlat = maxlon = -180000000; -// FIXME. we've already calculated a bounding box in wp->area for (j = 0; j < way->node_ref_count; j++) { point = buildmap_osm_text_point_get(way->node_refs[j]); lon = buildmap_point_get_longitude(point); @@ -1231,7 +1228,6 @@ const char *name = 0; int is_multipolygon = 0; int layer = 0, flags = 0; - int is_water = 0; int i; nRels++; @@ -1258,16 +1254,11 @@ } } else if (strcasecmp(tag->key, "name") == 0) { name = tag->value; - } else if (strcasecmp(tag->key, "natural") == 0 && - strcasecmp(tag->value, "water") == 0) { - is_water = 1; } buildmap_osm_get_layer(AREA, tag->key, tag->value, &flags, &layer); } - if (layer == l_lake || layer == l_river) - is_water = 1; if (flags & PLACE) { flags = 0; @@ -1279,32 +1270,19 @@ if (is_multipolygon && layer) { for (i = 0; i < relation->member_count; i++) { - int memberlayer = 0; - int memberflags = 0; member = relation->members + i; switch(member->member_type) { case READOSM_MEMBER_WAY: - if (is_water) { - if (strcmp(member->role, "inner") == 0) { - memberlayer = l_island; - } else if (strcmp(member->role, "outer") == 0 - || strcmp(member->role, "") == 0) { - memberlayer = layer; - } - memberflags = AREA; - } - // a way can appear in multiple relations + // a way might already have been added, since it might + // appear in multiple relations wp = isWayInteresting(member->id); - if (wp) { - if (is_water) { // "water" is more important than most - wp->layer = memberlayer; - wp->flags = memberflags; - } - } else { - saveInterestingWay(member->id, 0, 0, memberlayer, - memberflags, layer, flags, relation->id); + if (!wp) { + saveInterestingWay(member->id, 0, 0, + 0, 0, layer, flags, relation->id); + // unfortunately, we have to re-sort. there's + // probably a better scheme. hash? qsort(WayTable, nWayTable, sizeof(*WayTable), qsort_compare_osm_ids); nSearchableWays = nWayTable; @@ -1397,13 +1375,15 @@ adjust_polybox(polyarea, twi[j]->area.north, twi[j]->area.east); } } - /* clear the ring indicators, in case these ways are part - * of another multipolygon, later. */ - for (i = 0; i < count; i++) { - wp = wayinfos[i]; - wp->ring = 0; - } } + + /* clear the ring indicators, in case these ways are part + * of another multipolygon, later. */ + for (i = 0; i < count; i++) { + wp = wayinfos[i]; + wp->ring = 0; + } + free(twi); } @@ -1414,6 +1394,7 @@ wayinfo *wp, **wayinfos, **innerwayinfos; const readosm_member *member; int i, wc, iwc; + int innerlayer; RoadMapString rms_name; rp = isRelationInteresting(relation->id); @@ -1456,9 +1437,23 @@ add_multipolygon(relation->id, wayinfos, rp->layer, rms_name, wc, rp->name); - // FIXME: shouldn't _always_ be l_island - add_multipolygon(relation->id, innerwayinfos, l_island, rms_name, iwc, rp->name); + if (rp->layer == l_lake || rp->layer == l_river) { +#if LATER + // i'd like to do this, but the only layer that will draw + // on top of water is "island". everything else draws + // _before_ water, and so becomes obscured. + innerlayer = wp->layer ? wp->layer : l_island; +#else + innerlayer = l_island; +#endif + } else { + // bad guess on a default layer for an inner polygon + innerlayer = wp->layer ? wp->layer : l_lake; + } + + add_multipolygon(relation->id, innerwayinfos, innerlayer, rms_name, iwc, rp->name); + free(wayinfos); free(innerwayinfos); return READOSM_OK; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:30
|
Revision: 2995 http://sourceforge.net/p/roadmap/code/2995 Author: pgf Date: 2015-10-20 15:08:28 +0000 (Tue, 20 Oct 2015) Log Message: ----------- roadmap_osm_layers.h: add village_green, recreation_ground as parks Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layers.h Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:25 UTC (rev 2994) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:28 UTC (rev 2995) @@ -94,7 +94,9 @@ value_info_t landuse_to_layer[] = { { "reservoir", &Lakes, AREA }, - { "conservation", &Nature, AREA }, + { "conservation", &Nature, AREA }, + { "recreation_ground", &Parks, AREA }, + { "village_green", &Parks, AREA }, { 0, NULL, 0 }, }; @@ -185,6 +187,7 @@ { "dog_park", &Parks, AREA }, { "playground", &Parks, AREA }, { "golf course", &Parks, AREA }, + { "recreation_ground", &Parks, AREA }, { 0, NULL, 0 }, }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:27
|
Revision: 2994 http://sourceforge.net/p/roadmap/code/2994 Author: pgf Date: 2015-10-20 15:08:25 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text: tileid now global, so it can be used in error messages Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:22 UTC (rev 2993) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:25 UTC (rev 2994) @@ -119,9 +119,12 @@ /** * @brief some global variables */ -static int PolygonId = 0; -static int LineId = 0; +static int CurrentTileID; + +static int PolygonId = 0; +static int LineId = 0; + static int l_shoreline, l_boundary, l_lake, l_river, l_island; static int nRels, nWays, nNodes; @@ -749,7 +752,7 @@ * @brief callback for final node parsing, called via readosm_parse() */ static int -parse_node_final(const void *is_tile, const readosm_node * node) +parse_node_final(const void *user_data, const readosm_node * node) { const readosm_tag *tag; const char *name = NULL; @@ -842,7 +845,7 @@ * @brief callback for initial way parsing, called via readosm_parse() */ static int -parse_way(const void *is_tile, const readosm_way *way) +parse_way(const void *user_data, const readosm_way *way) { const readosm_tag *tag; const char *tourism = NULL, *amenity = NULL; @@ -872,7 +875,7 @@ /* if we're processing a quadtile, don't include any * ways that our neighbors already include */ - if (is_tile && buildmap_osm_text_check_neighbor_way(way->id) && + if (CurrentTileID && buildmap_osm_text_check_neighbor_way(way->id) && !relation_layer) { buildmap_verbose("dropping way %lld because a neighbor " "already has it", way->id); @@ -1139,7 +1142,7 @@ * @brief callback for final way parsing, called via readosm_parse() */ static int -parse_way_final(const void *is_tile, const readosm_way *way) +parse_way_final(const void *user_data, const readosm_way *way) { wayinfo *wp; int j; @@ -1220,7 +1223,7 @@ } static int -parse_relation(const void *is_tile, const readosm_relation * relation) +parse_relation(const void *user_data, const readosm_relation * relation) { const readosm_tag *tag; const readosm_member *member; @@ -1238,7 +1241,7 @@ /* if we're processing a quadtile, don't include any * relations that our neighbors already include */ - if (is_tile && buildmap_osm_text_check_neighbor_relation(relation->id)) { + if (CurrentTileID && buildmap_osm_text_check_neighbor_relation(relation->id)) { buildmap_verbose("dropping relation %lld because a neighbor " "already has it", relation->id); return READOSM_OK; @@ -1377,7 +1380,7 @@ } } if (to != from) { - buildmap_info(" WARNING: failed to close polygon %d in relation %d", PolygonId, id); + buildmap_info(" WARNING: failed to close polygon %d in relation %d (0x%x)", PolygonId, id, CurrentTileID); } else { PolygonId++; if (polygon_debug) @@ -1498,15 +1501,13 @@ * @brief rather than trying to put an entire file's contents in memory, * we parse it in two passes. this routine is called for each pass. */ -void buildmap_readosm_pass(int pass, char *fn, int tileid) +void buildmap_readosm_pass(int pass, char *fn) { int ret; const void *handle; - void *is_tile = 0; + void *user_data = 0; FILE *fp; - if (tileid) is_tile = (void *)1; - buildmap_info("Starting pass %d", pass); fp = buildmap_osm_text_fopen(fn); @@ -1518,13 +1519,13 @@ } switch (pass) { - case 1: ret = readosm_parse(handle, is_tile, + case 1: ret = readosm_parse(handle, user_data, NULL, NULL, parse_relation); break; - case 2: ret = readosm_parse(handle, is_tile, + case 2: ret = readosm_parse(handle, user_data, NULL, parse_way, NULL); break; - case 3: ret = readosm_parse(handle, is_tile, + case 3: ret = readosm_parse(handle, user_data, parse_node_final, parse_way_final, parse_relation_final); break; } @@ -1566,6 +1567,8 @@ if (tileid) buildmap_osm_text_neighbor_way_maps(tileid); + CurrentTileID = tileid; + buildmap_osm_text_point_hash_reset(); DictionaryPrefix = buildmap_dictionary_open("prefix"); @@ -1595,7 +1598,7 @@ * record entire interesting relations, including layer and name, and * record the ways and nodes they refer to. */ - buildmap_readosm_pass(1, fn, tileid); + buildmap_readosm_pass(1, fn); qsort(RelTable, nRelTable, sizeof(*RelTable), qsort_compare_osm_ids); qsort(WayTable, nWayTable, sizeof(*WayTable), qsort_compare_osm_ids); @@ -1607,7 +1610,7 @@ * to biggest member? at what point do i have all the information * present to calculate this? */ - buildmap_readosm_pass(2, fn, tileid); + buildmap_readosm_pass(2, fn); /* we've added to the WayTable, so need to sort again, and bump * the number of searchable ways. @@ -1624,7 +1627,7 @@ * save recorded relations. assign relation's layer and/or name to * some or all of the related ways. */ - buildmap_readosm_pass(3, fn, tileid); + buildmap_readosm_pass(3, fn); buildmap_osm_text_ways_shapeinfo(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:24
|
Revision: 2993 http://sourceforge.net/p/roadmap/code/2993 Author: pgf Date: 2015-10-20 15:08:22 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm layers: clean up / simplify the layer configuration code Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layers.h trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:19 UTC (rev 2992) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:22 UTC (rev 2993) @@ -27,14 +27,14 @@ #define ANY 7 typedef struct { - char *osm_vname; + char *value; int *layerp; int flags; } value_info_t; typedef struct { - char *osm_tname; - value_info_t *value_list; + char *tag; + value_info_t *value_table; } tag_info_t; @@ -52,15 +52,7 @@ }; -BuildMapDictionary DictionaryPrefix; -BuildMapDictionary DictionaryStreet; -BuildMapDictionary DictionaryType; -BuildMapDictionary DictionarySuffix; -BuildMapDictionary DictionaryCity; - - value_info_t highway_to_layer[] = { - { 0, NULL, 0 }, { "motorway", &Freeways, LINE }, { "motorway_link", &Freeways, LINE }, { "trunk", &Freeways, LINE }, @@ -73,6 +65,8 @@ { "minor", &Streets, LINE }, { "residential", &Streets, LINE }, { "service", &Streets, LINE }, + { "road", &Streets, LINE }, + { "secondary_link", &Streets, LINE }, { "track", &Trails, LINE }, { "cycleway", &Trails, LINE }, { "bridleway", &Trails, LINE }, @@ -80,14 +74,11 @@ { "steps", &Trails, LINE }, { "pedestrian", &Trails, LINE }, { "pathway", &Trails, LINE }, - { "road", &Streets, LINE }, - { "secondary_link", &Streets, LINE }, { "path", &Trails, LINE }, { 0, NULL, 0 }, }; value_info_t cycleway_to_layer[] = { - { 0, NULL, 0 }, { "lane", &Trails, LINE }, { "track", &Trails, LINE }, { "opposite_lane", &Trails, LINE }, @@ -96,21 +87,18 @@ }; value_info_t aeroway_to_layer[] = { - { 0, NULL, 0 }, { "runway", &Airports, AREA }, { "aerodrome", &Airports, AREA }, { 0, NULL, 0 }, }; value_info_t landuse_to_layer[] = { - { 0, NULL, 0 }, { "reservoir", &Lakes, AREA }, { "conservation", &Nature, AREA }, { 0, NULL, 0 }, }; value_info_t waterway_to_layer[] = { - { 0, NULL, 0 }, { "river", &Rivers, LINE }, { "canal", &Rivers, LINE }, { "stream", &Rivers, LINE }, @@ -131,7 +119,6 @@ }; value_info_t railway_to_layer[] = { - { 0, NULL, 0 }, { "rail", &Railroads, LINE }, { "tram", &Railroads, LINE }, { "light_rail", &Railroads, LINE }, @@ -152,7 +139,6 @@ }; value_info_t natural_to_layer[] = { - { 0, NULL, 0 }, { "coastline", &Shore, LINE }, { "water", &Lakes, AREA }, { "wood", &Nature, AREA }, @@ -162,28 +148,25 @@ }; value_info_t amenity_to_layer[] = { - { 0, NULL, 0 }, + { "school", &Schools, AREA }, + { "university", &Schools, AREA }, + { "college", &Schools, AREA }, { "hospital", &Hospitals, LINE }, { "pub", &Drinks, PLACE }, - // { "parking", &Parking, AREA }, { "fuel", &Fuel, PLACE }, - { "school", &Schools, AREA }, { "restaurant", &Food, PLACE }, { "fast_food", &Food, PLACE }, + { "food_court", &Food, PLACE }, { "cafe", &Cafe, PLACE }, { "grave_yard", &Parks, AREA }, - { "university", &Schools, AREA }, - { "college", &Schools, AREA }, - { "food_court", &Food, PLACE }, - { "bbq", &Food, PLACE }, { "bar", &Drinks, PLACE }, { "biergarten", &Drinks, PLACE }, { "atm", &ATM, PLACE }, + // { "parking", &Parking, AREA }, { 0, NULL, 0 }, }; value_info_t place_to_layer[] = { - { 0, NULL, 0 }, { "city", &City, PLACE }, { "town", &Town, PLACE }, { "village", &Village, PLACE }, @@ -194,7 +177,6 @@ }; value_info_t leisure_to_layer[] = { - { 0, NULL, 0 }, { "park", &Parks, AREA }, { "common", &Parks, AREA }, { "garden", &Parks, AREA }, @@ -207,15 +189,11 @@ }; value_info_t historic_to_layer[] = { - { 0, NULL, 0 }, { "castle", &Castle, PLACE }, - // { "archaeological_site",NULL, AREA }, - // { "ruins", NULL, AREA }, { 0, NULL, 0 }, }; value_info_t tourism_to_layer[] = { - { 0, NULL, 0 }, { "hotel", &Hotel, PLACE }, { "motel", &Motel, PLACE }, { "guest_house", &Guesthouse, PLACE }, @@ -225,10 +203,7 @@ }; -/* set the third column to a specific type only if that table - * contains _only_ that type */ -tag_info_t tag_info[] = { - {0, NULL }, +tag_info_t tag_table[] = { {"highway", highway_to_layer }, {"cycleway", cycleway_to_layer }, {"waterway", waterway_to_layer }, Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:19 UTC (rev 2992) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:22 UTC (rev 2993) @@ -125,6 +125,13 @@ static int l_shoreline, l_boundary, l_lake, l_river, l_island; static int nRels, nWays, nNodes; +static BuildMapDictionary DictionaryPrefix; +static BuildMapDictionary DictionaryStreet; +static BuildMapDictionary DictionaryType; +static BuildMapDictionary DictionarySuffix; +static BuildMapDictionary DictionaryCity; + + /** * @brief add string to dictionary, taking note of null inputs * @param d @@ -458,10 +465,11 @@ /** - * @brief checks to see if the tag and value found in the input data - * corresponds to a layer we're interested in recording in the map. - * the layer is returned if so (but we don't touch it if not). the - * returned flags indicate what sort of layer this is (LINE, PLACE, AREA). + * @brief looks up the layer corresponding to a tag/value pair. + * only layers we might be interested in rendering on the + * map will be in the tables. if a match is found, the layer + * is returned (but we don't touch the return parameter if not). the + * the returned flags indicate the layer type (LINE, PLACE, AREA). * @param lookfor limits the search to matching types (LINE, PLACE, AREA) */ @@ -469,21 +477,18 @@ buildmap_osm_get_layer(int lookfor, const char *tag, const char *value, int *flags, int *layer) { - int i,j; - value_info_t *value_list; + value_info_t *v; + tag_info_t *t; - for (i=1; tag_info[i].osm_tname != 0; i++) { - if (strcmp(tag, tag_info[i].osm_tname) == 0) { - value_list = tag_info[i].value_list; - if (value_list) { - for (j=1; value_list[j].osm_vname; j++) { - if ((lookfor & value_list[j].flags) && - strcmp(value, value_list[j].osm_vname) == 0) { - *flags = value_list[j].flags; - if (value_list[j].layerp) - *layer = *(value_list[j].layerp); - return 1; - } + for (t = tag_table; t->tag != 0; t++) { + if (strcmp(tag, t->tag) == 0) { + v = t->value_table; + for (v = t->value_table; v->value != 0; v++) { + if ((lookfor & v->flags) && strcmp(value, v->value) == 0) { + *flags = v->flags; + if (v->layerp) + *layer = *v->layerp; + return 1; } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:21
|
Revision: 2992 http://sourceforge.net/p/roadmap/code/2992 Author: pgf Date: 2015-10-20 15:08:19 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: bug fixes, clean up node handling Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:16 UTC (rev 2991) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:19 UTC (rev 2992) @@ -747,13 +747,12 @@ parse_node_final(const void *is_tile, const readosm_node * node) { const readosm_tag *tag; - const char *name = NULL, *place = NULL; + const char *name = NULL; int layer = 0, flags = 0; int point; RoadMapString s; - int i; + int i, referenced; int lat, lon; - // int places = 0; nNodes++; @@ -764,26 +763,17 @@ name = tag->value; } else if (buildmap_osm_get_layer(PLACE, tag->key, tag->value, &flags, &layer)) { - if (flags & PLACE) - place = tag->value; - // fprintf(stderr, "t/v %s/%s, got place %d: %s %s\n", - // tag->key, tag->value, places, place, name); - // places++; + // fprintf(stderr, "t/v %s/%s, got place: %s\n", + // tag->key, tag->value, name); } } - /* unnamed, not a place, and not referenced by a way. skip it */ - i = isNodeInteresting(node->id); - if (!name && (flags != PLACE) && !isNodeInteresting(node->id)) { - // fprintf(stderr, "dropping node %s, flags %d, interesting %d\n", - // name, flags, i); + /* not a place we care about, and not referenced by a way. skip it */ + referenced = isNodeInteresting(node->id); + if (!layer && !referenced) return READOSM_OK; - } - // fprintf(stderr, "keeping node %s, flags %d, place %s\n", - // name, flags, place); - - /* Add this interesting node as a point */ + /* Add this node as a point */ /* libreadosm uses float to handle lat/lon, which introduces * small errors. try and ensure we get the same lat/lon as OSM * provided. it doesn't make a difference in practice, but can @@ -796,19 +786,12 @@ buildmap_osm_text_point_add(node->id, point); - /* If it's a place, add it to the place table as well */ - if (place) { - int p; - if (layer) { - s = str2dict (DictionaryCity, name); - p = buildmap_place_add(s, layer, point); - buildmap_debug("finishing %lld %1.7f %1.7f %s (%d) %s layer: %d", - node->id, - node->latitude, node->longitude, - place, p, name, layer); - } else { - buildmap_debug( "dropping %s %s", place, name); - } + /* If it has a layer, add it to the place table as well */ + if (layer) { + s = str2dict (DictionaryCity, name); + buildmap_place_add(s, layer, point); + buildmap_debug("finishing %lld %1.7f %1.7f %s layer: %d", + node->id, node->latitude, node->longitude, name, layer); } return READOSM_OK; @@ -967,7 +950,7 @@ if (!tourism && !amenity) flags &= ~PLACE; - if (flags & AREA) { + if ((flags & AREA) && !relation_layer) { // if it's supposed to be a polygon, but isn't, then it's not. if (way->node_refs[0] != way->node_refs[way->node_ref_count-1]) flags &= ~AREA; @@ -1288,32 +1271,32 @@ if (is_multipolygon && layer) { for (i = 0; i < relation->member_count; i++) { - int innerlayer = 0; - int innerflags = 0; + int memberlayer = 0; + int memberflags = 0; member = relation->members + i; switch(member->member_type) { case READOSM_MEMBER_WAY: if (is_water) { if (strcmp(member->role, "inner") == 0) { - innerlayer = l_island; + memberlayer = l_island; } else if (strcmp(member->role, "outer") == 0 || strcmp(member->role, "") == 0) { - innerlayer = l_lake; + memberlayer = layer; } - innerflags = AREA; + memberflags = AREA; } // a way can appear in multiple relations wp = isWayInteresting(member->id); if (wp) { if (is_water) { // "water" is more important than most - wp->layer = innerlayer; - wp->flags = innerflags; + wp->layer = memberlayer; + wp->flags = memberflags; } } else { - saveInterestingWay(member->id, 0, 0, innerlayer, - innerflags, layer, flags, relation->id); + saveInterestingWay(member->id, 0, 0, memberlayer, + memberflags, layer, flags, relation->id); qsort(WayTable, nWayTable, sizeof(*WayTable), qsort_compare_osm_ids); nSearchableWays = nWayTable; @@ -1359,35 +1342,34 @@ from = wp->from; to = wp->to; - if (to == from) - continue; + if (to != from) { + for (j = i; j < count; ) { + wp2 = wayinfos[j]; + if (wp2->ring) { + j++; + continue; + } - for (j = i; j < count; ) { - wp2 = wayinfos[j]; - if (wp2->ring) { - j++; - continue; + if (wp2->from == to) { + wp2->ring = ring; + wp2->leftright = POLYGON_SIDE_RIGHT; + twi[k++] = wp2; + to = wp2->to; + j = i; + } else if (wp2->to == to) { + wp2->ring = ring; + wp2->leftright = POLYGON_SIDE_LEFT; + twi[k++] = wp2; + to = wp2->from; + j = i; + } else { + /* no match */ + j++; + continue; + } + if (to == from) /* done with this ring */ + break; } - - if (wp2->from == to) { - wp2->ring = ring; - wp2->leftright = POLYGON_SIDE_RIGHT; - twi[k++] = wp2; - to = wp2->to; - j = i; - } else if (wp2->to == to) { - wp2->ring = ring; - wp2->leftright = POLYGON_SIDE_LEFT; - twi[k++] = wp2; - to = wp2->from; - j = i; - } else { - /* no match */ - j++; - continue; - } - if (to == from) /* done with this ring */ - break; } if (to != from) { buildmap_info(" WARNING: failed to close polygon %d in relation %d", PolygonId, id); @@ -1400,13 +1382,19 @@ for (j = 0; j < k; j++) { buildmap_polygon_add_line (0, PolygonId, twi[j]->lineid, twi[j]->leftright); - if (wp2->lineid2) + if (twi[j]->lineid2) buildmap_polygon_add_line (0, PolygonId, twi[j]->lineid2, twi[j]->leftright); adjust_polybox(polyarea, twi[j]->area.south, twi[j]->area.west); adjust_polybox(polyarea, twi[j]->area.north, twi[j]->area.east); } } + /* clear the ring indicators, in case these ways are part + * of another multipolygon, later. */ + for (i = 0; i < count; i++) { + wp = wayinfos[i]; + wp->ring = 0; + } } free(twi); } @@ -1585,7 +1573,7 @@ l_shoreline = buildmap_layer_get("shore");; l_boundary = buildmap_layer_get("boundaries");; l_lake = buildmap_layer_get("lakes");; - l_lake = buildmap_layer_get("rivers");; + l_river = buildmap_layer_get("rivers");; l_island = buildmap_layer_get("islands");; nRels = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:18
|
Revision: 2991 http://sourceforge.net/p/roadmap/code/2991 Author: pgf Date: 2015-10-20 15:08:16 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: don't start polygon add until we know it can complete Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:13 UTC (rev 2990) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:16 UTC (rev 2991) @@ -108,11 +108,14 @@ nodeid_t from; nodeid_t to; int ring; + int leftright; RoadMapArea area; }; typedef struct wayinfo wayinfo; +int polygon_debug = 0; + /** * @brief some global variables */ @@ -1082,7 +1085,7 @@ from_point = buildmap_osm_text_point_get(way->node_refs[0]); to_point = buildmap_osm_text_point_get(way->node_refs[way->node_ref_count-1]); - if (from_point == to_point && way->node_ref_count > 1) { + if (from_point == to_point && way->node_ref_count > 2) { /* the line code really doesn't want circular ways -- i.e., * lines where from and to are the same. split those cases * into two lines. @@ -1158,8 +1161,10 @@ if (!wp) return READOSM_OK; - if (way->node_ref_count == 0) + if (way->node_ref_count < 2) { + wp->lineid = -1; return READOSM_OK; + } rms_name = str2dict(DictionaryStreet, wp->name); @@ -1210,7 +1215,8 @@ RoadMapArea *polyarea; PolygonId++; - // buildmap_info("adding %d (%s) as polygon %d", wp->id, wp->name, PolygonId); + if (polygon_debug) + buildmap_info("adding %d (%s) as polygon %d", wp->id, wp->name, PolygonId); buildmap_polygon_add_landmark (PolygonId, wp->layer, rms_name); buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); @@ -1273,7 +1279,6 @@ is_water = 1; if (flags & PLACE) { - buildmap_info("discarding %s layer %d", name, layer); flags = 0; layer = 0; return READOSM_OK; @@ -1328,31 +1333,30 @@ return READOSM_OK; } -static void add_multipolygon(wayinfo **wayinfos, int layer, +static void add_multipolygon(relid_t id, wayinfo **wayinfos, int layer, int rms_name, int count, char *name) { wayinfo *wp, *wp2; + wayinfo **twi; // temporary wayinfo nodeid_t from = 0, to = 0; int ring = 0; - int i, j; + int i, j, k; RoadMapArea *polyarea; + twi = calloc(count, sizeof(*wayinfos)); + buildmap_check_allocated(twi); + for (i = 0; i < count; i++) { wp = wayinfos[i]; if (wp->ring) continue; wp->ring = ++ring; // if (wp->flags & AREA) continue; // already a polygon - PolygonId++; - // buildmap_info("add_multi: adding %d (%s) as polygon %d", wp->id, name, PolygonId); - buildmap_polygon_add_landmark (PolygonId, layer, rms_name); - buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); - buildmap_polygon_add_line (0, PolygonId, wp->lineid, POLYGON_SIDE_RIGHT); - if (wp->lineid2) - buildmap_polygon_add_line (0, PolygonId, wp->lineid2, POLYGON_SIDE_RIGHT); - adjust_polybox(polyarea, wp->area.south, wp->area.west); - adjust_polybox(polyarea, wp->area.north, wp->area.east); + k = 0; + wp->leftright = POLYGON_SIDE_RIGHT; + twi[k++] = wp; + from = wp->from; to = wp->to; if (to == from) @@ -1367,26 +1371,14 @@ if (wp2->from == to) { wp2->ring = ring; - // buildmap_info(" and %d (%d) as right side", wp2->id, wp2->lineid, PolygonId); - buildmap_polygon_add_line (0, PolygonId, wp2->lineid, - POLYGON_SIDE_RIGHT); - if (wp2->lineid2) - buildmap_polygon_add_line (0, PolygonId, wp2->lineid2, - POLYGON_SIDE_RIGHT); - adjust_polybox(polyarea, wp2->area.south, wp2->area.west); - adjust_polybox(polyarea, wp2->area.north, wp2->area.east); + wp2->leftright = POLYGON_SIDE_RIGHT; + twi[k++] = wp2; to = wp2->to; j = i; } else if (wp2->to == to) { wp2->ring = ring; - // buildmap_info(" and %d (%d) as left side", wp2->id, wp2->lineid, PolygonId); - buildmap_polygon_add_line (0, PolygonId, wp2->lineid, - POLYGON_SIDE_LEFT); - if (wp2->lineid2) - buildmap_polygon_add_line (0, PolygonId, wp2->lineid2, - POLYGON_SIDE_LEFT); - adjust_polybox(polyarea, wp2->area.south, wp2->area.west); - adjust_polybox(polyarea, wp2->area.north, wp2->area.east); + wp2->leftright = POLYGON_SIDE_LEFT; + twi[k++] = wp2; to = wp2->from; j = i; } else { @@ -1397,15 +1389,26 @@ if (to == from) /* done with this ring */ break; } - if (to != from) - buildmap_info(" WARNING: failed to close polygon %d", PolygonId); + if (to != from) { + buildmap_info(" WARNING: failed to close polygon %d in relation %d", PolygonId, id); + } else { + PolygonId++; + if (polygon_debug) + buildmap_info("add_multi: adding %d (%s) as polygon %d", wp->id, name, PolygonId); + buildmap_polygon_add_landmark (PolygonId, layer, rms_name); + buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); + for (j = 0; j < k; j++) { + buildmap_polygon_add_line (0, PolygonId, twi[j]->lineid, + twi[j]->leftright); + if (wp2->lineid2) + buildmap_polygon_add_line (0, PolygonId, twi[j]->lineid2, + twi[j]->leftright); + adjust_polybox(polyarea, twi[j]->area.south, twi[j]->area.west); + adjust_polybox(polyarea, twi[j]->area.north, twi[j]->area.east); + } + } } - /* clear the ring indicators, in case these ways are part - * of another multipolygon, later. */ - for (i = 0; i < count; i++) { - wp = wayinfos[i]; - wp->ring = 0; - } + free(twi); } static int @@ -1439,6 +1442,7 @@ switch(member->member_type) { case READOSM_MEMBER_WAY: wp = isWayInteresting(member->id); + if (wp->lineid == -1) continue; if (!wp->lineid) buildmap_fatal(0, "found null lineid"); if (strcmp(member->role, "inner") == 0) { innerwayinfos[iwc++] = wp; @@ -1455,9 +1459,9 @@ } - add_multipolygon(wayinfos, rp->layer, rms_name, wc, rp->name); + add_multipolygon(relation->id, wayinfos, rp->layer, rms_name, wc, rp->name); // FIXME: shouldn't _always_ be l_island - add_multipolygon(innerwayinfos, l_island, rms_name, iwc, rp->name); + add_multipolygon(relation->id, innerwayinfos, l_island, rms_name, iwc, rp->name); free(wayinfos); free(innerwayinfos); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:15
|
Revision: 2990 http://sourceforge.net/p/roadmap/code/2990 Author: pgf Date: 2015-10-20 15:08:13 +0000 (Tue, 20 Oct 2015) Log Message: ----------- rdm_osm_fetch_tile: fix typo Modified Paths: -------------- trunk/roadmap/src/rdm_osm_fetch_tile Modified: trunk/roadmap/src/rdm_osm_fetch_tile =================================================================== --- trunk/roadmap/src/rdm_osm_fetch_tile 2015-10-20 15:08:10 UTC (rev 2989) +++ trunk/roadmap/src/rdm_osm_fetch_tile 2015-10-20 15:08:13 UTC (rev 2990) @@ -120,7 +120,8 @@ *) echo "Note: download didn't use gzip encoding." echo "Compressing now..." - gzip -c -d $xmlfile.tmp > $xmlfile || exit 1 + set -x + gzip -c $xmlfile.tmp > $xmlfile || exit 1 ;; esac fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:12
|
Revision: 2989 http://sourceforge.net/p/roadmap/code/2989 Author: pgf Date: 2015-10-20 15:08:10 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: rivers and lakes both qualify as water Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:07 UTC (rev 2988) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:10 UTC (rev 2989) @@ -119,7 +119,7 @@ static int PolygonId = 0; static int LineId = 0; -static int l_shoreline, l_boundary, l_lake, l_island; +static int l_shoreline, l_boundary, l_lake, l_river, l_island; static int nRels, nWays, nNodes; /** @@ -1269,6 +1269,9 @@ buildmap_osm_get_layer(AREA, tag->key, tag->value, &flags, &layer); } + if (layer == l_lake || layer == l_river) + is_water = 1; + if (flags & PLACE) { buildmap_info("discarding %s layer %d", name, layer); flags = 0; @@ -1578,6 +1581,7 @@ l_shoreline = buildmap_layer_get("shore");; l_boundary = buildmap_layer_get("boundaries");; l_lake = buildmap_layer_get("lakes");; + l_lake = buildmap_layer_get("rivers");; l_island = buildmap_layer_get("islands");; nRels = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:09
|
Revision: 2988 http://sourceforge.net/p/roadmap/code/2988 Author: pgf Date: 2015-10-20 15:08:07 +0000 (Tue, 20 Oct 2015) Log Message: ----------- default/All: leave rivers and islands visible at higher zoom levels now that multipolygons work, big rivers are more interesting Modified Paths: -------------- trunk/roadmap/src/default/All Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-10-20 15:08:04 UTC (rev 2987) +++ trunk/roadmap/src/default/All 2015-10-20 15:08:07 UTC (rev 2988) @@ -48,7 +48,7 @@ Rivers.Color: LightBlue .LabelFontColor: DarkBlue .LabelFontSize: 10 - .Declutter: 300 + .Declutter: 1300 .Thickness: 3 .Speed: 1 Shore.Color: LightSlateBlue @@ -96,7 +96,7 @@ .Thickness: 1 .Speed: 1 Islands.Color: lightyellow - .Declutter: 600 + .Declutter: 900 .Thickness: 1 .Speed: 1 Peak.Color: brown This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:06
|
Revision: 2987 http://sourceforge.net/p/roadmap/code/2987 Author: pgf Date: 2015-10-20 15:08:04 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_layers: AREA/PLACE flags only matter at the layer level Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layers.h trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:01 UTC (rev 2986) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:08:04 UTC (rev 2987) @@ -35,7 +35,6 @@ typedef struct { char *osm_tname; value_info_t *value_list; - int flags; } tag_info_t; @@ -229,20 +228,20 @@ /* set the third column to a specific type only if that table * contains _only_ that type */ tag_info_t tag_info[] = { - {0, NULL, 0 }, - {"highway", highway_to_layer, ANY }, - {"cycleway", cycleway_to_layer, ANY }, - {"waterway", waterway_to_layer, ANY }, - {"railway", railway_to_layer, ANY }, - {"leisure", leisure_to_layer, ANY }, - {"amenity", amenity_to_layer, ANY }, - {"tourism", tourism_to_layer, ANY }, - {"historic", historic_to_layer, ANY }, - {"landuse", landuse_to_layer, ANY }, - {"aeroway", aeroway_to_layer, ANY }, - {"natural", natural_to_layer, ANY }, - {"place", place_to_layer, ANY }, - { 0, NULL, 0 }, + {0, NULL }, + {"highway", highway_to_layer }, + {"cycleway", cycleway_to_layer }, + {"waterway", waterway_to_layer }, + {"railway", railway_to_layer }, + {"leisure", leisure_to_layer }, + {"amenity", amenity_to_layer }, + {"tourism", tourism_to_layer }, + {"historic", historic_to_layer }, + {"landuse", landuse_to_layer }, + {"aeroway", aeroway_to_layer }, + {"natural", natural_to_layer }, + {"place", place_to_layer }, + { 0, NULL }, }; /** Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:01 UTC (rev 2986) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:04 UTC (rev 2987) @@ -458,8 +458,8 @@ * @brief checks to see if the tag and value found in the input data * corresponds to a layer we're interested in recording in the map. * the layer is returned if so (but we don't touch it if not). the - * returned flags indicate what sort of layer this is (PLACE, AREA). - * @param lookfor limits the search to matching types (PLACE, AREA) + * returned flags indicate what sort of layer this is (LINE, PLACE, AREA). + * @param lookfor limits the search to matching types (LINE, PLACE, AREA) */ int @@ -470,12 +470,11 @@ value_info_t *value_list; for (i=1; tag_info[i].osm_tname != 0; i++) { - if ((lookfor & tag_info[i].flags) && - strcmp(tag, tag_info[i].osm_tname) == 0) { + if (strcmp(tag, tag_info[i].osm_tname) == 0) { value_list = tag_info[i].value_list; if (value_list) { for (j=1; value_list[j].osm_vname; j++) { - if ((lookfor & tag_info[i].flags) && + if ((lookfor & value_list[j].flags) && strcmp(value, value_list[j].osm_vname) == 0) { *flags = value_list[j].flags; if (value_list[j].layerp) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:03
|
Revision: 2986 http://sourceforge.net/p/roadmap/code/2986 Author: pgf Date: 2015-10-20 15:08:01 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: constrain layer searches Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:58 UTC (rev 2985) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:08:01 UTC (rev 2986) @@ -475,7 +475,8 @@ value_list = tag_info[i].value_list; if (value_list) { for (j=1; value_list[j].osm_vname; j++) { - if (strcmp(value, value_list[j].osm_vname) == 0) { + if ((lookfor & tag_info[i].flags) && + strcmp(value, value_list[j].osm_vname) == 0) { *flags = value_list[j].flags; if (value_list[j].layerp) *layer = *(value_list[j].layerp); @@ -1173,7 +1174,7 @@ int minlat, minlon, maxlat, maxlon; minlat = minlon = 180000000; maxlat = maxlon = -180000000; - +// FIXME. we've already calculated a bounding box in wp->area for (j = 0; j < way->node_ref_count; j++) { point = buildmap_osm_text_point_get(way->node_refs[j]); lon = buildmap_point_get_longitude(point); @@ -1216,7 +1217,6 @@ add_line(wp, way, rms_name, wp->layer, 1, polyarea); } - if (!wp->lineid) { buildmap_debug ("Way %lld [%s]", way->id, wp->name ? wp->name : ""); add_line(wp, way, rms_name, @@ -1235,9 +1235,7 @@ const char *name = 0; int is_multipolygon = 0; int layer = 0, flags = 0; - int is_building = 0; int is_water = 0; - const char *tourism = NULL, *amenity = NULL; int i; nRels++; @@ -1264,12 +1262,6 @@ } } else if (strcasecmp(tag->key, "name") == 0) { name = tag->value; - } else if (strcasecmp(tag->key, "building") == 0) { - is_building = 1; - } else if (strcasecmp(tag->key, "tourism") == 0) { - tourism = tag->value; - } else if (strcasecmp(tag->key, "amenity") == 0) { - amenity = tag->value; } else if (strcasecmp(tag->key, "natural") == 0 && strcasecmp(tag->value, "water") == 0) { is_water = 1; @@ -1278,15 +1270,11 @@ buildmap_osm_get_layer(AREA, tag->key, tag->value, &flags, &layer); } - /* only save buildings that are amenities or touristic */ - if (is_building) { - if (tourism) { - buildmap_osm_get_layer(PLACE, "tourism", tourism, &flags, &layer); - } else if (amenity) { - buildmap_osm_get_layer(PLACE, "amenity", amenity, &flags, &layer); - } else { - return READOSM_OK; - } + if (flags & PLACE) { + buildmap_info("discarding %s layer %d", name, layer); + flags = 0; + layer = 0; + return READOSM_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:08:00
|
Revision: 2985 http://sourceforge.net/p/roadmap/code/2985 Author: pgf Date: 2015-10-20 15:07:58 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_layers: pick up riverbanks, which are polygons Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layers.h Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:07:55 UTC (rev 2984) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:07:58 UTC (rev 2985) @@ -115,6 +115,7 @@ { "river", &Rivers, LINE }, { "canal", &Rivers, LINE }, { "stream", &Rivers, LINE }, + { "riverbank", &Rivers, AREA }, #if 0 { "drain", &Rivers, LINE }, { "dock", &Rivers, LINE }, @@ -125,7 +126,6 @@ { "water_point", &Rivers, LINE }, { "weir", &Rivers, LINE }, { "dam", &Rivers, LINE }, - { "riverbank", &Rivers, LINE }, { "ditch", &Rivers, LINE }, #endif { 0, NULL, 0 }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:57
|
Revision: 2984 http://sourceforge.net/p/roadmap/code/2984 Author: pgf Date: 2015-10-20 15:07:55 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: improve commented-out debug lines useful for when polygon data is wrong in OSM Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:52 UTC (rev 2983) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:55 UTC (rev 2984) @@ -1210,7 +1210,7 @@ RoadMapArea *polyarea; PolygonId++; - // buildmap_info("adding %s as polygon %d", wp->name, PolygonId); + // buildmap_info("adding %d (%s) as polygon %d", wp->id, wp->name, PolygonId); buildmap_polygon_add_landmark (PolygonId, wp->layer, rms_name); buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); @@ -1354,7 +1354,7 @@ // if (wp->flags & AREA) continue; // already a polygon PolygonId++; - // buildmap_info("add_multi: adding %s as polygon %d", name, PolygonId); + // buildmap_info("add_multi: adding %d (%s) as polygon %d", wp->id, name, PolygonId); buildmap_polygon_add_landmark (PolygonId, layer, rms_name); buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); buildmap_polygon_add_line (0, PolygonId, wp->lineid, POLYGON_SIDE_RIGHT); @@ -1377,6 +1377,7 @@ if (wp2->from == to) { wp2->ring = ring; + // buildmap_info(" and %d (%d) as right side", wp2->id, wp2->lineid, PolygonId); buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_RIGHT); if (wp2->lineid2) @@ -1388,6 +1389,7 @@ j = i; } else if (wp2->to == to) { wp2->ring = ring; + // buildmap_info(" and %d (%d) as left side", wp2->id, wp2->lineid, PolygonId); buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_LEFT); if (wp2->lineid2) @@ -1402,10 +1404,11 @@ j++; continue; } - if (to == from) { /* done with this ring */ + if (to == from) /* done with this ring */ break; - } } + if (to != from) + buildmap_info(" WARNING: failed to close polygon %d", PolygonId); } /* clear the ring indicators, in case these ways are part * of another multipolygon, later. */ @@ -1428,7 +1431,7 @@ if (!rp) return READOSM_OK; - // buildmap_info("warning: relation %s is interesting", rp->name); + // buildmap_info("relation %d (%s) is interesting", rp->id, rp->name); // note: assumes this is a multipolygon relation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:54
|
Revision: 2983 http://sourceforge.net/p/roadmap/code/2983 Author: pgf Date: 2015-10-20 15:07:52 +0000 (Tue, 20 Oct 2015) Log Message: ----------- boundary box adjustments: fix calculation in some cases the old code wasn't fully calculating an appropriate bounding box. Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c trunk/roadmap/src/buildmap_polygon.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:49 UTC (rev 2982) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:52 UTC (rev 2983) @@ -1005,17 +1005,10 @@ void adjust_polybox(RoadMapArea *pbox, int lat, int lon) { - if (lon < pbox->west) { - pbox->west = lon; - } else if (lon > pbox->east) { - pbox->east = lon; - } - - if (lat < pbox->south) { - pbox->south = lat; - } else if (lat > pbox->north) { - pbox->north = lat; - } + if (lon < pbox->west) pbox->west = lon; + if (lon > pbox->east) pbox->east = lon; + if (lat < pbox->south) pbox->south = lat; + if (lat > pbox->north) pbox->north = lat; } static void Modified: trunk/roadmap/src/buildmap_polygon.c =================================================================== --- trunk/roadmap/src/buildmap_polygon.c 2015-10-20 15:07:49 UTC (rev 2982) +++ trunk/roadmap/src/buildmap_polygon.c 2015-10-20 15:07:52 UTC (rev 2983) @@ -271,13 +271,15 @@ if (x1 < pa->west) { pa->west = x1; - } else if (x1 > pa->east) { + } + if (x1 > pa->east) { pa->east = x1; } if (x2 < pa->west) { pa->west = x2; - } else if (x2 > pa->east) { + } + if (x2 > pa->east) { pa->east = x2; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:51
|
Revision: 2982 http://sourceforge.net/p/roadmap/code/2982 Author: pgf Date: 2015-10-20 15:07:49 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: cleanup Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:46 UTC (rev 2981) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:49 UTC (rev 2982) @@ -108,6 +108,7 @@ nodeid_t from; nodeid_t to; int ring; + RoadMapArea area; }; typedef struct wayinfo wayinfo; @@ -115,7 +116,6 @@ /** * @brief some global variables */ -static int LandmarkId = 0; static int PolygonId = 0; static int LineId = 0; @@ -333,6 +333,8 @@ wp->to = way->node_refs[way->node_ref_count-1]; } + wp->area.west = wp->area.south = 180000000; + wp->area.east = wp->area.north = -180000000; nWayTable++; } @@ -856,9 +858,9 @@ int adminlevel = 0; int is_building = 0, is_territorial = 0, is_coast = 0; // booleans int layer = 0, flags = 0; + int relation_layer = 0, relation_flags = 0; const char *name = 0, *ref = 0; wayinfo *wp; - int relation_layer, relation_flags; int i; nWays++; @@ -879,7 +881,8 @@ /* if we're processing a quadtile, don't include any * ways that our neighbors already include */ - if (is_tile && buildmap_osm_text_check_neighbor_way(way->id) && !relation_layer) { + if (is_tile && buildmap_osm_text_check_neighbor_way(way->id) && + !relation_layer) { buildmap_verbose("dropping way %lld because a neighbor " "already has it", way->id); return READOSM_OK; @@ -958,39 +961,41 @@ } } - if (flags & PLACE) { - if (!tourism && !amenity) - flags &= ~PLACE; - if (way->node_refs[0] == way->node_refs[way->node_ref_count-1]) - flags |= AREA; - } + if (!tourism && !amenity) + flags &= ~PLACE; + if (flags & AREA) { + // if it's supposed to be a polygon, but isn't, then it's not. if (way->node_refs[0] != way->node_refs[way->node_ref_count-1]) flags &= ~AREA; } - out: if (layer || relation_layer) { const char *n = road_name(name, ref); - if (wp) { + if (wp) { // then we're part of a relation if (n) wp->name = strdup(n); + + // we might have already set the way, e.g. we might have + // set it to "island" if it's an inner polygon of a lake if (!wp->layer) { - if (layer) { + if (layer) { // if it's not set yet, prefer the way layer wp->layer = layer; wp->flags = flags; - } else { + } else { // else use the relation's layer wp->layer = relation_layer; - wp->flags = 0; // relation_flags; + wp->flags = relation_flags; } } wp->from = way->node_refs[0]; wp->to = way->node_refs[way->node_ref_count-1]; - } else { - saveInterestingWay( way->id, way, n ? strdup(n) : 0, layer, flags, 0, 0, 0); + } else { // not in a relation + saveInterestingWay( way->id, way, n ? strdup(n) : 0, + layer, flags, 0, 0, 0); } + for (i = 0; i < way->node_ref_count; i++) saveInterestingNode(way->node_refs[i]); } @@ -1166,14 +1171,15 @@ rms_name = str2dict(DictionaryStreet, wp->name); if (wp->flags & PLACE) { - /* we're finishing a way, but the flags may say PLACE if - * we're treating a polygon as a place, for instance. find - * the center of the bounding box (which is good enough, for - * these purposes), and make it into a place. - */ - int minlat = 999999999, maxlat = -999999999; - int minlon = 999999999, maxlon = -999999999; + /* we're finishing a way, but the flags may say PLACE if + * we're treating a polygon as a place, for instance. find + * the center of the bounding box (which is good enough, for + * these purposes), and make it into a place. + */ int point, lon, lat; + int minlat, minlon, maxlat, maxlon; + minlat = minlon = 180000000; + maxlat = maxlon = -180000000; for (j = 0; j < way->node_ref_count; j++) { point = buildmap_osm_text_point_get(way->node_refs[j]); @@ -1186,10 +1192,10 @@ if (lon > maxlon) maxlon = lon; } + // take the center of the bounding box lat = (maxlat + minlat) / 2; lon = (maxlon + minlon) / 2; - /* this code looks like buildmap_osm_text_node_finish() */ point = buildmap_point_add(lon, lat); if (wp->layer) { @@ -1197,37 +1203,32 @@ int p; s = str2dict (DictionaryCity, wp->name); p = buildmap_place_add(s, wp->layer, point); - // buildmap_debug( "wayplace: finishing %f %f %s (%d) %s layer: %d", buildmap_debug( "wayplace: finishing %f %f (%d) %s layer: %d", (float)lat/1000000.0, (float)lon/1000000.0, - // tourism ? tourism : amenity, p, wp->name, wp->layer); p, wp->name, wp->layer); } - if (wp->relation_layer && (wp->relation_flags & AREA)) { - goto add_as_poly; - } else if (wp->relation_layer) { - goto add_as_way; - } - - } else if (wp->flags & AREA) { + } + + /* add the polygon here if there's no relation, otherwise let the + * relation do it. + */ + if ((wp->flags & AREA) && !wp->relation_id) { RoadMapArea *polyarea; - add_as_poly: - LandmarkId++; PolygonId++; - buildmap_info("adding %s as polygon %d", wp->name, PolygonId); - buildmap_polygon_add_landmark (LandmarkId, wp->layer, rms_name); - buildmap_polygon_add(LandmarkId, 0, PolygonId, &polyarea); + // buildmap_info("adding %s as polygon %d", wp->name, PolygonId); + buildmap_polygon_add_landmark (PolygonId, wp->layer, rms_name); + buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); add_line(wp, way, rms_name, wp->layer, 1, polyarea); - } else { - add_as_way: - buildmap_debug ("Way %lld [%s]", way->id, - wp->name ? wp->name : ""); - + } + + if (!wp->lineid) { + buildmap_debug ("Way %lld [%s]", way->id, wp->name ? wp->name : ""); add_line(wp, way, rms_name, - wp->layer ? wp->layer: wp->relation_layer, 0, NULL); + wp->layer ? wp->layer: wp->relation_layer, 0, + wp->relation_id ? &wp->area : 0); } return READOSM_OK; } @@ -1237,6 +1238,7 @@ { const readosm_tag *tag; const readosm_member *member; + wayinfo *wp; const char *name = 0; int is_multipolygon = 0; int layer = 0, flags = 0; @@ -1313,7 +1315,15 @@ } innerflags = AREA; } - if (!isWayInteresting(member->id)) { + + // a way can appear in multiple relations + wp = isWayInteresting(member->id); + if (wp) { + if (is_water) { // "water" is more important than most + wp->layer = innerlayer; + wp->flags = innerflags; + } + } else { saveInterestingWay(member->id, 0, 0, innerlayer, innerflags, layer, flags, relation->id); qsort(WayTable, nWayTable, sizeof(*WayTable), @@ -1342,19 +1352,23 @@ nodeid_t from = 0, to = 0; int ring = 0; int i, j; - // RoadMapArea *polyarea; + RoadMapArea *polyarea; for (i = 0; i < count; i++) { wp = wayinfos[i]; if (wp->ring) continue; wp->ring = ++ring; + // if (wp->flags & AREA) continue; // already a polygon PolygonId++; - buildmap_info("add_multi: adding %s as polygon %d", name, PolygonId); - buildmap_polygon_add(LandmarkId, 0, PolygonId, 0); // &polyarea); + // buildmap_info("add_multi: adding %s as polygon %d", name, PolygonId); + buildmap_polygon_add_landmark (PolygonId, layer, rms_name); + buildmap_polygon_add(PolygonId, 0, PolygonId, &polyarea); buildmap_polygon_add_line (0, PolygonId, wp->lineid, POLYGON_SIDE_RIGHT); if (wp->lineid2) buildmap_polygon_add_line (0, PolygonId, wp->lineid2, POLYGON_SIDE_RIGHT); + adjust_polybox(polyarea, wp->area.south, wp->area.west); + adjust_polybox(polyarea, wp->area.north, wp->area.east); from = wp->from; to = wp->to; @@ -1370,14 +1384,13 @@ if (wp2->from == to) { wp2->ring = ring; -// FIXME it's possible that a way may have more than one lineid, as -// a result of being a circular way that's been split in two in add_line(). -// we should record both and add both here. buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_RIGHT); if (wp2->lineid2) buildmap_polygon_add_line (0, PolygonId, wp2->lineid2, POLYGON_SIDE_RIGHT); + adjust_polybox(polyarea, wp2->area.south, wp2->area.west); + adjust_polybox(polyarea, wp2->area.north, wp2->area.east); to = wp2->to; j = i; } else if (wp2->to == to) { @@ -1387,6 +1400,8 @@ if (wp2->lineid2) buildmap_polygon_add_line (0, PolygonId, wp2->lineid2, POLYGON_SIDE_LEFT); + adjust_polybox(polyarea, wp2->area.south, wp2->area.west); + adjust_polybox(polyarea, wp2->area.north, wp2->area.east); to = wp2->from; j = i; } else { @@ -1420,12 +1435,10 @@ if (!rp) return READOSM_OK; - buildmap_info("warning: relation %s is interesting", rp->name); + // buildmap_info("warning: relation %s is interesting", rp->name); // note: assumes this is a multipolygon relation - LandmarkId++; - rms_name = str2dict(DictionaryStreet, rp->name); wayinfos = calloc(relation->member_count, sizeof(*wayinfos)); @@ -1455,7 +1468,6 @@ } } - buildmap_polygon_add_landmark (LandmarkId, rp->layer, rms_name); add_multipolygon(wayinfos, rp->layer, rms_name, wc, rp->name); // FIXME: shouldn't _always_ be l_island This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:48
|
Revision: 2981 http://sourceforge.net/p/roadmap/code/2981 Author: pgf Date: 2015-10-20 15:07:46 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_layers.h: cleanup Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layers.h Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:07:43 UTC (rev 2980) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:07:46 UTC (rev 2981) @@ -167,50 +167,24 @@ { "hospital", &Hospitals, LINE }, { "pub", &Drinks, PLACE }, // { "parking", &Parking, AREA }, - // { "post_office", &Postoffice, LINE }, { "fuel", &Fuel, PLACE }, { "school", &Schools, AREA }, - // { "supermarket", NULL, LINE }, - // { "library", NULL, LINE }, - // { "police", &Police, LINE }, - // { "fire_station", NULL, LINE }, { "restaurant", &Food, PLACE }, { "fast_food", &Food, PLACE }, - // { "place_of_worship", NULL, LINE }, { "cafe", &Cafe, PLACE }, - // { "bicycle_parking", NULL, AREA }, - // { "public_building", NULL, AREA }, { "grave_yard", &Parks, AREA }, { "university", &Schools, AREA }, { "college", &Schools, AREA }, - // { "townhall", NULL, AREA }, { "food_court", &Food, PLACE }, { "bbq", &Food, PLACE }, { "bar", &Drinks, PLACE }, { "biergarten", &Drinks, PLACE }, - // { "ferry_terminal", NULL, AREA }, - // { "car_sharing", NULL, AREA }, - // { "taxi", NULL, AREA }, { "atm", &ATM, PLACE }, - // { "arts_centre", NULL, AREA }, - // { "community_centre", NULL, AREA }, - // { "social_centre", NULL, AREA }, - // { "courthouse", NULL, LINE }, - // { "crematorium", NULL, LINE }, - // { "embassy", NULL, LINE }, - // { "marketplace", NULL, AREA }, - // { "prison", NULL, AREA }, - // { "shelter", NULL, AREA }, { 0, NULL, 0 }, }; value_info_t place_to_layer[] = { { 0, NULL, 0 }, - // { "continent", NULL, LINE }, - // { "country", NULL, LINE }, - // { "state", NULL, LINE }, - // { "region", NULL, LINE }, - // { "county", NULL, LINE }, { "city", &City, PLACE }, { "town", &Town, PLACE }, { "village", &Village, PLACE }, @@ -262,8 +236,8 @@ {"railway", railway_to_layer, ANY }, {"leisure", leisure_to_layer, ANY }, {"amenity", amenity_to_layer, ANY }, - {"tourism", tourism_to_layer, PLACE }, - {"historic", historic_to_layer, PLACE }, + {"tourism", tourism_to_layer, ANY }, + {"historic", historic_to_layer, ANY }, {"landuse", landuse_to_layer, ANY }, {"aeroway", aeroway_to_layer, ANY }, {"natural", natural_to_layer, ANY }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:46
|
Revision: 2980 http://sourceforge.net/p/roadmap/code/2980 Author: pgf Date: 2015-10-20 15:07:43 +0000 (Tue, 20 Oct 2015) Log Message: ----------- multipolygons and islands: still a work in progress much of this commit has to do with calculating an accurate bounding box for the shaped lines making up polygons Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c trunk/roadmap/src/buildmap_polygon.c trunk/roadmap/src/buildmap_polygon.h trunk/roadmap/src/buildmap_tiger.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:40 UTC (rev 2979) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:43 UTC (rev 2980) @@ -98,7 +98,7 @@ struct wayinfo { wayid_t id; // must be first - int lineid; + int lineid, lineid2; int layer; int flags; char *name; @@ -115,6 +115,7 @@ /** * @brief some global variables */ +static int LandmarkId = 0; static int PolygonId = 0; static int LineId = 0; @@ -966,8 +967,6 @@ if (flags & AREA) { if (way->node_refs[0] != way->node_refs[way->node_ref_count-1]) flags &= ~AREA; - /* see http://wiki.openstreetmap.org/wiki/The_Future_of_Areas - * for why the above conditions are simplistic */ } @@ -984,7 +983,7 @@ wp->flags = flags; } else { wp->layer = relation_layer; - wp->flags = relation_flags; + wp->flags = 0; // relation_flags; } } wp->from = way->node_refs[0]; @@ -999,16 +998,25 @@ return READOSM_OK; } -void add_line_shapes(const readosm_way *way, int from, int to) +void adjust_polybox(RoadMapArea *pbox, int lat, int lon) { - /* - * We're passing too much here - the endpoints of - * the line don't need to be passed to the shape - * module. We're keeping them here just to be on - * the safe side, they'll be ignored in - * buildmap_osm_text_ways_shapeinfo(). - * - * The lonsbuf/latsbuf are never freed, need to be + if (lon < pbox->west) { + pbox->west = lon; + } else if (lon > pbox->east) { + pbox->east = lon; + } + + if (lat < pbox->south) { + pbox->south = lat; + } else if (lat > pbox->north) { + pbox->north = lat; + } +} + +static void +add_line_shapes(const readosm_way *way, int from, int to, RoadMapArea *pbox) +{ + /* The lonsbuf/latsbuf are never freed, need to be * preserved for shape registration which happens * at the end of the program run, so exit() will * free this for us. @@ -1029,6 +1037,8 @@ lonsbuf[i] = lon; latsbuf[i] = lat; + if (pbox) adjust_polybox(pbox, lat, lon); + buildmap_square_adjust_limits(lon, lat); } @@ -1055,12 +1065,15 @@ nShapes++; } -int -add_shaped_line(const readosm_way *way, int rms_name, int layer, int polygon) +static int +add_line(wayinfo *wp, const readosm_way *way, int rms_name, int layer, + int polygon, RoadMapArea *pbox) { RoadMapString rms_dirp, rms_dirs, rms_type; - int from_point, to_point, mid_point, line, street; + int from_point, to_point, line, street; + + rms_dirp = str2dict(DictionaryPrefix, ""); rms_dirs = str2dict(DictionarySuffix, ""); rms_type = str2dict(DictionaryType, ""); @@ -1078,7 +1091,7 @@ */ int mid_count = way->node_ref_count / 2; - mid_point = buildmap_osm_text_point_get(way->node_refs[mid_count]); + int mid_point = buildmap_osm_text_point_get(way->node_refs[mid_count]); /* first half */ LineId++; @@ -1089,8 +1102,10 @@ rms_dirs, line); buildmap_range_add_no_address(line, street); - add_line_shapes(way, 0, mid_count); + add_line_shapes(way, 0, mid_count, pbox); + wp->lineid = LineId; + if (polygon) buildmap_polygon_add_line (0, PolygonId, LineId, POLYGON_SIDE_RIGHT); @@ -1103,8 +1118,10 @@ rms_dirs, line); buildmap_range_add_no_address(line, street); - add_line_shapes(way, mid_count, way->node_ref_count-1); + add_line_shapes(way, mid_count, way->node_ref_count-1, pbox); + wp->lineid2 = LineId; + if (polygon) buildmap_polygon_add_line (0, PolygonId, LineId, POLYGON_SIDE_RIGHT); @@ -1118,7 +1135,10 @@ rms_dirs, line); buildmap_range_add_no_address(line, street); - add_line_shapes(way, 0, way->node_ref_count-1); + add_line_shapes(way, 0, way->node_ref_count-1, pbox); + + wp->lineid = LineId; + if (polygon) buildmap_polygon_add_line (0, PolygonId, LineId, POLYGON_SIDE_RIGHT); } @@ -1191,20 +1211,23 @@ } } else if (wp->flags & AREA) { + RoadMapArea *polyarea; add_as_poly: + LandmarkId++; PolygonId++; - buildmap_polygon_add_landmark (PolygonId, wp->layer, rms_name); - buildmap_polygon_add(PolygonId, 0, PolygonId); + buildmap_info("adding %s as polygon %d", wp->name, PolygonId); + buildmap_polygon_add_landmark (LandmarkId, wp->layer, rms_name); + buildmap_polygon_add(LandmarkId, 0, PolygonId, &polyarea); - wp->lineid = add_shaped_line(way, rms_name, wp->layer, 1); + add_line(wp, way, rms_name, wp->layer, 1, polyarea); } else { add_as_way: buildmap_debug ("Way %lld [%s]", way->id, wp->name ? wp->name : ""); - wp->lineid = add_shaped_line(way, rms_name, - wp->layer ? wp->layer: wp->relation_layer, 0); + add_line(wp, way, rms_name, + wp->layer ? wp->layer: wp->relation_layer, 0, NULL); } return READOSM_OK; } @@ -1312,12 +1335,14 @@ return READOSM_OK; } -static void add_multipolygon(wayinfo **wayinfos, int layer, int rms_name, int count) +static void add_multipolygon(wayinfo **wayinfos, int layer, + int rms_name, int count, char *name) { wayinfo *wp, *wp2; nodeid_t from = 0, to = 0; int ring = 0; int i, j; + // RoadMapArea *polyarea; for (i = 0; i < count; i++) { wp = wayinfos[i]; @@ -1325,9 +1350,11 @@ wp->ring = ++ring; PolygonId++; - buildmap_polygon_add_landmark (PolygonId, layer, rms_name); - buildmap_polygon_add(PolygonId, 0, PolygonId); + buildmap_info("add_multi: adding %s as polygon %d", name, PolygonId); + buildmap_polygon_add(LandmarkId, 0, PolygonId, 0); // &polyarea); buildmap_polygon_add_line (0, PolygonId, wp->lineid, POLYGON_SIDE_RIGHT); + if (wp->lineid2) + buildmap_polygon_add_line (0, PolygonId, wp->lineid2, POLYGON_SIDE_RIGHT); from = wp->from; to = wp->to; @@ -1344,16 +1371,22 @@ if (wp2->from == to) { wp2->ring = ring; // FIXME it's possible that a way may have more than one lineid, as -// a result of being a circular way that's been split in two in add_shaped_line(). +// a result of being a circular way that's been split in two in add_line(). // we should record both and add both here. buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_RIGHT); + if (wp2->lineid2) + buildmap_polygon_add_line (0, PolygonId, wp2->lineid2, + POLYGON_SIDE_RIGHT); to = wp2->to; j = i; } else if (wp2->to == to) { wp2->ring = ring; buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_LEFT); + if (wp2->lineid2) + buildmap_polygon_add_line (0, PolygonId, wp2->lineid2, + POLYGON_SIDE_LEFT); to = wp2->from; j = i; } else { @@ -1387,11 +1420,11 @@ if (!rp) return READOSM_OK; - // buildmap_info("warning: relation %s is interesting", rp->name); + buildmap_info("warning: relation %s is interesting", rp->name); // note: assumes this is a multipolygon relation - PolygonId++; + LandmarkId++; rms_name = str2dict(DictionaryStreet, rp->name); @@ -1422,9 +1455,11 @@ } } - add_multipolygon(wayinfos, rp->layer, rms_name, wc); + buildmap_polygon_add_landmark (LandmarkId, rp->layer, rms_name); + + add_multipolygon(wayinfos, rp->layer, rms_name, wc, rp->name); // FIXME: shouldn't _always_ be l_island - add_multipolygon(innerwayinfos, l_island, rms_name, iwc); + add_multipolygon(innerwayinfos, l_island, rms_name, iwc, rp->name); free(wayinfos); free(innerwayinfos); Modified: trunk/roadmap/src/buildmap_polygon.c =================================================================== --- trunk/roadmap/src/buildmap_polygon.c 2015-10-20 15:07:40 UTC (rev 2979) +++ trunk/roadmap/src/buildmap_polygon.c 2015-10-20 15:07:43 UTC (rev 2980) @@ -98,6 +98,8 @@ int count; int sorted; + RoadMapArea area; + } BuildMapPolygon; typedef struct { @@ -246,11 +248,13 @@ } } -/* FIXME. this is called with the endpoints of every line. it +/* this is called with the endpoints of every line. it * misses all of the shape points for the line, so the bounding * box is a poor approximation, at best. "long lines" have the * same problem (but in practice, not as bad -- polygons tend to * have bigger bounding boxes than lines, even long ones). + * this problem is fixed for OSM maps by calculating the fully-shaped + * bbox. */ static void buildmap_polygon_adjust_bbox (RoadMapPolygon *polygon, int from, int to) { @@ -304,12 +308,16 @@ BuildMapPolygonLine *this_line; BuildMapPolygonLine *other_line; RoadMapArea *pa = &polygon->area; + int adjust_bbox = 0; first = polygon->first; count = polygon->count; - pa->west = pa->south = 180000000; - pa->east = pa->north = -180000000; + if (pa->west == -1) { + adjust_bbox = 1; + pa->west = pa->south = 180000000; + pa->east = pa->north = -180000000; + } end = first + count - 1; @@ -320,7 +328,8 @@ buildmap_line_get_points_sorted (this_line->line, &from, &to); - buildmap_polygon_adjust_bbox(polygon, from, to); + if (adjust_bbox) + buildmap_polygon_adjust_bbox(polygon, from, to); if (this_line->side == POLYGON_SIDE_LEFT) { /* draw from 'to' to 'from' */ @@ -408,7 +417,8 @@ this_line = PolygonLine[index/BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); buildmap_line_get_points_sorted (this_line->line, &from, &to); - buildmap_polygon_adjust_bbox(polygon, from, to); + if (adjust_bbox) + buildmap_polygon_adjust_bbox(polygon, from, to); /* check that the last line connects with the first */ if (this_line->side == POLYGON_SIDE_LEFT) { @@ -510,7 +520,7 @@ } -int buildmap_polygon_add (int landid, RoadMapString cenid, int polyid) { +int buildmap_polygon_add (int landid, RoadMapString cenid, int polyid, RoadMapArea **areap) { int block; int offset; @@ -523,7 +533,7 @@ this_landmark = buildmap_polygon_search_landmark (landid); if (this_landmark == NULL) { - return -1; + buildmap_fatal(0, "no landmark %d for polygon %d", landid, polyid); } block = PolygonCount / BUILDMAP_BLOCK; @@ -553,6 +563,19 @@ this_polygon->square[2] = -1; this_polygon->square[3] = -1; + if (areap) { + *areap = &this_polygon->area; + this_polygon->area.west = this_polygon->area.south = 180000000; + this_polygon->area.east = this_polygon->area.north = -180000000; + } else { + // attempt to preserve compatibility for tiger maps + // this will cause the bbox to be calculated in + // buildmap_polygon_fill_in_drawing_order(), as was + // done in the past. for OSM maps, it's done while + // we add the lines in buildmap_text_osm.c + this_polygon->area.west = -1; + } + this_polygon->count = 0; roadmap_hash_add (PolygonByPolyid, polyid, PolygonCount); @@ -984,6 +1007,7 @@ return 1; } db_poly->count = one_polygon->count; + db_poly->area = one_polygon->area; square = one_polygon->square[0]; Modified: trunk/roadmap/src/buildmap_polygon.h =================================================================== --- trunk/roadmap/src/buildmap_polygon.h 2015-10-20 15:07:40 UTC (rev 2979) +++ trunk/roadmap/src/buildmap_polygon.h 2015-10-20 15:07:43 UTC (rev 2980) @@ -27,7 +27,8 @@ #define POLYGON_SIDE_LEFT 0 #define POLYGON_SIDE_RIGHT 1 -int buildmap_polygon_add (int landid, RoadMapString cenid, int polyid); +int buildmap_polygon_add + (int landid, RoadMapString cenid, int polyid, RoadMapArea **areap); int buildmap_polygon_add_landmark (int landid, int cfcc, RoadMapString name); int buildmap_polygon_add_line Modified: trunk/roadmap/src/buildmap_tiger.c =================================================================== --- trunk/roadmap/src/buildmap_tiger.c 2015-10-20 15:07:40 UTC (rev 2979) +++ trunk/roadmap/src/buildmap_tiger.c 2015-10-20 15:07:43 UTC (rev 2980) @@ -990,7 +990,7 @@ cenid = tiger2string (dictionary_cenid, cursor, 11, 15); polyid = tiger2int (cursor, 16, 25); - buildmap_polygon_add (landid, cenid, polyid); + buildmap_polygon_add (landid, cenid, polyid, 0); record_count += 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:42
|
Revision: 2979 http://sourceforge.net/p/roadmap/code/2979 Author: pgf Date: 2015-10-20 15:07:40 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_line.c: rename long line routines easier to find with more standard names Modified Paths: -------------- trunk/roadmap/src/buildmap_line.c trunk/roadmap/src/buildmap_line.h trunk/roadmap/src/buildmap_shape.c Modified: trunk/roadmap/src/buildmap_line.c =================================================================== --- trunk/roadmap/src/buildmap_line.c 2015-10-20 15:07:37 UTC (rev 2978) +++ trunk/roadmap/src/buildmap_line.c 2015-10-20 15:07:40 UTC (rev 2979) @@ -280,7 +280,7 @@ * @param sorted_line * @return */ -static void buildmap_line_new_long (int sorted_line) +static void buildmap_long_line_add (int sorted_line) { int from; @@ -324,7 +324,7 @@ * @param latitude * @return */ -void buildmap_line_test_long (int sorted_line, int longitude, int latitude) { +void buildmap_long_line_test (int sorted_line, int longitude, int latitude) { RoadMapLongLine *this_long_line; int from; int to; @@ -351,7 +351,7 @@ } } - buildmap_line_new_long(sorted_line); + buildmap_long_line_add(sorted_line); } @@ -625,7 +625,7 @@ } if ( ! BuildMapNoLongLines) { if (!buildmap_square_is_adjacent (from_square, to_square)) - buildmap_line_new_long(i); + buildmap_long_line_add(i); } } if (j != LineCrossingCount) { Modified: trunk/roadmap/src/buildmap_line.h =================================================================== --- trunk/roadmap/src/buildmap_line.h 2015-10-20 15:07:37 UTC (rev 2978) +++ trunk/roadmap/src/buildmap_line.h 2015-10-20 15:07:40 UTC (rev 2979) @@ -38,7 +38,7 @@ void buildmap_line_sort (void); -void buildmap_line_test_long (int line, int longitude, int latitude); +void buildmap_long_line_test (int line, int longitude, int latitude); void buildmap_line_oneway(int way, int oneway); void buildmap_line_layer(int way, int layer); Modified: trunk/roadmap/src/buildmap_shape.c =================================================================== --- trunk/roadmap/src/buildmap_shape.c 2015-10-20 15:07:37 UTC (rev 2978) +++ trunk/roadmap/src/buildmap_shape.c 2015-10-20 15:07:40 UTC (rev 2979) @@ -141,7 +141,7 @@ } } - buildmap_line_test_long (line, longitude, latitude); + buildmap_long_line_test (line, longitude, latitude); /* This shape was not known yet: create a new one. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:39
|
Revision: 2978 http://sourceforge.net/p/roadmap/code/2978 Author: pgf Date: 2015-10-20 15:07:37 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm: improve handling of islands in particular, handle explicit "place = island" tag/value pairs Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layer_list.h trunk/roadmap/src/buildmap_osm_layers.h trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_layer_list.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layer_list.h 2015-10-20 15:07:34 UTC (rev 2977) +++ trunk/roadmap/src/buildmap_osm_layer_list.h 2015-10-20 15:07:37 UTC (rev 2978) @@ -24,6 +24,7 @@ // layer_define( Canals ) layer_define( Lakes ) // layer_define( Sea ) +layer_define( Islands ) layer_define( Nature ) layer_define( Peak ) Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:07:34 UTC (rev 2977) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-10-20 15:07:37 UTC (rev 2978) @@ -216,6 +216,7 @@ { "village", &Village, PLACE }, { "hamlet", &Hamlet, PLACE }, { "suburb", &Suburbs, PLACE }, + { "island", &Islands, AREA }, { 0, NULL, 0 }, }; @@ -266,7 +267,7 @@ {"landuse", landuse_to_layer, ANY }, {"aeroway", aeroway_to_layer, ANY }, {"natural", natural_to_layer, ANY }, - {"place", place_to_layer, PLACE }, + {"place", place_to_layer, ANY }, { 0, NULL, 0 }, }; Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:34 UTC (rev 2977) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:37 UTC (rev 2978) @@ -1122,6 +1122,8 @@ if (polygon) buildmap_polygon_add_line (0, PolygonId, LineId, POLYGON_SIDE_RIGHT); } +// FIXME see comment below about lineids from ways that have been +// split in two. we should be recording both LineIds. return LineId; } /** @@ -1310,7 +1312,7 @@ return READOSM_OK; } -static void add_multipolygon(wayinfo **wayinfos, relinfo *rp, int layer, int rms_name, int count) +static void add_multipolygon(wayinfo **wayinfos, int layer, int rms_name, int count) { wayinfo *wp, *wp2; nodeid_t from = 0, to = 0; @@ -1341,6 +1343,9 @@ if (wp2->from == to) { wp2->ring = ring; +// FIXME it's possible that a way may have more than one lineid, as +// a result of being a circular way that's been split in two in add_shaped_line(). +// we should record both and add both here. buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_RIGHT); to = wp2->to; @@ -1373,9 +1378,9 @@ parse_relation_final(const void *user_data, const readosm_relation * relation) { relinfo *rp; - wayinfo *wp, **wayinfos; + wayinfo *wp, **wayinfos, **innerwayinfos; const readosm_member *member; - int i, wc; + int i, wc, iwc; RoadMapString rms_name; rp = isRelationInteresting(relation->id); @@ -1392,20 +1397,22 @@ wayinfos = calloc(relation->member_count, sizeof(*wayinfos)); buildmap_check_allocated(wayinfos); + innerwayinfos = calloc(relation->member_count, sizeof(*wayinfos)); + buildmap_check_allocated(innerwayinfos); - wc = 0; + wc = iwc = 0; for (i = 0; i < relation->member_count; i++) { member = relation->members + i; switch(member->member_type) { case READOSM_MEMBER_WAY: - if (strcmp(member->role, "outer") != 0 && - strcmp(member->role, "") != 0) { - continue; - } wp = isWayInteresting(member->id); if (!wp->lineid) buildmap_fatal(0, "found null lineid"); - wayinfos[wc++] = wp; + if (strcmp(member->role, "inner") == 0) { + innerwayinfos[iwc++] = wp; + } else { + wayinfos[wc++] = wp; + } break; case READOSM_MEMBER_NODE: @@ -1415,9 +1422,12 @@ } } - add_multipolygon(wayinfos, rp, rp->layer, rms_name, wc); + add_multipolygon(wayinfos, rp->layer, rms_name, wc); + // FIXME: shouldn't _always_ be l_island + add_multipolygon(innerwayinfos, l_island, rms_name, iwc); free(wayinfos); + free(innerwayinfos); return READOSM_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:36
|
Revision: 2977 http://sourceforge.net/p/roadmap/code/2977 Author: pgf Date: 2015-10-20 15:07:34 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: remove debug output Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:31 UTC (rev 2976) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:34 UTC (rev 2977) @@ -1215,7 +1215,6 @@ const char *name = 0; int is_multipolygon = 0; int layer = 0, flags = 0; - int waslayer; int is_building = 0; int is_water = 0; const char *tourism = NULL, *amenity = NULL; @@ -1245,7 +1244,6 @@ } } else if (strcasecmp(tag->key, "name") == 0) { name = tag->value; - buildmap_info("warning: relation has name %s", name); } else if (strcasecmp(tag->key, "building") == 0) { is_building = 1; } else if (strcasecmp(tag->key, "tourism") == 0) { @@ -1257,10 +1255,7 @@ is_water = 1; } - waslayer = layer; buildmap_osm_get_layer(AREA, tag->key, tag->value, &flags, &layer); - if (!waslayer && layer) - buildmap_info("relation %u has layer %s/%s", relation->id, tag->key, tag->value); } /* only save buildings that are amenities or touristic */ @@ -1308,7 +1303,6 @@ break; } } - // buildmap_info("warning: save interesting relation %s", name); saveInterestingRelation(relation->id, name ? strdup(name) : 0, layer, flags); } @@ -1323,20 +1317,15 @@ int ring = 0; int i, j; - buildmap_info("relation %d adding multipolygon", rp->id); - // for (wp = wayinfos; wp < wayinfos + count; wp++) { for (i = 0; i < count; i++) { wp = wayinfos[i]; if (wp->ring) continue; wp->ring = ++ring; PolygonId++; - buildmap_info("adding polygon %d ring %d", PolygonId, ring); buildmap_polygon_add_landmark (PolygonId, layer, rms_name); buildmap_polygon_add(PolygonId, 0, PolygonId); - buildmap_info("adding first line %d (way %d) to polygon %d", wp->lineid, wp->id, PolygonId); buildmap_polygon_add_line (0, PolygonId, wp->lineid, POLYGON_SIDE_RIGHT); - buildmap_info(" from %d to %d", wp->from, wp->to); from = wp->from; to = wp->to; @@ -1352,16 +1341,12 @@ if (wp2->from == to) { wp2->ring = ring; - buildmap_info("adding right line %d (way %d) to polygon %d", wp2->lineid, wp2->id, PolygonId); - buildmap_info(" from %d to %d", wp2->from, wp2->to); buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_RIGHT); to = wp2->to; j = i; } else if (wp2->to == to) { wp2->ring = ring; - buildmap_info("adding left line %d (way %d) to polygon %d", wp2->lineid, wp2->id, PolygonId); - buildmap_info(" from %d to %d", wp2->from, wp2->to); buildmap_polygon_add_line (0, PolygonId, wp2->lineid, POLYGON_SIDE_LEFT); to = wp2->from; @@ -1397,7 +1382,7 @@ if (!rp) return READOSM_OK; - buildmap_info("warning: relation %s is interesting", rp->name); + // buildmap_info("warning: relation %s is interesting", rp->name); // note: assumes this is a multipolygon relation @@ -1483,7 +1468,6 @@ if (tileid) is_tile = (void *)1; buildmap_info("Starting pass %d", pass); - // buildmap_set_source("pass %d", pass); fp = buildmap_osm_text_fopen(fn); ret = readosm_fopen(fp, READOSM_OSM_FORMAT, &handle); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:33
|
Revision: 2976 http://sourceforge.net/p/roadmap/code/2976 Author: pgf Date: 2015-10-20 15:07:31 +0000 (Tue, 20 Oct 2015) Log Message: ----------- buildmap_osm_text.c: handle islands in lakes, as best we can "you are in a maze of twisty little heuristics, all different" Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:28 UTC (rev 2975) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-10-20 15:07:31 UTC (rev 2976) @@ -118,7 +118,7 @@ static int PolygonId = 0; static int LineId = 0; -static int l_shoreline, l_boundary; +static int l_shoreline, l_boundary, l_lake, l_island; static int nRels, nWays, nNodes; /** @@ -857,7 +857,7 @@ int layer = 0, flags = 0; const char *name = 0, *ref = 0; wayinfo *wp; - int has_relation_layer, has_relation_flags; + int relation_layer, relation_flags; int i; nWays++; @@ -866,8 +866,10 @@ * found then. */ wp = isWayInteresting(way->id); if (wp) { - has_relation_layer = wp->relation_layer; - has_relation_flags = wp->relation_flags; + relation_layer = wp->relation_layer; + relation_flags = wp->relation_flags; + layer = wp->layer; + flags = wp->flags; } if (way->node_ref_count < 2) { @@ -876,7 +878,7 @@ /* if we're processing a quadtile, don't include any * ways that our neighbors already include */ - if (is_tile && buildmap_osm_text_check_neighbor_way(way->id) && !has_relation_layer) { + if (is_tile && buildmap_osm_text_check_neighbor_way(way->id) && !relation_layer) { buildmap_verbose("dropping way %lld because a neighbor " "already has it", way->id); return READOSM_OK; @@ -908,8 +910,11 @@ is_coast = 1; } - // really? - buildmap_osm_get_layer(ANY, tag->key, tag->value, &flags, &layer); + // in some cases we set the way's layer in parse_relation(), + // so we don't want to override it here. this also means + // that otherwise, first tag to set the layer wins. + if (!layer) + buildmap_osm_get_layer(ANY, tag->key, tag->value, &flags, &layer); } @@ -967,18 +972,20 @@ out: - if (layer || has_relation_layer) { + if (layer || relation_layer) { const char *n = road_name(name, ref); if (wp) { if (n) wp->name = strdup(n); - if (layer) { - wp->layer = layer; - wp->flags = flags; - } else { - wp->layer = has_relation_layer; - wp->flags = has_relation_flags; + if (!wp->layer) { + if (layer) { + wp->layer = layer; + wp->flags = flags; + } else { + wp->layer = relation_layer; + wp->flags = relation_flags; + } } wp->from = way->node_refs[0]; wp->to = way->node_refs[way->node_ref_count-1]; @@ -1183,9 +1190,6 @@ } else if (wp->flags & AREA) { add_as_poly: - /* - * Detect an AREA -> create a polygon - */ PolygonId++; buildmap_polygon_add_landmark (PolygonId, wp->layer, rms_name); @@ -1194,8 +1198,6 @@ wp->lineid = add_shaped_line(way, rms_name, wp->layer, 1); } else { add_as_way: - /* Street name */ - // buildmap_debug ("Way %lld [%s] ref [%s]", way->id, buildmap_debug ("Way %lld [%s]", way->id, wp->name ? wp->name : ""); @@ -1215,6 +1217,7 @@ int layer = 0, flags = 0; int waslayer; int is_building = 0; + int is_water = 0; const char *tourism = NULL, *amenity = NULL; int i; @@ -1249,15 +1252,13 @@ tourism = tag->value; } else if (strcasecmp(tag->key, "amenity") == 0) { amenity = tag->value; -#if 0 } else if (strcasecmp(tag->key, "natural") == 0 && - strcasecmp(tag->key, "coastline") == 0) { - is_coast = 1; -#endif + strcasecmp(tag->value, "water") == 0) { + is_water = 1; } waslayer = layer; - buildmap_osm_get_layer(PLACE, tag->key, tag->value, &flags, &layer); + buildmap_osm_get_layer(AREA, tag->key, tag->value, &flags, &layer); if (!waslayer && layer) buildmap_info("relation %u has layer %s/%s", relation->id, tag->key, tag->value); } @@ -1277,12 +1278,26 @@ if (is_multipolygon && layer) { for (i = 0; i < relation->member_count; i++) { + int innerlayer = 0; + int innerflags = 0; + member = relation->members + i; switch(member->member_type) { case READOSM_MEMBER_WAY: + if (is_water) { + if (strcmp(member->role, "inner") == 0) { + innerlayer = l_island; + } else if (strcmp(member->role, "outer") == 0 + || strcmp(member->role, "") == 0) { + innerlayer = l_lake; + } + innerflags = AREA; + } if (!isWayInteresting(member->id)) { - saveInterestingWay(member->id, 0, 0, 0, 0, layer, flags, relation->id); - qsort(WayTable, nWayTable, sizeof(*WayTable), qsort_compare_osm_ids); + saveInterestingWay(member->id, 0, 0, innerlayer, + innerflags, layer, flags, relation->id); + qsort(WayTable, nWayTable, sizeof(*WayTable), + qsort_compare_osm_ids); nSearchableWays = nWayTable; } break; @@ -1294,7 +1309,8 @@ } } // buildmap_info("warning: save interesting relation %s", name); - saveInterestingRelation(relation->id, name ? strdup(name) : 0, layer, flags); + saveInterestingRelation(relation->id, name ? strdup(name) : 0, + layer, flags); } return READOSM_OK; @@ -1537,6 +1553,8 @@ buildmap_osm_common_find_layers (); l_shoreline = buildmap_layer_get("shore");; l_boundary = buildmap_layer_get("boundaries");; + l_lake = buildmap_layer_get("lakes");; + l_island = buildmap_layer_get("islands");; nRels = 0; nWays = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-10-20 15:07:30
|
Revision: 2975 http://sourceforge.net/p/roadmap/code/2975 Author: pgf Date: 2015-10-20 15:07:28 +0000 (Tue, 20 Oct 2015) Log Message: ----------- default/All: add Islands layer, used for auto-detected islands in lakes Modified Paths: -------------- trunk/roadmap/src/default/All Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-10-20 15:07:25 UTC (rev 2974) +++ trunk/roadmap/src/default/All 2015-10-20 15:07:28 UTC (rev 2975) @@ -1,6 +1,6 @@ Class.Name: All Class.Lines: Freeways Ramps Highways Streets Trails Rivers Shore Railroads Boundaries -Class.Polygons: Lakes Sea Parks Hospitals Airports Stations Schools Malls Nature Amenity +Class.Polygons: Islands Lakes Sea Parks Hospitals Airports Stations Schools Malls Nature Amenity Class.Places: City Town Village Hamlet Suburbs Food Cafe Drinks Fuel ATM Hotel Motel Guesthouse Hostel Class.NavigationModes: Car Bike Foot Boat Navigation.Car: Freeways Ramps Highways Streets @@ -95,6 +95,10 @@ .Declutter: 600 .Thickness: 1 .Speed: 1 +Islands.Color: lightyellow + .Declutter: 600 + .Thickness: 1 + .Speed: 1 Peak.Color: brown .Declutter: 1000 Amenity.Color: orange This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |