mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-23 18:40:17 +00:00
Carry elevations all the way into decoding
This commit is contained in:
parent
c43e6d63f1
commit
00a74a535e
20
mvt.cpp
20
mvt.cpp
@ -313,6 +313,7 @@ bool mvt_tile::decode(std::string &message, bool &was_compressed) {
|
||||
protozero::pbf_reader feature_reader(layer_reader.get_message());
|
||||
mvt_feature feature;
|
||||
std::vector<uint32_t> geoms;
|
||||
std::vector<double> elevations;
|
||||
|
||||
while (feature_reader.next()) {
|
||||
switch (feature_reader.tag()) {
|
||||
@ -352,12 +353,22 @@ bool mvt_tile::decode(std::string &message, bool &was_compressed) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 6: /* elevations */
|
||||
{
|
||||
auto pi = feature_reader.get_packed_double();
|
||||
for (auto it = pi.first; it != pi.second; ++it) {
|
||||
elevations.push_back(*it);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
feature_reader.skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
size_t elevation_index = 0;
|
||||
long long px = 0, py = 0;
|
||||
for (size_t g = 0; g < geoms.size(); g++) {
|
||||
uint32_t geom = geoms[g];
|
||||
@ -370,7 +381,12 @@ bool mvt_tile::decode(std::string &message, bool &was_compressed) {
|
||||
py += protozero::decode_zigzag32(geoms[g + 2]);
|
||||
g += 2;
|
||||
|
||||
feature.geometry.push_back(mvt_geometry(op, px, py));
|
||||
mvt_geometry decoded = mvt_geometry(op, px, py);
|
||||
if (elevation_index < elevations.size()) {
|
||||
decoded.elevation = elevations[elevation_index];
|
||||
elevation_index++;
|
||||
}
|
||||
feature.geometry.push_back(decoded);
|
||||
}
|
||||
} else {
|
||||
feature.geometry.push_back(mvt_geometry(op, 0, 0));
|
||||
@ -560,7 +576,7 @@ std::string mvt_tile::encode() {
|
||||
}
|
||||
}
|
||||
|
||||
feature_writer.add_packed_double(5, std::begin(elevations), std::end(elevations));
|
||||
feature_writer.add_packed_double(6, std::begin(elevations), std::end(elevations));
|
||||
}
|
||||
|
||||
layer_writer.add_message(2, feature_string);
|
||||
|
198
tests/node-attributes/out/-z5.json
Normal file
198
tests/node-attributes/out/-z5.json
Normal file
@ -0,0 +1,198 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"bounds": "-122.399233,36.034494,-86.296642,39.844024",
|
||||
"center": "-118.125000,36.466030,5",
|
||||
"description": "tests/node-attributes/out/-z5.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 5, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 10,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"maxzoom": "5",
|
||||
"minzoom": "0",
|
||||
"name": "tests/node-attributes/out/-z5.json.check.mbtiles",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.255859, 37.718590, 28.337000 ], [ -122.431641, 37.788081, 1551.245000 ], [ -122.431641, 37.579413, 3147.925000 ], [ -122.255859, 37.439974, 5404.235000 ], [ -119.882812, 36.949892, 10596.868000 ], [ -116.982422, 36.809285, 9982.636000 ], [ -115.751953, 36.102376, 3985.287000 ], [ -115.224609, 36.102376, 1128.987000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -115.224609, 36.102376, 175.851000 ], [ -115.312500, 36.173357, 2083.402000 ], [ -115.312500, 36.244273, 3187.959000 ], [ -113.203125, 36.385913, 11031.956000 ], [ -110.917969, 37.230328, 11950.155000 ], [ -108.193359, 37.718590, 12560.641000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.841797, 37.788081, 12562.631000 ], [ -107.138672, 37.926868, 12569.219000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.050781, 37.926868, 12537.040000 ], [ -105.996094, 38.065392, 12540.524000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.732422, 38.134557, 12578.303000 ], [ -105.644531, 38.134557, 12587.819000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.380859, 38.203655, 670.046000 ], [ -103.974609, 38.134557, 12573.146000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -103.886719, 38.134557, 12570.732000 ], [ -102.744141, 38.134557, 12550.129000 ], [ -101.601562, 38.341656, 12572.948000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.425781, 38.341656, 12927.185000 ], [ -97.207031, 39.027719, 12549.169000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -96.328125, 39.164141, 12536.286000 ], [ -89.736328, 39.842286, 11451.779000 ], [ -86.923828, 39.909736, 4535.202000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -86.923828, 39.909736, 3857.346000 ], [ -86.484375, 39.639538, 1721.193000 ], [ -86.308594, 39.774769, 223.400000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.255859, 37.718590, 28.337000 ], [ -122.387695, 37.753344, 1551.245000 ], [ -122.431641, 37.544577, 3347.583000 ], [ -122.299805, 37.405074, 5156.007000 ], [ -119.882812, 36.914764, 10596.868000 ], [ -116.938477, 36.809285, 9979.023000 ], [ -115.883789, 36.208823, 5065.492000 ], [ -115.751953, 36.066862, 3985.287000 ], [ -115.180664, 36.102376, 780.540000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -115.180664, 36.102376, 175.851000 ], [ -115.312500, 36.102376, 1785.090000 ], [ -115.312500, 36.173357, 2524.116000 ], [ -115.180664, 36.208823, 3449.273000 ], [ -114.213867, 36.208823, 8190.893000 ], [ -113.247070, 36.315125, 10926.373000 ], [ -110.874023, 37.195331, 11950.155000 ], [ -108.149414, 37.718590, 12587.202000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.797852, 37.753344, 12562.631000 ], [ -107.094727, 37.892196, 12572.281000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.050781, 37.892196, 12537.040000 ], [ -105.952148, 38.065392, 12575.229000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.732422, 38.099983, 12578.303000 ], [ -105.600586, 38.134557, 12587.241000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.380859, 38.203655, 670.046000 ], [ -105.336914, 38.169114, 12562.338000 ], [ -103.974609, 38.134557, 12573.146000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -103.886719, 38.134557, 12570.732000 ], [ -102.744141, 38.099983, 12550.129000 ], [ -101.601562, 38.341656, 12606.312000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.425781, 38.341656, 12927.185000 ], [ -97.207031, 38.993572, 12549.169000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -96.328125, 39.130060, 12536.286000 ], [ -89.692383, 39.842286, 11375.022000 ], [ -86.923828, 39.876019, 4535.202000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -86.923828, 39.876019, 3857.346000 ], [ -86.484375, 39.605688, 1721.193000 ], [ -86.308594, 39.740986, 223.400000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 0, "y": 1 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.233887, 37.718590, 28.337000 ], [ -122.343750, 37.735969, 1393.071000 ], [ -122.409668, 37.544577, 3347.583000 ], [ -122.343750, 37.422526, 4608.293000 ], [ -122.277832, 37.387617, 5293.532000 ], [ -119.882812, 36.914764, 10596.868000 ], [ -116.938477, 36.809285, 9979.023000 ], [ -115.883789, 36.208823, 5065.492000 ], [ -115.751953, 36.049099, 3985.287000 ], [ -115.158691, 36.084621, 678.479000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -115.158691, 36.084621, 175.851000 ], [ -115.290527, 36.084621, 1785.090000 ], [ -115.290527, 36.155618, 2655.770000 ], [ -115.158691, 36.208823, 3503.863000 ], [ -114.213867, 36.208823, 8190.893000 ], [ -113.225098, 36.332828, 10976.060000 ], [ -110.895996, 37.160317, 11958.147000 ], [ -108.127441, 37.701207, 12589.610000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.775879, 37.753344, 12562.631000 ], [ -107.072754, 37.874853, 12573.812000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.028809, 37.892196, 12537.040000 ], [ -105.930176, 38.065392, 12600.802000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.710449, 38.099983, 12578.303000 ], [ -105.578613, 38.117272, 12586.952000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.380859, 38.203655, 670.046000 ], [ -105.336914, 38.151837, 12562.338000 ], [ -104.721680, 38.169114, 12568.986000 ], [ -103.974609, 38.134557, 12573.146000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -103.886719, 38.117272, 12570.732000 ], [ -102.766113, 38.099983, 12563.463000 ], [ -101.579590, 38.324420, 12606.312000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.425781, 38.341656, 12927.185000 ], [ -99.206543, 38.702659, 12571.604000 ], [ -97.185059, 38.993572, 12526.001000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -96.306152, 39.113014, 12536.286000 ], [ -92.702637, 39.537940, 12539.185000 ], [ -90.000000, 39.825413 ], [ -89.582520, 39.842286, 11262.067000 ], [ -88.242188, 39.842286, 10651.436000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 1, "y": 1 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -91.757812, 39.639538, 12535.532000 ], [ -90.000000, 39.825413 ], [ -89.582520, 39.842286, 11262.067000 ], [ -86.901855, 39.859155, 4658.948000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -86.901855, 39.859155, 3857.346000 ], [ -86.791992, 39.842286, 3441.170000 ], [ -86.484375, 39.588757, 1606.440000 ], [ -86.308594, 39.724089, 223.400000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 1, "y": 3 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.222900, 37.709899, 28.337000 ], [ -122.277832, 37.735969, 578.153000 ], [ -122.343750, 37.744657, 1351.028000 ], [ -122.409668, 37.553288, 3342.092000 ], [ -122.343750, 37.413800, 4709.938000 ], [ -122.288818, 37.387617, 5264.456000 ], [ -119.882812, 36.905980, 10596.868000 ], [ -118.300781, 36.862043, 10642.842000 ], [ -116.949463, 36.809285, 9979.769000 ], [ -116.861572, 36.782892, 9978.206000 ], [ -115.883789, 36.199958, 5065.492000 ], [ -115.762939, 36.040216, 4014.000000 ], [ -115.158691, 36.084621, 637.001000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -115.147705, 36.084621, 175.851000 ], [ -115.125732, 36.084621, 635.830000 ], [ -115.279541, 36.084621, 1785.090000 ], [ -115.301514, 36.111253, 2126.403000 ], [ -115.301514, 36.155618, 2631.929000 ], [ -115.235596, 36.191092, 3297.122000 ], [ -115.158691, 36.199958, 3503.863000 ], [ -114.213867, 36.199958, 8190.893000 ], [ -113.225098, 36.323977, 10976.060000 ], [ -110.895996, 37.151561, 11958.147000 ], [ -109.599609, 37.422526, 12058.594000 ], [ -108.127441, 37.692514, 12589.610000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.775879, 37.753344, 12562.631000 ], [ -107.072754, 37.874853, 12573.812000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.028809, 37.883525, 12537.040000 ], [ -105.919189, 38.065392, 12612.196000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.710449, 38.099983, 12578.303000 ], [ -105.578613, 38.117272, 12586.952000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.380859, 38.195022, 670.046000 ], [ -105.336914, 38.151837, 12562.338000 ], [ -104.721680, 38.169114, 12568.986000 ], [ -103.963623, 38.125915, 12577.111000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -103.875732, 38.117272, 12570.732000 ], [ -103.128662, 38.091337, 12545.972000 ], [ -102.766113, 38.099983, 12563.463000 ], [ -101.579590, 38.315801, 12606.312000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.414795, 38.341656, 12927.185000 ], [ -99.206543, 38.702659, 12571.604000 ], [ -97.174072, 38.985033, 12514.352000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -96.295166, 39.104489, 12536.286000 ], [ -92.768555, 39.537940, 12527.650000 ], [ -91.439209, 39.681826, 12542.559000 ], [ -90.000000, 39.816975 ], [ -89.692383, 39.842286, 11375.022000 ], [ -89.121094, 39.842286, 10633.949000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 2, "y": 3 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -90.878906, 39.732538, 12498.950000 ], [ -90.000000, 39.816975 ], [ -89.593506, 39.842286, 11266.785000 ], [ -86.901855, 39.850721, 4658.948000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -86.890869, 39.850721, 3857.346000 ], [ -86.813965, 39.842286, 3533.014000 ], [ -86.781006, 39.825413, 3407.437000 ], [ -86.484375, 39.588757, 1606.440000 ], [ -86.451416, 39.597223, 1347.902000 ], [ -86.418457, 39.639538, 900.773000 ], [ -86.297607, 39.724089, 244.010000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 2, "y": 6 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.217407, 37.709899, 28.337000 ], [ -122.222900, 37.705553, 2.442000 ], [ -122.255859, 37.731625, 453.762000 ], [ -122.310791, 37.744657, 983.779000 ], [ -122.343750, 37.735969, 1422.599000 ], [ -122.404175, 37.548933, 3342.092000 ], [ -122.393188, 37.509726, 3506.487000 ], [ -122.338257, 37.413800, 4709.938000 ], [ -122.327271, 37.400710, 4879.554000 ], [ -122.288818, 37.383253, 5264.456000 ], [ -122.107544, 37.352693, 6290.999000 ], [ -121.014404, 37.138425, 10599.547000 ], [ -119.882812, 36.901587, 10596.868000 ], [ -118.438110, 36.866438, 10662.147000 ], [ -116.943970, 36.809285, 9979.947000 ], [ -116.861572, 36.778492, 9978.206000 ], [ -115.933228, 36.217687, 5244.730000 ], [ -115.883789, 36.195525, 5065.492000 ], [ -115.867310, 36.177791, 4940.999000 ], [ -115.790405, 36.062422, 4212.141000 ], [ -115.757446, 36.040216, 4014.000000 ], [ -115.708008, 36.035774, 3721.174000 ], [ -115.290527, 36.075742, 1856.370000 ], [ -115.142212, 36.075742, 632.808000 ], [ -115.153198, 36.084621, 639.631000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -115.147705, 36.084621, 175.851000 ], [ -115.153198, 36.080182, 639.003000 ], [ -115.125732, 36.080182, 635.830000 ], [ -115.263062, 36.080182, 1711.132000 ], [ -115.279541, 36.084621, 1835.906000 ], [ -115.296021, 36.106815, 2126.403000 ], [ -115.290527, 36.155618, 2682.176000 ], [ -115.230103, 36.186659, 3297.122000 ], [ -115.158691, 36.199958, 3503.863000 ], [ -114.713745, 36.204391, 5941.404000 ], [ -114.241333, 36.195525, 8104.805000 ], [ -113.269043, 36.310699, 10867.566000 ], [ -113.153687, 36.341678, 11161.247000 ], [ -112.500000, 36.584658 ], [ -112.060547, 36.743286, 11941.069000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 3, "y": 6 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -112.939453, 36.421282, 11742.436000 ], [ -112.500000, 36.584658 ], [ -111.697998, 36.875227, 11949.535000 ], [ -110.874023, 37.160317, 11949.555000 ], [ -109.989624, 37.339592, 11948.015000 ], [ -109.879761, 37.352693, 11973.013000 ], [ -109.874268, 37.361426, 11904.038000 ], [ -109.599609, 37.418163, 12058.594000 ], [ -108.127441, 37.688167, 12589.610000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.770386, 37.753344, 12562.631000 ], [ -107.067261, 37.874853, 12574.195000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.028809, 37.879189, 12537.040000 ], [ -105.913696, 38.061067, 12617.894000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.710449, 38.095660, 12578.303000 ], [ -105.578613, 38.117272, 12586.952000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.380859, 38.190704, 670.046000 ], [ -105.331421, 38.151837, 12562.338000 ], [ -104.897461, 38.169114, 12587.235000 ], [ -104.721680, 38.169114, 12568.986000 ], [ -103.963623, 38.121593, 12577.111000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -103.875732, 38.117272, 12570.732000 ], [ -103.441772, 38.108628, 12611.312000 ], [ -103.134155, 38.091337, 12544.938000 ], [ -102.985840, 38.087013, 12580.995000 ], [ -102.766113, 38.095660, 12563.463000 ], [ -101.574097, 38.311491, 12610.019000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.409302, 38.341656, 12927.185000 ], [ -100.074463, 38.561053, 12598.954000 ], [ -99.179077, 38.702659, 12571.578000 ], [ -98.031006, 38.869652, 12562.019000 ], [ -97.174072, 38.985033, 12514.352000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -96.295166, 39.100226, 12536.286000 ], [ -95.581055, 39.189691, 12573.104000 ], [ -94.718628, 39.287546, 12557.793000 ], [ -94.031982, 39.381018, 12537.930000 ], [ -92.763062, 39.533703, 12527.650000 ], [ -91.433716, 39.677598, 12542.559000 ], [ -90.000000, 39.812756 ], [ -89.692383, 39.842286, 11375.022000 ], [ -89.560547, 39.842286, 11258.240000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 4, "y": 6 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -90.439453, 39.774769, 12521.347000 ], [ -90.000000, 39.812756 ], [ -89.692383, 39.842286, 11375.022000 ], [ -89.593506, 39.842286, 11266.785000 ], [ -86.901855, 39.846504, 4658.948000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -86.885376, 39.846504, 3857.346000 ], [ -86.830444, 39.846504, 3608.692000 ], [ -86.775513, 39.821194, 3389.692000 ], [ -86.484375, 39.592990, 1702.459000 ], [ -86.467896, 39.588757, 1632.271000 ], [ -86.445923, 39.597223, 1287.179000 ], [ -86.418457, 39.635307, 900.773000 ], [ -86.319580, 39.715638, 232.357000 ], [ -86.297607, 39.719863, 244.010000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 5, "y": 12 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.214661, 37.709899, 28.337000 ], [ -122.220154, 37.707726, 9.208000 ], [ -122.214661, 37.705553, 6.531000 ], [ -122.217407, 37.703380, 7.773000 ], [ -122.250366, 37.727280, 413.195000 ], [ -122.308044, 37.742485, 983.779000 ], [ -122.327271, 37.742485, 1192.524000 ], [ -122.341003, 37.733797, 1422.599000 ], [ -122.401428, 37.546755, 3342.092000 ], [ -122.398682, 37.520619, 3403.188000 ], [ -122.335510, 37.413800, 4709.938000 ], [ -122.324524, 37.400710, 4879.554000 ], [ -122.310791, 37.391982, 5017.900000 ], [ -122.280579, 37.381070, 5314.921000 ], [ -122.198181, 37.370157, 5758.375000 ], [ -121.220398, 37.177826, 9734.398000 ], [ -120.747986, 37.079284, 10600.374000 ], [ -120.715027, 37.074902, 10595.786000 ], [ -120.662842, 37.061753, 10607.319000 ], [ -120.629883, 37.057369, 10601.461000 ], [ -120.451355, 37.017905, 10603.685000 ], [ -120.418396, 37.013519, 10607.968000 ], [ -120.335999, 36.993778, 10606.602000 ], [ -120.303040, 36.989391, 10597.909000 ], [ -119.962463, 36.914764, 10595.910000 ], [ -119.882812, 36.901587, 10596.868000 ], [ -119.245605, 36.888408, 10631.175000 ], [ -118.298035, 36.862043, 10643.872000 ], [ -117.600403, 36.837866, 10614.662000 ], [ -116.943970, 36.809285, 9979.947000 ], [ -116.902771, 36.798289, 9996.510000 ], [ -116.861572, 36.778492, 9978.206000 ], [ -116.759949, 36.714669, 9990.549000 ], [ -116.702271, 36.683839, 9955.665000 ], [ -116.227112, 36.396968, 6939.477000 ], [ -116.210632, 36.390335, 6855.348000 ], [ -116.128235, 36.337253, 6301.388000 ], [ -116.111755, 36.330615, 6222.354000 ], [ -116.095276, 36.317338, 6110.697000 ], [ -116.089783, 36.317338, 6089.423000 ], [ -116.029358, 36.277493, 5683.577000 ], [ -115.935974, 36.224334, 5268.923000 ], [ -115.930481, 36.217687, 5244.730000 ], [ -115.924988, 36.217687, 5234.284000 ], [ -115.922241, 36.213255, 5220.712000 ], [ -115.883789, 36.195525, 5065.492000 ], [ -115.870056, 36.184442, 4985.958000 ], [ -115.853577, 36.157835, 4832.598000 ], [ -115.845337, 36.151182, 4794.048000 ], [ -115.793152, 36.069082, 4261.018000 ], [ -115.782166, 36.055761, 4176.412000 ], [ -115.757446, 36.040216, 4014.000000 ], [ -115.740967, 36.035774, 3878.053000 ], [ -115.708008, 36.035774, 3721.174000 ], [ -115.664062, 36.042437, 3502.751000 ], [ -115.359192, 36.066862, 2085.486000 ], [ -115.296021, 36.075742, 1889.526000 ], [ -115.139465, 36.075742, 615.792000 ], [ -115.147705, 36.075742, 628.754000 ], [ -115.150452, 36.084621, 644.441000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -115.144958, 36.084621, 175.851000 ], [ -115.153198, 36.082402, 611.246000 ], [ -115.150452, 36.084621, 611.763000 ], [ -115.150452, 36.080182, 639.003000 ], [ -115.122986, 36.077962, 629.120000 ], [ -115.260315, 36.077962, 1711.132000 ], [ -115.274048, 36.082402, 1812.240000 ], [ -115.285034, 36.091280, 1949.247000 ], [ -115.293274, 36.106815, 2126.403000 ], [ -115.296021, 36.144529, 2578.511000 ], [ -115.290527, 36.153400, 2682.176000 ], [ -115.268555, 36.168923, 2989.145000 ], [ -115.221863, 36.186659, 3320.703000 ], [ -115.158691, 36.197742, 3503.863000 ], [ -114.713745, 36.202174, 5941.404000 ], [ -114.241333, 36.195525, 8104.805000 ], [ -113.876038, 36.237628, 9141.032000 ], [ -113.840332, 36.244273, 9374.923000 ], [ -113.705750, 36.257563, 9659.555000 ], [ -113.689270, 36.261992, 9740.625000 ], [ -113.269043, 36.308486, 10867.566000 ], [ -113.183899, 36.328403, 11075.146000 ], [ -112.500000, 36.582452 ], [ -112.395630, 36.615528, 12029.978000 ], [ -112.387390, 36.622141, 11520.984000 ], [ -112.280273, 36.661809, 11949.505000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 6, "y": 12 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -112.719727, 36.500805, 11950.469000 ], [ -112.500000, 36.582452 ], [ -112.395630, 36.615528, 12029.978000 ], [ -112.387390, 36.622141, 11520.984000 ], [ -112.343445, 36.639774, 11960.842000 ], [ -111.983643, 36.769692, 11949.796000 ], [ -111.964417, 36.774092, 11950.233000 ], [ -111.923218, 36.791691, 11940.988000 ], [ -111.890259, 36.800488, 11935.719000 ], [ -111.774902, 36.844461, 11943.026000 ], [ -111.736450, 36.855450, 11953.876000 ], [ -111.695251, 36.873029, 11949.535000 ], [ -111.461792, 36.952087, 11943.345000 ], [ -111.456299, 36.956476, 11942.087000 ], [ -111.107483, 37.077093, 11933.673000 ], [ -111.096497, 37.083667, 11934.544000 ], [ -111.008606, 37.114336, 11948.793000 ], [ -110.865784, 37.160317, 11948.368000 ], [ -109.986877, 37.337408, 11948.015000 ], [ -109.879761, 37.352693, 11973.013000 ], [ -109.879761, 37.357059, 11877.890000 ], [ -109.871521, 37.359242, 11904.038000 ], [ -109.629822, 37.405074, 11980.184000 ], [ -109.624329, 37.409437, 12109.087000 ], [ -109.585876, 37.418163, 12031.260000 ], [ -109.550171, 37.420345, 11980.392000 ], [ -109.094238, 37.509726, 11956.965000 ], [ -108.907471, 37.542400, 12295.898000 ], [ -108.852539, 37.555465, 12483.184000 ], [ -108.742676, 37.572882, 12567.691000 ], [ -108.709717, 37.581589, 12567.277000 ], [ -108.520203, 37.614231, 12554.936000 ], [ -108.498230, 37.620758, 12558.500000 ], [ -108.127441, 37.685994, 12589.610000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.770386, 37.751172, 12562.631000 ], [ -107.064514, 37.872685, 12574.387000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -107.028809, 37.879189, 12537.040000 ], [ -106.685486, 37.937699, 12598.728000 ], [ -106.446533, 37.974515, 12594.310000 ], [ -106.344910, 37.993998, 12584.578000 ], [ -106.278992, 38.000491, 12463.704000 ], [ -106.251526, 38.009148, 12529.498000 ], [ -105.910950, 38.061067, 12620.739000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.710449, 38.095660, 12578.303000 ], [ -105.575867, 38.115111, 12586.916000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -105.380859, 38.188546, 670.046000 ], [ -105.328674, 38.149678, 12562.338000 ], [ -104.897461, 38.166955, 12587.235000 ], [ -104.718933, 38.166955, 12569.627000 ], [ -104.122925, 38.128075, 12543.264000 ], [ -103.963623, 38.121593, 12577.111000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -103.875732, 38.115111, 12570.732000 ], [ -103.705444, 38.108628, 12566.613000 ], [ -103.439026, 38.106467, 12611.035000 ], [ -103.287964, 38.095660, 12602.444000 ], [ -103.134155, 38.089175, 12544.938000 ], [ -102.985840, 38.087013, 12580.995000 ], [ -102.766113, 38.095660, 12563.463000 ], [ -102.645264, 38.112950, 12545.036000 ], [ -102.628784, 38.119432, 12557.048000 ], [ -102.502441, 38.141037, 12564.088000 ], [ -102.480469, 38.147518, 12565.474000 ], [ -101.571350, 38.309336, 12613.722000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.409302, 38.339502, 12927.185000 ], [ -101.370850, 38.348119, 12872.493000 ], [ -101.343384, 38.348119, 12639.538000 ], [ -101.250000, 38.363195 ], [ -101.030273, 38.401949, 12555.891000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 7, "y": 12 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -101.409302, 38.339502, 12927.185000 ], [ -101.370850, 38.348119, 12872.493000 ], [ -101.343384, 38.348119, 12639.538000 ], [ -101.250000, 38.363195 ], [ -100.895691, 38.425622, 12587.214000 ], [ -100.258484, 38.528830, 12577.288000 ], [ -100.220032, 38.537424, 12623.309000 ], [ -99.179077, 38.700516, 12571.578000 ], [ -98.061218, 38.865375, 12572.744000 ], [ -98.014526, 38.869652, 12563.320000 ], [ -97.382812, 38.959409, 12560.210000 ], [ -97.174072, 38.985033, 12514.352000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -96.295166, 39.100226, 12536.286000 ], [ -95.581055, 39.189691, 12573.104000 ], [ -94.908142, 39.268411, 12545.003000 ], [ -94.682922, 39.291797, 12557.161000 ], [ -94.463196, 39.323675, 12531.159000 ], [ -93.944092, 39.389509, 12559.342000 ], [ -92.666931, 39.542176, 12534.207000 ], [ -91.433716, 39.675484, 12542.559000 ], [ -91.411743, 39.675484, 12539.554000 ], [ -91.035461, 39.715638, 12529.963000 ], [ -90.510864, 39.766325, 12515.910000 ], [ -90.000000, 39.812756 ], [ -89.780273, 39.831741, 11527.765000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 8, "y": 12 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -90.219727, 39.791655, 12500.713000 ], [ -90.000000, 39.812756 ], [ -89.692383, 39.840177, 11375.022000 ], [ -89.596252, 39.842286, 11265.897000 ], [ -88.780518, 39.844395, 10644.975000 ], [ -88.211975, 39.840177, 10474.445000 ], [ -87.019958, 39.840177, 4429.968000 ], [ -86.901855, 39.844395, 4658.948000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -86.885376, 39.844395, 3857.346000 ], [ -86.830444, 39.844395, 3608.692000 ], [ -86.797485, 39.833850, 3462.810000 ], [ -86.775513, 39.821194, 3389.692000 ], [ -86.761780, 39.806426, 3312.193000 ], [ -86.693115, 39.753657, 3152.064000 ], [ -86.665649, 39.736762, 3038.892000 ], [ -86.558533, 39.654341, 2213.939000 ], [ -86.547546, 39.641653, 2105.151000 ], [ -86.492615, 39.603572, 1798.839000 ], [ -86.481628, 39.590874, 1661.736000 ], [ -86.470642, 39.586641, 1622.411000 ], [ -86.456909, 39.588757, 1405.776000 ], [ -86.445923, 39.597223, 1287.179000 ], [ -86.434937, 39.618384, 1061.321000 ], [ -86.421204, 39.626846, 929.160000 ], [ -86.418457, 39.633192, 900.773000 ], [ -86.349792, 39.683940, 407.204000 ], [ -86.308594, 39.719863, 196.658000 ], [ -86.297607, 39.719863, 244.010000 ] ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
@ -6,6 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -238,13 +239,15 @@ struct lonlat {
|
||||
double lat;
|
||||
long long x;
|
||||
long long y;
|
||||
double elevation;
|
||||
|
||||
lonlat(int nop, double nlon, double nlat, long long nx, long long ny)
|
||||
lonlat(int nop, double nlon, double nlat, long long nx, long long ny, double nelevation)
|
||||
: op(nop),
|
||||
lon(nlon),
|
||||
lat(nlat),
|
||||
x(nx),
|
||||
y(ny) {
|
||||
y(ny),
|
||||
elevation(nelevation) {
|
||||
}
|
||||
};
|
||||
|
||||
@ -475,9 +478,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
double lat, lon;
|
||||
projection->unproject(wx, wy, 32, &lon, &lat);
|
||||
|
||||
ops.push_back(lonlat(op, lon, lat, px, py));
|
||||
ops.push_back(lonlat(op, lon, lat, px, py, feat.geometry[g].elevation));
|
||||
} else {
|
||||
ops.push_back(lonlat(op, 0, 0, 0, 0));
|
||||
ops.push_back(lonlat(op, 0, 0, 0, 0, NAN));
|
||||
}
|
||||
}
|
||||
|
||||
@ -491,6 +494,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
state.json_write_array();
|
||||
state.json_write_float(ops[0].lon);
|
||||
state.json_write_float(ops[0].lat);
|
||||
if (!isnan(ops[0].elevation)) {
|
||||
state.json_write_float(ops[0].elevation);
|
||||
}
|
||||
state.json_end_array();
|
||||
} else {
|
||||
state.json_write_string("type");
|
||||
@ -503,6 +509,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
state.json_write_array();
|
||||
state.json_write_float(ops[i].lon);
|
||||
state.json_write_float(ops[i].lat);
|
||||
if (!isnan(ops[i].elevation)) {
|
||||
state.json_write_float(ops[i].elevation);
|
||||
}
|
||||
state.json_end_array();
|
||||
}
|
||||
|
||||
@ -527,6 +536,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
state.json_write_array();
|
||||
state.json_write_float(ops[i].lon);
|
||||
state.json_write_float(ops[i].lat);
|
||||
if (!isnan(ops[i].elevation)) {
|
||||
state.json_write_float(ops[i].elevation);
|
||||
}
|
||||
state.json_end_array();
|
||||
}
|
||||
|
||||
@ -546,6 +558,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
state.json_write_array();
|
||||
state.json_write_float(ops[i].lon);
|
||||
state.json_write_float(ops[i].lat);
|
||||
if (!isnan(ops[i].elevation)) {
|
||||
state.json_write_float(ops[i].elevation);
|
||||
}
|
||||
state.json_end_array();
|
||||
|
||||
sstate = 1;
|
||||
@ -556,6 +571,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
state.json_write_array();
|
||||
state.json_write_float(ops[i].lon);
|
||||
state.json_write_float(ops[i].lat);
|
||||
if (!isnan(ops[i].elevation)) {
|
||||
state.json_write_float(ops[i].elevation);
|
||||
}
|
||||
state.json_end_array();
|
||||
|
||||
sstate = 1;
|
||||
@ -564,6 +582,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
|
||||
state.json_write_array();
|
||||
state.json_write_float(ops[i].lon);
|
||||
state.json_write_float(ops[i].lat);
|
||||
if (!isnan(ops[i].elevation)) {
|
||||
state.json_write_float(ops[i].elevation);
|
||||
}
|
||||
state.json_end_array();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user