Comments (9)
Ok, I will look into this. Do you by chance have a map that I can test this with?
from mbtiles-php.
Yes, check here: http://test.bradypus.net/mb/client/
I think a workaround could be adding a new route for @2x
images that points to standard images, but a better solution wold be serving properly @2x
images, or far better, enable the possibility to choose about images to serve. This could permit users to save lot of bandwidth on mobile devices.
from mbtiles-php.
Hmm, interesting. I seem to have the same problem on Chrome on my MacBook. The map is just blank and I see a bunch of 404s.
It turns out that Mapbox.js has changed something; they now automatically detect Retina displays and try to serve up @2x images if a Retina screen is detected. That's a good thing, but so far it works on MapBox's own servers, but not with mine. I think you can also switch off the detection (in MapBox.js) and force it to use regular sized tiles.
Anyway, there is a slight issue if we want to support this - after looking at the (ridiculously sparse) MBTiles specifications I don't think it is possible to include both regular (256x256 pixels) and retina images (512x512 pixels) in your mbtiles file. A quick glance at TileMill seems to confirm this (unless I overlooked).
That leaves three options to address this issue:
- Serve regular sized images as @2x images.
- Combine 4 images from a lower (higher?) zoom level into one new 'retina' image.
- Select a different .mbtiles file if a Retina image is requested and serve the image from there.
I think I like the second approach best, but I'm not sure if the end result would be satisfactory. Hmm. Any thoughts on this?
(This is MapBox's section on Retina maps, by the way: https://www.mapbox.com/tilemill/docs/guides/high-resolution-tiles/ - They seem to suggest two different tilesets, as in option 3)
from mbtiles-php.
The second approach seems the best, maybe some test can be done in a separate branch. Anyway the third also can be implemented and documented: if a *@2x.mbtiles
file exists in the same directory this tile DB will be used, otherwise option 2 will be used...
from mbtiles-php.
Exactly, that was what I was thinking too. For Retina requests I think I'll first check for a *@2x.mbtiles file, and use that if it exists, and if it doesn't - I think I'll actually serve regular sized images (option 1). I'm a bit afraid that combining smaller images into one will mean that the text will end up looking really tiny, which would make the map unusable. This is at least what the MapBox page from above seems to hint at. I might include it in the code anyway, though - and maybe include a configuration option to switch it on or off.
from mbtiles-php.
That would be great! I'm looking forward to test it!
from mbtiles-php.
Hi jbogdani! In the precious free time I have I managed to actually sit down and implement this. The latest version should now properly support Retina maps. Can you please test it? Basically, what it does is look for a Retina version of the map (named "@2x.mbtiles"), and serve tiles from that file if the user accesses the map from a Retina device. If that file does not exist, it will serve tiles from the regular/normal .mbtiles file as usual. Does it work for you?
from mbtiles-php.
Hello,
It's working fine for me. I don't have actually @2x.mbitles, but the fallback does work. Thank you.
from mbtiles-php.
Great! Awesome.
from mbtiles-php.
Related Issues (16)
- Merge with TileServer-PHP
- Caching spec violations HOT 1
- Mandatory webpage response not included in tilejson HOT 1
- preg_match(): Compilation failed HOT 1
- Add info for setup with nginx HOT 1
- Symlinks issue HOT 3
- Go Daddy Hosting HOT 45
- Tiles not found HOT 7
- 500 internal error
- Getting Sample To Work HOT 35
- Cannot deploy in the domain root HOT 3
- Areas of no data are rendered black HOT 2
- Can we run this on 1and1?? HOT 9
- Serving geojson HOT 2
- 403 access error HOT 2
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 mbtiles-php.