timsc / mbtiles-cpp Goto Github PK
View Code? Open in Web Editor NEWMBTiles reader and Mapbox Vector Tiles 2.0/2.1 reader/writer in C++
License: MIT License
MBTiles reader and Mapbox Vector Tiles 2.0/2.1 reader/writer in C++
License: MIT License
The repo description says it can read and write MBTiles files, but I'm only seeing source implementation for reading. Anything I'm missing, or is that not actually implemented?
----------------------im new to cpp and I can't read the error message...
----------------------below are part of the error message
In file included from /mbtiles-cpp/Source/vector_tile21/vector_tile.pb.cc:5:0:
/mbtiles-cpp/Source/vector_tile21/../../Include/vector_tile21/vector_tile.pb.h:17:2: error:
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer headers. Please regenerate this file with a newer version of protoc.
/mbtiles-cpp/Source/vector_tile21/vector_tile.pb.cc: In function 'void vector_tile::protobuf_AssignDesc_vector_5ftile_2eproto()':
/mbtiles-cpp/Source/vector_tile21/vector_tile.pb.cc:60:19: error: no matching function for call to 'google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const google::protobuf::Descriptor*&, vector_tile::Tile*&, const int [1], int, int, int, const google::protobuf::DescriptorPool*, google::protobuf::MessageFactory*, long unsigned int)'
sizeof(Tile));
In file included from /usr/include/google/protobuf/stubs/common.h:41:0,
from /mbtiles-cpp/Source/vector_tile21/../../Include/vector_tile21/vector_tile.pb.h:9,
from /mbtiles-cpp/Source/vector_tile21/vector_tile.pb.cc:5:
/usr/include/google/protobuf/generated_message_reflection.h:574:3: note: candidate: google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const google::protobuf::internal::GeneratedMessageReflection&)
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratedMessageReflection);
^
/usr/include/google/protobuf/generated_message_reflection.h:574:3: note: candidate expects 1 argument, 9 provided
In file included from /mbtiles-cpp/Source/vector_tile21/vector_tile.pb.cc:14:0:
/usr/include/google/protobuf/generated_message_reflection.h:169:3: note: candidate: google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const google::protobuf::Descriptor*, const google::protobuf::Message*, const int*, int, int, int, const void*, int, const google::protobuf::DescriptorPool*, google::protobuf::MessageFactory*, int, int, int)
GeneratedMessageReflection(const Descriptor* descriptor,
^~~~~~~~~~~~~~~~~~~~~~~~~~
Currently Cairo Egypt (specifically tile 9613,9626,14) is being calculated at roughly latitude -30 in the example project. I think this is due to a difference between the mbtile specification and the slippy tile spec that the tiley2lat and lat2tiley are expecting.
The mbtile format uses the "Tile Map Service Specification" which has incompatible tile indexing with slippy map tiles. The latitude functions seem to work when modified to be as follows:
double tiley2lat(int y, int z)
{
double n = pow(2.0,z);
int ymax = 1 << z;
y = ymax - y - 1;
double latRad = atan(sinh(M_PI*(1-(2*y/n))));
return 180.0 / M_PI * latRad;
}
int lat2tiley(double lat, int z)
{
int y = (int)(floor((1.0 - log( tan(lat * M_PI/180.0) + 1.0 / cos(lat * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, z)));
int ymax = 1 << z;
y = ymax - y - 1;
return y;
}
these modifications were found here https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates/
With the above changes Cairo is back at roughly latitude 30 comfortably above the equator.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.