Comments (14)
I'm confused by the munging of the Y values (pow(2, $z-1) - $y
): doesn't MBTiles use the same spherical mercator coordinate system as MM? Invalid Y values would certainly explain more of the vertical world disappearing as you zoom in.
from modestmaps-js.
MBTiles uses TMS coordinates which have the origin at the bottom left: http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification
Perhaps $z = $z - 1
and $y = pow(2,$z) - $y
would do the trick? In MM zoom level 0 is 1 tile, zoom level 1 is 2x2 tiles, etc, but I think in TMS zoom level 0 is 2x2.
from modestmaps-js.
Or maybe $y = pow(2, $z) - 1 - $y
- leaving $z
as you had it? Sorry for random guesses, it's Friday night :)
from modestmaps-js.
I changed:
$y = pow(2, $z-1) - $y;
for:
$z = $z - 1;
$y = pow(2, $z) - 1 - $y;
and now it works, thanks!
The next issue I'm trying solve is to continue the map from the dateline onwards. I was able to fit the maps together by:
if($x > 0)
{
$x = $x - 2;
}
if($x < 0)
{
$x = $x + 2;
}
But if you zoom in this creates all sorts of nasty behavior (lower resolution parts next to higher ones, it looks like a mess). Anyone a clue whats going on?
from modestmaps-js.
See the mapbox/wax code, specifically the connectors/mm which provides a customized getTile method to handle the y flip correctly. And then rest assured that mbtiles will switch to the osm/xyz scheme that mm uses soon to avoid the need for this y flip to TMS.
from modestmaps-js.
Thanks! Am I correct to say that this code from waxconnector.js does what I need?
return this.options.tiles[parseInt(Math.pow(2, coord.zoom) * coord.row + coord.column, 10) %
this.options.tiles.length]
.replace('{z}', coord.zoom.toFixed(0))
.replace('{x}', coord.column.toFixed(0))
.replace('{y}', coord.row.toFixed(0));
I haven't been able to get wax working yet (no examples found) so I figured I try to add what I need into my code.
from modestmaps-js.
@jhpoosthoek have you seen the Wax manual? It's overflowing with examples.
from modestmaps-js.
@tmcw, yes I've seen the manual before. I guess I'm used to little example htmls such as created for openlayers and MM. I didn't get the wax examples to work immediately, but now I see that the manual itself also uses wax ;) thanks.
from modestmaps-js.
I got to it again and the problem is that the wax.mm.connector doesn't seem to work with my tiles: PHP url (the example tiles from mapbox.com on the other hand work perfectly):
var tilejson = {
tilejson: '1.0.0',
scheme: 'tms',
tiles: ['http://www.iivision.com/temp/mb2xyz.php?file=ne2&code={Z}/{X}/{Y}']
};
Anyone an idea why this doesn't seem to work?
from modestmaps-js.
Hey, so is this the full natural-earth tileset? Regardless of TMS/XYZ, the url http://www.iivision.com/temp/mb2xyz.php?file=ne2&code=0/0/0 should resolve to a worldwide tile if so.
from modestmaps-js.
@tmcw, yes it is. I commented out the following lines in the PHP:
//$z = $z - 1;
//$y = pow(2, $z) - 1 - $y;
So now 0/0/0 shows the worldwide tile. But it still doesn't work...
from modestmaps-js.
@jhpoosthoek - this seems to be working fine, are you actually using Wax? http://bl.ocks.org/1149162
from modestmaps-js.
@tmcw, yes it works! Thanks! I downloaded wax from github, but somehow this just didn't work. The PHP also doesn't work on my localhost through XAMPP. But I don't mind, it works!
I'm working to get also other datasets in: http://www.iivision.com/temp/mb2xyz.php?file=mola&code={z}/{x}/{y}, but I guess I need to do a little bit of GDAL work before I can pass it through the gdal2mb script...
from modestmaps-js.
Great!
from modestmaps-js.
Related Issues (20)
- Coordinate -> Extent HOT 3
- anyscale example does not work?
- Remove cache infrastructure HOT 1
- node example broken? HOT 5
- Initialize map without layer HOT 1
- MM.Location bearing method HOT 3
- The example on http://modestmaps.com/ doesn't work now HOT 2
- Latest MM breaks at high zooms in IE8
- Geo code or search by location in modest map HOT 3
- displaying geojson "features" HOT 1
- map.setCenter ignores latitude HOT 7
- map rotation HOT 3
- Tiles disappear when max is hit on very large displays HOT 2
- Easey and setExtent HOT 5
- Center Zoom On Click - Wax and Modest Maps
- CallbackManager#dispatchCallback eats exceptions
- IE10 PointerEvents not working properly HOT 1
- PERSIAN GOULF MARITAM POSIT
- License for modestmaps HOT 2
- Which files need to be hosted?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modestmaps-js.