From feacae92ef3b07b29753176170c86cc4678f529c Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Tue, 23 Jul 2019 22:47:35 +0200 Subject: [PATCH] output all GeoJSON as WGS84 to be RFC 7946 conform --- geo/pfaedle.qgs | 9558 +++++++++++--------- src/pfaedle/PfaedleMain.cpp | 8 +- src/pfaedle/eval/Collector.cpp | 4 +- src/pfaedle/router/Misc.h | 9 + src/pfaedle/router/ShapeBuilder.cpp | 2 +- src/util/geo/output/GeoGraphJsonOutput.h | 10 + src/util/geo/output/GeoGraphJsonOutput.tpp | 32 +- src/util/geo/output/GeoJsonOutput.h | 12 +- src/util/geo/output/GeoJsonOutput.tpp | 16 + 9 files changed, 5369 insertions(+), 4282 deletions(-) diff --git a/geo/pfaedle.qgs b/geo/pfaedle.qgs index edfabfd..2ec03bf 100644 --- a/geo/pfaedle.qgs +++ b/geo/pfaedle.qgs @@ -1,91 +1,70 @@ - + + - + + + + +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs + 3857 + 3857 + EPSG:3857 + WGS 84 / Pseudo-Mercator + merc + WGS84 + false + + + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - - - - meters - - 995121.91129447647836059 - 6259104.80718581937253475 - 1006900.15504457184579223 - 6270619.10718505643308163 - - 0 - 1 - - - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc - WGS84 - false - - - 0 - - - - - - - - - - OGRGeoJSON_Point20180203134333739 OGRGeoJSON_LineString20180203134333975 @@ -97,69 +76,106 @@ OSM_Transportation20181215024818603 OpenStreetMap_de20181215024846026 - + + + + + + + + + + + + + + + meters + + -374853.74009754881262779 + 4605645.85081499628722668 + 2640376.65992686524987221 + 7553306.65061968378722668 + + 0 + + + +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs + 3857 + 3857 + EPSG:3857 + WGS 84 / Pseudo-Mercator + merc + WGS84 + false + + + 0 + + - - + + - + - + - + - + + - + - 875390.4375 - 6113024.5 - 875455.125 - 6113045.5 + 6.70734330570000026 + 47.04982400000000098 + 6.77521899999999988 + 47.07313500000000062 OGRGeoJSON_LineString20180203134333975 ./graph.json @@ -169,1294 +185,1740 @@ OGRGeoJSON LineString - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + 1 + 1 + 1 + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 0 - station_name - - - - - - + 1 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - . + + + + + . 0 . @@ -1479,35 +1941,61 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + station_name + - + + + 6.70734330570000026 + 47.05522500000000008 + 6.74796900000000033 + 47.06722252349999991 + OGRGeoJSON_LineString20180206114956229 ./combgraph.json|layerid=0|subset="dummy" = 'no' @@ -1516,413 +2004,490 @@ def my_form_open(dialog, layer, feature): OGRGeoJSON LineString - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + 1 + 1 + 1 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 0 - station_name - - - - - - - + 1 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - . + + + + + . 0 . @@ -1945,40 +2510,58 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + station_name + - + - 842634.8125 - 6090818 - 884707.25 - 6121615.5 + 6.70734330570000026 + 47.04982400000000098 + 6.77521899999999988 + 47.07313500000000062 OGRGeoJSON_Point20180203134333739 ./graph.json @@ -1988,494 +2571,625 @@ def my_form_open(dialog, layer, feature): OGRGeoJSON Point - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + 1 + 1 + 1 + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 0 - station_name - - - - - - - + 1 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - . + + + + + . 0 . @@ -2498,42 +3212,65 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + station_name + - + + + 6.70734330570000026 + 47.05522500000000008 + 6.74796900000000033 + 47.06722252349999991 + OGRGeoJSON_Point20180206114956218 ./combgraph.json @@ -2542,352 +3279,442 @@ def my_form_open(dialog, layer, feature): OGRGeoJSON Point - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + 1 + 1 + 1 + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 0 - station_name - - - - - - + 1 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - . + + + + + . 0 . @@ -2910,34 +3737,53 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + station_name + - + -20037508.34278924390673637 -20037508.34278925508260727 @@ -2945,7 +3791,7 @@ def my_form_open(dialog, layer, feature): 20037508.34278924390673637 OSM_Transportation20181215024818603 - type=xyz&zmin=0&zmax=19&url=http://tile.thunderforest.com/transport/{z}/{x}/{y}.png + crs=EPSG:3857&format&type=xyz&url=http://tile.thunderforest.com/transport/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0 @@ -2957,33 +3803,70 @@ def my_form_open(dialog, layer, feature): 3857 3857 EPSG:3857 - WGS 84 / Pseudo Mercator + WGS 84 / Pseudo-Mercator merc WGS84 false - - - + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + wms - + - - + + + + 1 + 1 + 1 + + + + - + + + None + WholeRaster + Estimated + 0.02 + 0.98 + 2 + - + 0 - + -20037508.34278924390673637 -20037508.34278925508260727 @@ -2991,7 +3874,7 @@ def my_form_open(dialog, layer, feature): 20037508.34278924390673637 OpenStreetMap_de20181215024846026 - type=xyz&zmin=0&zmax=18&url=http://a.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png + crs=EPSG:3857&format&type=xyz&url=http://a.tile.openstreetmap.de/tiles/osmde/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=18&zmin=0 @@ -3003,38 +3886,75 @@ def my_form_open(dialog, layer, feature): 3857 3857 EPSG:3857 - WGS 84 / Pseudo Mercator + WGS 84 / Pseudo-Mercator merc WGS84 false - - - + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + wms - + - - + + + + 1 + 1 + 1 + + + + - + + + None + WholeRaster + Estimated + 0.02 + 0.98 + 2 + - + 0 - + - 735429.75 - 5862813.5 - 738946.375 - 5867690 + 6.70738836720000009 + 47.05522500000000008 + 6.74579299999999993 + 47.06721104129999844 path20180217155708341 ./path.json @@ -3044,322 +3964,203 @@ def my_form_open(dialog, layer, feature): path - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - - - - - + + + 1 + 1 + 1 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 30 - ver - - - - - - + 0.7 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . - - - + + + + + + + + + + + - - + + + + + + + + - - . + + + + + . 0 . @@ -3382,17 +4183,13 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + - - - - - - - + ver - + trgraph_trgraph_LineString20180508200527144 ./trgraph.json|layerid=0|geometrytype=LineString @@ -3401,1270 +4198,1566 @@ def my_form_open(dialog, layer, feature): trgraph trgraph LineString - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - + + + 1 + 1 + 1 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 0 - id - - - - - - - + 1 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . + + + + + + + + + + - - + + + + + + + + - - . + + + + + . 0 . @@ -4687,15 +5780,13 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + - - - - - + id - + trgraph_trgraph_Point20180508200527256 ./trgraph.json|layerid=0|geometrytype=Point @@ -4704,260 +5795,155 @@ def my_form_open(dialog, layer, feature): trgraph trgraph Point - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - 3857 - 3857 - EPSG:3857 - WGS 84 / Pseudo Mercator - merc + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat WGS84 - false + true + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + ogr + + - - + + - - + + + 1 + 1 + 1 + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 0 - 0 - id - - - - - - + 1 + + + + - - - - - - - - - - - - - - - - - - - - - - - - . + + + + + + + + + + - - + + + + + + + + - - . + + + + + . 0 . @@ -4980,66 +5966,114 @@ def my_form_open(dialog, layer, feature): ]]> 0 generatedlayout + + - - - - - + id + + + + + + + + + + + + + 255 + + + + + true + + + + + + +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs + EPSG:3857 + 3857 + 1 + + + meters + m2 + + + + + + false + + + + + + + + + + 30 + false + true + 0 + false + 0 + 16 + 50 + false + + false + + + 2 + D + true + + + + + + conditions unknown + + false - - - false - - - - - - - false - - - - - - 2 - true - D - - - false - - - false - - WGS84 - - 8 - false - - - - - - 0 - 240 - 240 - 255 - 255 255 + 255 240 + 0 + 240 + 255 + 240 + 90 + + + + - 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + off OGRGeoJSON_LineString20180203134333975 OGRGeoJSON_LineString20180206114956229 @@ -5049,6 +6083,27 @@ def my_form_open(dialog, layer, feature): trgraph_trgraph_LineString20180508200527144 trgraph_trgraph_Point20180508200527256 + + + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + + 0 + 2 + + to_vertex + to_vertex + to_vertex + to_vertex + to_vertex + to_vertex_and_segment + to_vertex_and_segment + enabled enabled @@ -5059,69 +6114,34 @@ def my_form_open(dialog, layer, feature): disabled current_layer - - - 2 - 2 - 2 - 2 - 2 - 2 - 2 - - - to_vertex - to_vertex - to_vertex - to_vertex - to_vertex - to_vertex_and_segment - to_vertex_and_segment - - off - 0 - - 0.000000 - 0.000000 - 0.000000 - 0.000000 - 0.000000 - 0.000000 - 0.000000 - - - - + + WGS84 + + None - None - + false + + 8 false - - +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs - EPSG:3857 - 3857 - 1 - - - - - - true - 255 - - - conditions unknown - 90 - - meters - m2 - - + + + + + + + + + + + + + + diff --git a/src/pfaedle/PfaedleMain.cpp b/src/pfaedle/PfaedleMain.cpp index 974cead..e95bdd7 100644 --- a/src/pfaedle/PfaedleMain.cpp +++ b/src/pfaedle/PfaedleMain.cpp @@ -257,7 +257,7 @@ int main(int argc, char** argv) { util::geo::output::GeoGraphJsonOutput out; mkdir(cfg.dbgOutputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); std::ofstream fstr(cfg.dbgOutputPath + "/graph.json"); - out.print(*shapeBuilder.getGraph(), fstr); + out.printLatLng(*shapeBuilder.getGraph(), fstr); fstr.close(); } @@ -270,9 +270,7 @@ int main(int argc, char** argv) { auto l = shapeBuilder.shapeL(singleTrip); // reproject to WGS84 to match RFC 7946 - for (auto& p : l) { - p = util::geo::webMercToLatLng(p.getX(), p.getY()); - } + o.printLatLng(l, {}); o.flush(); pstr.close(); @@ -288,7 +286,7 @@ int main(int argc, char** argv) { LOG(INFO) << "Outputting trgraph" + filePost + ".json..."; mkdir(cfg.dbgOutputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); std::ofstream fstr(cfg.dbgOutputPath + "/trgraph" + filePost + ".json"); - out.print(ng, fstr); + out.printLatLng(ng, fstr); fstr.close(); } } catch (const xml::XmlFileException& ex) { diff --git a/src/pfaedle/eval/Collector.cpp b/src/pfaedle/eval/Collector.cpp index eba44c5..709830b 100644 --- a/src/pfaedle/eval/Collector.cpp +++ b/src/pfaedle/eval/Collector.cpp @@ -107,12 +107,12 @@ double Collector::add(const Trip* t, const Shape* oldS, const Shape& newS, LINE newLCut; for (auto oldL : oldSegs) { - gjout.print(oldL, util::json::Dict{{"ver", "old"}}); + gjout.printLatLng(oldL, util::json::Dict{{"ver", "old"}}); oldLCut.insert(oldLCut.end(), oldL.begin(), oldL.end()); } for (auto newL : newSegs) { - gjout.print(newL, util::json::Dict{{"ver", "new"}}); + gjout.printLatLng(newL, util::json::Dict{{"ver", "new"}}); newLCut.insert(newLCut.end(), newL.begin(), newL.end()); } diff --git a/src/pfaedle/router/Misc.h b/src/pfaedle/router/Misc.h index c477b09..5cb1862 100644 --- a/src/pfaedle/router/Misc.h +++ b/src/pfaedle/router/Misc.h @@ -57,6 +57,7 @@ struct RoutingOpts { bool noSelfHops; }; +// _____________________________________________________________________________ inline bool operator==(const RoutingOpts& a, const RoutingOpts& b) { return fabs(a.fullTurnPunishFac - b.fullTurnPunishFac) < 0.01 && fabs(a.fullTurnAngle - b.fullTurnAngle) < 0.01 && @@ -106,22 +107,27 @@ struct EdgeCost { double getValue() const { return _cost; } }; +// _____________________________________________________________________________ inline EdgeCost operator+(const EdgeCost& a, const EdgeCost& b) { return EdgeCost(a.getValue() + b.getValue()); } +// _____________________________________________________________________________ inline bool operator<=(const EdgeCost& a, const EdgeCost& b) { return a.getValue() <= b.getValue(); } +// _____________________________________________________________________________ inline bool operator==(const EdgeCost& a, const EdgeCost& b) { return a.getValue() == b.getValue(); } +// _____________________________________________________________________________ inline bool operator>(const EdgeCost& a, const EdgeCost& b) { return a.getValue() > b.getValue(); } +// _____________________________________________________________________________ template inline bool angSmaller(const Point& f, const Point& m, const Point& t, double ang) { @@ -152,6 +158,7 @@ typedef std::vector EdgeListHops; typedef std::set MOTs; +// _____________________________________________________________________________ inline MOTs motISect(const MOTs& a, const MOTs& b) { MOTs ret; for (auto mot : a) @@ -159,6 +166,7 @@ inline MOTs motISect(const MOTs& a, const MOTs& b) { return ret; } +// _____________________________________________________________________________ inline pfaedle::router::FeedStops writeMotStops(const pfaedle::gtfs::Feed* feed, const MOTs mots, const std::string& tid) { @@ -183,6 +191,7 @@ inline pfaedle::router::FeedStops writeMotStops(const pfaedle::gtfs::Feed* feed, return ret; } +// _____________________________________________________________________________ inline std::string getMotStr(const MOTs& mots) { bool first = false; std::string motStr; diff --git a/src/pfaedle/router/ShapeBuilder.cpp b/src/pfaedle/router/ShapeBuilder.cpp index b96f8a6..898b5c4 100644 --- a/src/pfaedle/router/ShapeBuilder.cpp +++ b/src/pfaedle/router/ShapeBuilder.cpp @@ -130,7 +130,7 @@ EdgeListHops ShapeBuilder::route(const router::NodeCandRoute& ncr, LOG(INFO) << "Outputting combgraph.json..."; std::ofstream pstr(_cfg.dbgOutputPath + "/combgraph.json"); GeoGraphJsonOutput o; - o.print(g, pstr); + o.printLatLng(g, pstr); } return ret; diff --git a/src/util/geo/output/GeoGraphJsonOutput.h b/src/util/geo/output/GeoGraphJsonOutput.h index dcfb98b..83976ce 100644 --- a/src/util/geo/output/GeoGraphJsonOutput.h +++ b/src/util/geo/output/GeoGraphJsonOutput.h @@ -18,13 +18,23 @@ namespace output { class GeoGraphJsonOutput { public: inline GeoGraphJsonOutput(){}; + + // print a graph to the provided path template void print(const util::graph::Graph& outG, std::ostream& str); + // print a graph to the provided path, but treat coordinates as Web Mercator coordinates and reproject to WGS84 + template + void printLatLng(const util::graph::Graph& outG, std::ostream& str); + private: template Line createLine(const util::geo::Point& a, const util::geo::Point& b); + + // print a graph to the provided path + template + void printImpl(const util::graph::Graph& outG, std::ostream& str, bool proj); }; #include "util/geo/output/GeoGraphJsonOutput.tpp" diff --git a/src/util/geo/output/GeoGraphJsonOutput.tpp b/src/util/geo/output/GeoGraphJsonOutput.tpp index c6341cc..803a983 100644 --- a/src/util/geo/output/GeoGraphJsonOutput.tpp +++ b/src/util/geo/output/GeoGraphJsonOutput.tpp @@ -16,6 +16,20 @@ Line GeoGraphJsonOutput::createLine(const util::geo::Point& a, template void GeoGraphJsonOutput::print(const util::graph::Graph& outG, std::ostream& str) { + printImpl(outG, str, false); +} + +// _____________________________________________________________________________ +template +void GeoGraphJsonOutput::printLatLng(const util::graph::Graph& outG, + std::ostream& str) { + printImpl(outG, str, true); +} + +// _____________________________________________________________________________ +template +void GeoGraphJsonOutput::printImpl(const util::graph::Graph& outG, + std::ostream& str, bool proj) { GeoJsonOutput _out(str); // first pass, nodes @@ -30,7 +44,11 @@ void GeoGraphJsonOutput::print(const util::graph::Graph& outG, auto addProps = n->pl().getAttrs(); props.insert(addProps.begin(), addProps.end()); - _out.print(*n->pl().getGeom(), props); + if (proj) { + _out.printLatLng(*n->pl().getGeom(), props); + } else { + _out.print(*n->pl().getGeom(), props); + } } // second pass, edges @@ -50,11 +68,19 @@ void GeoGraphJsonOutput::print(const util::graph::Graph& outG, auto a = *e->getFrom()->pl().getGeom(); if (e->getTo()->pl().getGeom()) { auto b = *e->getTo()->pl().getGeom(); - _out.print(createLine(a, b), props); + if (proj) { + _out.printLatLng(createLine(a, b), props); + } else { + _out.print(createLine(a, b), props); + } } } } else { - _out.print(*e->pl().getGeom(), props); + if (proj) { + _out.printLatLng(*e->pl().getGeom(), props); + } else { + _out.print(*e->pl().getGeom(), props); + } } } } diff --git a/src/util/geo/output/GeoJsonOutput.h b/src/util/geo/output/GeoJsonOutput.h index f4a8492..701521b 100644 --- a/src/util/geo/output/GeoJsonOutput.h +++ b/src/util/geo/output/GeoJsonOutput.h @@ -5,9 +5,9 @@ #ifndef UTIL_GEO_OUTPUT_GEOJSONOUTPUT_H_ #define UTIL_GEO_OUTPUT_GEOJSONOUTPUT_H_ +#include #include #include -#include #include "util/String.h" #include "util/geo/Geo.h" #include "util/json/Writer.h" @@ -21,10 +21,19 @@ class GeoJsonOutput { GeoJsonOutput(std::ostream& str); GeoJsonOutput(std::ostream& str, json::Val attrs); ~GeoJsonOutput(); + template void print(const Point& p, json::Val attrs); + template void print(const Line& l, json::Val attrs); + + template + void printLatLng(const Point& p, json::Val attrs); + + template + void printLatLng(const Line& l, json::Val attrs); + void flush(); private: @@ -32,7 +41,6 @@ class GeoJsonOutput { }; #include "util/geo/output/GeoJsonOutput.tpp" - } } } diff --git a/src/util/geo/output/GeoJsonOutput.tpp b/src/util/geo/output/GeoJsonOutput.tpp index 1f599cf..09f5c2a 100644 --- a/src/util/geo/output/GeoJsonOutput.tpp +++ b/src/util/geo/output/GeoJsonOutput.tpp @@ -46,3 +46,19 @@ void GeoJsonOutput::print(const Line& line, json::Val attrs) { _wr.val(attrs); _wr.close(); } + +// _____________________________________________________________________________ +template +void GeoJsonOutput::printLatLng(const Point& p, json::Val attrs) { + auto projP = util::geo::webMercToLatLng(p.getX(), p.getY()); + print(projP, attrs); +} + +// _____________________________________________________________________________ +template +void GeoJsonOutput::printLatLng(const Line& line, json::Val attrs) { + Line projL; + for (auto p : line) projL.push_back(util::geo::webMercToLatLng(p.getX(), p.getY())); + + print(projL, attrs); +}