I have developed a tracking web-based application using openlayers and OSM. Everything is working fine
Now I need to make the application works offline i.e. host certain country map on my local server. I downloaded .OSM data for the required country.
1- How I will render and host this data?
2- How I should included the hosted map in my code?
It may be very easy and basic to most of you guys, but I am struggling on this!
There’s quite a lot of stuff at https://switch2osm.org/serving-tiles/ . If the country that you’re talking about is the one that I think that it is (about the same size as Scotland in OSM terms) then your 4Gb server should deal with that OK. The tiles will be raster tiles (like the ones at OpenStreetMap), not vector, though. You can point OpenLayers at those tiles. An OSM tile has a URL like https://a.tile.openstreetmap.org/7/69/42.png . Your server will have a different URL; just use that when you set up the tile layer in OpenLayers.
If you absolutely want vector tiles have a look at https://openmaptiles.org/ - although it’s not something that I’ve got a lot of familiarity with.
Having said that however, is there a logical reason why you’ want to use Windows for a tile server? You may of course have Windows-specific stuff in your main application, but you can view the tile server as a “black box” that just gives you tiles when you provide the appropriate URL.
Or a virtual machine. You could host a Linux VM inside your Windows box. Same idea as Docker.
An idea… OSM is available in country-sized chunks as vector maps, MapsForge format, and there’s a library for displaying the map directly, applying a theme to style the result as desired. This all fits in a phone. (In my phone’s case, all of Western Canada, a huge place, offline.)
Maybe just maybe… Has anybody written a module to convert the output from this MapsForge library, for a given square, into a vector tile as requested above? Seems simple enough: convert a square of vector data from one format to another. It might be a path to a solution…