by JosephRedfern · 9y ago · 0 comments
Help me out here.
You'd only probably want to support one or two projections out of the box (EPSG 4326 and 3857, the respective geographic and projected coordinate systems that pretty much are the de-facto standard in GIS). The end-user would have to use PostGIS spatial query to project the data if they wanted to see it on map.
Then you would retrieve the extent (bounding box) of the data from the query, send that to your server, fetch the tiles, and have the Leaflet client render basemap under the data. You could look into https://github.com/lukasmartinelli/osm-liberty for some inspiration of self-hosted OSM.
For a less detailed backdrop you could look at Natural Earth. For example, it has inner divisions of countries (so states and the like) in about 15 megabytes:
http://www.naturalearthdata.com/downloads/10m-cultural-vecto...
Or major city/town names in 1.5 megabytes:
http://www.naturalearthdata.com/downloads/10m-cultural-vecto...
(there are also less detailed versions of those datasets intended for use at smaller scales.)
The main openstreetmap.org tile servers are liable to block your application if you put too much load on it, but there are plenty of companies which will sell you tile server access, (GeoFabrik, ThunderForest, Mapbox, Mapzen).