We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone! I am trying to create an offline map with Tilemill , and open it with Unfolding library (MBTilesApp example ) . I have correctly installed the sqlitejdbc driver (the example with the default MBtiles works correct ) . When I try to open my exported data (from Tilemill ) I jus get a blank screen . Are there any special settings , e.g. zoom levels , that I have to make on Tilemill so that the Unfolding lib recognizes the data? I could upload the file I am trying to use if you like , just point on what site you would like to have it . Btw I am using Processing 2.2.1.
Thank you in advance
Answers
As the example works for you it has to do with the mbtiles file you exported. Check that the location of the map is actually on the map file, and that the zoom level also fits your export (as you assumed). Otherwise the image tiles won't be loaded and you see nothing.
In the export dialog of TileMill you had to select the area and zoom levels of your mbtiles. Simply use any point within that area and you should be good to go.
@tnagel: Hey ! Thanks for your reply ! From tilemill I open the control room project , click on export->mbtiles , drag an aera , set the zoom option (6-11 ,1mb+) click inside the rectangular to set the center point and click export . Don't know about the Metatile size , I leave on default setting ( 2) . Then I copy this tile into the MbtileApp folder under Data , change the
String mbTilesString = sketchPath("data/.mbtiles");
accordingly and run the application . Is there any step I am missing ?@tnagel : After experimenting with the default word map in tilemill , when I export with very low zoom range ( 2,3 min-max zoom ca. 400kb ) seems that MbtileApp draws the tiles. When I try something bigger e.g. 100mb file it goes out blank again . I have to say that there are no error on java console output.
Is there any restriction on the data size that Unfolding can handle? Is there any alternative I can use to have a full map offline (perhaps with a python server script ?? ) and if so could you point me to any tutorial on how to accomplish this ?
Ok, I was not precise enough. Your setup seems fine (unfolding, processing, mbtiles loading, memory space...)
It has nothing to do with the file size, IMO. Your exported MBTiles file probably is fine. You have to adapt the Unfolding example so that the map is zoomed and panned to an area which your MBTiles file actually supports.
For a start, use the center point (from TileMill) and set the UnfoldingMap like this:
map.zoomAndPanTo(6, new Location(lat, lng));
@tnagel: Sorry for my late reply ! Unfortunately I have not my sketch folder on this system , so I will try that as soon as possible . Thank you for your interest!
@tnagel : Ok I followed the exact same steps , as mentioned before and have extracted this mbtile
The center is 7.6904,47.8500 - the bounds are 3.2739,45.6064,12.3486,49.6321 , the zoom range is 6-8 . Then in the processing application I have this :
You seem to have your lat/lng mixed up. If you use this line
map.zoomAndPanTo(new Location(47.9f, 7.7f), 6);
it works for me.
You are correct ! Silly me... I suppose there is an option to avoid the grey area around the map, so only the exported part is visible , no? Anyway i really appreciate your help ! Cheers
Good to hear it worked!
Similar to map.setZoomRange(..) you can also restrict the panning area. Either circular with
map.setPanningRestriction(centerLocation, distanceInKilometer)
or with
map.setRectangularPanningRestriction(topLeftLocation, bottomRightLocation)
That's great ! Thank you so much !
@tnagel:
Sorry for bothering you again , but when I try
map.setRectangularPanningRestriction(topLeftLocation, bottomRightLocation)
I get :
the function setRectangularPanningRestriction(Location,Location) does not exist
. I have set thetopLeftLocation
andbottomRightLocation
to the points given from Tilemill's bounds. Themap.setPanningRestriction(centerLocation, distanceInKilometer)
works though, but it is difficult to find thedistanceInKilometer
for the desired area. Is there something I should import?Sorry, my bad. This method only works in (unreleased) 0.9.7beta. Send me an e-mail to get it, or simply use the circular one. To find the distanceInKilometer you could use for instance the following:
Which displays the distance between the map's center and your mouse pointer.
Hi,
I'm having a similar problem to atomtm in that the example works, but when I replace the filename with my own file (loaded in the same area) my map isn't displayed. I'm using Mapbox Studio to create the mbtile file and I get the following error when reading it in:
I've set the correct center and limited my zoom to between 6 & 11 in the settings of MapBox and used the same map.zoomAndPanTo method to ensure the same information is displayed in processing.
I used MapBox Studio to create the MBTiles. Am I correct in saying these are vector formats while the files coming from TileMill are raster and the Unfolding library works only with raster?
Thanks