How to use tileserver-gl with free maps? - openstreetmap

I'd like to use tileserver-gl for hosting OSM map tiles. I don't want to use paid .mbtiles file from OpenMapTiles.com.
Is it possible to use tileserver-gl with some other (free) mbtiles file? How to set up that?

Related

How to download map tiles for Leaflet?

I understand that this is a basic question; however, I've spent hours googling and have yet to find an answer that works.
I have a javascript webapp that uses Leaflet to display a map. I can get it to work when the tile source URL is some online repository like mapbox, but I want my application to work offline. How/where can I download tiles and save them in a folder structure that I can then set the tile source URL to point to?
Thanks
You can generate tiles by yourself using same engine as OSM's : Mapnik and OSM database.

how to create vector mbtiles files for particular region of my choice

I am not able to create vector mbtiles files for my city region (Nashik, Maharashtra, India), I am using nutiteq SDK for displaying Offline Maps. I have tried creating mbtiles using Mobile Atlas creator, but the output .mbtile file does not works in Nutiteq SDK.
Please assist on this. I only want to display a specific region .mbtiles in my App.
Thank You in Advance.
MBTiles is general format which can contain also vector data (tiles), not only raster . Both TileMill and Mobile Atlas Creator can create only rasters, first one from vector data, and second one by scraping it from on-line APIs. You can use raster MBTiles with Nutiteq SDK, iOS sample:
// file-based local offline datasource
NSString* fullpathVT = [[NSBundle mainBundle] pathForResource:#"MBTILESFILENAME" ofType:#"mbtiles"];
NTTileDataSource* tileDataSource = [[NTMBTilesTileDataSource alloc] initWithMinZoom:0 maxZoom:19 path: fullpathVT];
// Initialize a raster layer with the previous data source
NTRasterTileLayer* rasterLayer = [[NTRasterTileLayer alloc] initWithDataSource:tileDataSource];
// Add the raster layer to the map
[[self getLayers] add:rasterLayer];
Android:
MBTilesTileDataSource tileDataSource = new MBTilesTileDataSource(
0, 19, filePath);
RasterTileLayer rasterLayer = new RasterTileLayer(tileDataSource);
mapView.getLayers().add(rasterLayer);
TileMill and Mobile Atlas Creator (MOBAC) does not support creating vector mbtiles. All the sources from where MOBAC gets data are raster ones, so it is not possible in principle. So there is no easy and free source to download the files as far as I know. I can suggest two options:
Use Nutiteq Maps service (subscription-based) which is currently in private beta. This works technically this way, that you define in your app which map package or packages can be loaded to the device, and SDK downloads directly your selected map.
With Nutiteq Maps SDK Enteprise license you can use custom map packages and sources, and custom download control.
You should contact Nutiteq to get access to beta, or enterprise license. Disclaimer: I'm founder of Nutiteq.
You can create MBTiles from any .osm.pbf file using this tool - https://github.com/systemed/tilemaker
Download .osm.pbf file from Geofabric. To download for a custom area, you can use Protomaps or BBBike Extract
Download tilemaker
Execute the following command
tilemaker --input netherlands.osm.pbf --output netherlands.mbtiles --process resources/process-openmaptiles.lua --config resources/config-openmaptiles.json
You can read more about it in this blog post - https://blog.kleunen.nl/blog/tilemaker-generate-map

How to compact mbtiles with mbutil

I'm creating maptiles with arc2earth and ArcGIS and it creates a lot of duplicate tiles.
I would like to reduce its size using mbtiles. I think it is possible to "compact" tiles, but I don't find the way.
Do you know if mbtiles still have compact command or it is just been deprecated?
Thanks!
At the moment mbutil doesn't expose this as an option - TileMill is the only client that supports properly compressed tiles. Of course, mbutil is an open source project, so if you're game, you can built it and add it.

TMS tile source in routeme/mapbox

Using the MapBox iOS SDK (routeme) is it possible to point to an offline TMS directory structure of tiles?
I know that I can point to an online TMS source like OpenStreetMap but I would like to just store a TMS directory structure on the device for offline use.
It doesn't out of the box, but you can create your own RMTileSource to easily do this. You want to go straight up to RMTileSource as opposed to modeling after something like RMOpenStreetMapSource since this is a subclass of the general web tile handling class.

Proper way to create tile maps for Leaflet.js?

I am trying to build a custom-designed map, with correct geodata. It could even be an image created in illustrator, but it has to be exported as a set of tiles in correct map format - so that it can be read by tools like Leaflet.js
What confuses me is that none of the available map tools seem to work very well together. I did find Tilemill, which looks very promising (it has a very clean interface and works with CSS), but:
Openstreetmaps does not allow downloading tile images, only XML data in OSM format.
Tilemill does not allow importing Openstreetmaps XML data (why!).
Even if you manage to design a map in Tilemill, you still cannot export tile images, only a proprietary SQL database format? What's the point of that?
If Tilemill is useless, are there other tools that allow opening OSM XML data and applying your own design styles?
There are some sources that talk about building your own tile server:
This source suggests converting OSM to PostGIS using SQL, and then using a custom python script and a tool named Mapnik. Then it says that it's not recommended to use Mapnik for OSM....
This source sounds promising, but then it casually mentions that you have to build and run your own custom Linux distribution...
Is there a simpler way to create map tiles with correct filenames and folders for Leaflet.js?
Tilemill does not allow importing Openstreetmaps XML data (why!).
OpenStreetMap XML is an interchange format: it's a way to transfer things around, not to use them. You can import it into PostGIS and use it in TileMill.
Even if you manage to design a map in Tilemill, you still cannot export tile images, only a proprietary SQL database format? What's the point of that?
If you export millions of tile images, you'll fill up your hard disk and run out of inodes. It's a bad deal. That's why we made MBTiles, which is not proprietary, but very much open source in every definition of the word, and you can export it to disk with mb-util if you so wish.
If Tilemill is useless, are there other tools that allow opening OSM XML data and applying your own design styles?
TileMill isn't useless, but if you want another option, you can use Maperitive, though it is proprietary in every sense of the word.