Code Monkey home page Code Monkey logo

mbtiles-cpp's Issues

Writing capability implemented?

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?

build error in protoc version?

----------------------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,
^~~~~~~~~~~~~~~~~~~~~~~~~~

In VectorTile.cpp the wrong latitudes are calculated.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.