From 32fed3b78a44c0d9bf3bf4d256d88ef97f15bdf7 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 28 Jun 2016 15:27:19 -0700 Subject: [PATCH] Add the CRS to the tippecanoe-decode output if nonstandard --- CHANGELOG.md | 4 ++++ decode.cpp | 6 ++++++ tests/pbf/11-328-791.3857.json | 2 +- version.hpp | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccdcdbf9..c8656d71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.12.2 + +* Add ability to specify a projection to tippecanoe-decode + ## 1.12.1 * Fix incorrect tile layer version numbers in tile-join output diff --git a/decode.cpp b/decode.cpp index 38ff7362..3b90100d 100644 --- a/decode.cpp +++ b/decode.cpp @@ -64,6 +64,12 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) { if (describe) { printf(", \"properties\": { \"zoom\": %d, \"x\": %d, \"y\": %d }", z, x, y); + + if (projection != projections) { + printf(", \"crs\": { \"type\": \"name\", \"properties\": { \"name\": "); + printq(projection->alias); + printf(" } }"); + } } printf(", \"features\": [\n"); diff --git a/tests/pbf/11-328-791.3857.json b/tests/pbf/11-328-791.3857.json index df752279..71863d56 100644 --- a/tests/pbf/11-328-791.3857.json +++ b/tests/pbf/11-328-791.3857.json @@ -1,4 +1,4 @@ -{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 328, "y": 791 }, "features": [ +{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 328, "y": 791 }, "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3857" } }, "features": [ { "type": "FeatureCollection", "properties": { "layer": "macarthur", "version": 1, "extent": 4096 }, "features": [ { "type": "Feature", "properties": { "LINEARID": "1104485645649", "FULLNAME": "W Macarthur Blvd", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -13612111.421538, 4555240.804753 ], [ -13612183.081252, 4555231.250125 ], [ -13612426.724279, 4555159.590410 ], [ -13612522.270565, 4555145.258468 ], [ -13612646.480736, 4555111.817268 ], [ -13612665.589993, 4555130.926525 ] ] } } , diff --git a/version.hpp b/version.hpp index c88c995e..e9ceef82 100644 --- a/version.hpp +++ b/version.hpp @@ -1 +1 @@ -#define VERSION "tippecanoe v1.12.1\n" +#define VERSION "tippecanoe v1.12.2\n"