9 ms·
Self Hosting a Google Maps Alternative with OpenStreetMap
- xrayarx 4y agoNice little article about hosting OSM on a desktop. Including github repo.
- dutchbrit 4y agoWhen it comes to running in the "cloud", I'd probably go for Hetzner. Way way way cheaper than the examples mentioned in this post. I guess the main question is, how much is privacy really worth to you - or what other alternatives are there that meet my demands ie. Mapbox? Think I'll give this a go, always have wanted to run my own instance of OSM, to see how performant it is/how much traffic you can handle on a single server.
- Aachen 4y agoAlso the quality, though. I don't know how many times we got email notifications that our VPS will be rebooted or our storage unavailable due to maintenance this or that. Don't know if that's normal but it's another argument, in my situation at least, to keep hosting my modest requirements at home or from the office if it's work stuff.
- coolspot 4y agoAWS just goes down without sending emails and without even acknowledging the outage on the status page.
- adjusted 4y agoHow easy is it to sync with the latest OSM?
- wcedmisten 4y agoAuthor here: the docker project for the tile server allows setting up automatic syncing fairly easily: https://github.com/Overv/openstreetmap-tile-server#enabling-automatic-updating-optional https://github.com/Overv/openstreetmap-tile-server#enabling-... I'm not sure about Nominatim or Valhalla's ability to auto-sync the latest changes, at least with the dockerized version, but it may be possible.
- Aachen 4y agoI think the official Nominatim server has minutely updates so I'd be very surprised if the open source version isn't the same and can't do that as well. I've never set it up though, so I'm not sure where to find those docs.
- spiekerooger 4y agoYes, you can do minutely updates with Nominatim, instructions are here: https://nominatim.org/release-docs/latest/admin/Update/ https://nominatim.org/release-docs/latest/admin/Update/
- KronisLV 4y ago> Because I don't have a static IP address through my Internet Service Provider, I needed to use a Dynamic Domain Name Service client, which updates my DNS records to point at the current IP address of my router. I'm guessing that your router is available through the Internet directly, then? I wonder in how many places that's the case, because it isn't in my country (Latvia) and for my ISP (LMT, wireless connection in the countryside), because it seems like they're using CGNAT or something and any inbound traffic ended up getting dropped, at least the last time I tried: https://en.wikipedia.org/wiki/Carrier-grade_NAT https://en.wikipedia.org/wiki/Carrier-grade_NAT What I eventually did was rent a few cheap VPSes and set up WireGuard on them, so that my homelab servers could be accessed through the VPSes. I wrote a vague tutorial on my blog (though I should add the disclaimer that you probably don't want to forward almost all the ports if you're not lazy): https://blog.kronis.dev/tutorials/how-to-publicly-access-your-homelab-behind-nat https://blog.kronis.dev/tutorials/how-to-publicly-access-you... Either way, this seems like a cool project! > Even on this smaller extract, these services already use a large portion of my 1TB SSD (667 GB total). Assuming the usage scales proportionally, I would need around 3.7TB of storage for the entire planet. Not to mention the RAM requirements also scaling. Though I can't help but to wonder why it wouldn't be possible to decrease the maximum level of detail that the map files contain, like the levels that you can zoom in or out. Even in the demo environment you get the lowest level of detail (land contours) for the whole world, even if you only have a part of it available in the higher fidelity. > DigitalOcean Droplet (Memory Optimized): Total - $832.00 / mo > AWS r6a.4xlarge EC2 Instance: Total - $735.42 / mo > Azure D32as v5 VM Instance: Total - $1127.36 / mo As for the cost aspect, someone suggested Hetzner, which does both cloud VPSes and dedicated ones: https://www.hetzner.com/ https://www.hetzner.com/ Example of Hetzner VPS with 32 vCPU cores, 128 GB of RAM (CCX51, dedicated vCPU): 353.31 Euros a month + storage costs (600 GB by default) Example of Hetzner dedicated server with 16 CPU cores, 128 GB of RAM (from auction, not guaranteed): 46.05 Euros a month + storage costs (2 TB by default) Then there's Contabo, which also has prices that are generally on the more affordable side: https://contabo.com/en/ https://contabo.com/en/ Example of Contabo VDS with 12 CPU cores, 96 GB of RAM (Cloud VDS XXL): 149.99 Euros a month + storage costs (720 GB by default) Example of Contabo dedicated server with 20 CPU cores, 256 GB of RAM (Intel Dual 10-Core): 149.44 Euros a month + storage costs (depends) Apart from that, some people might also suggest that you look at https://lowendbox.com/ https://lowendbox.com/ or similar sites for good deals, though typically the focus of such sites won't be on beefier specs. Depending on exactly how many resources you need, a smaller piece of hardware might be suitable. There can sometimes be regional providers, for example I use Time4VPS for most of my hosting: https://www.time4vps.com/?affid=5294 https://www.time4vps.com/?affid=5294 (affiliate link, feel free to remove affid; though they to have a sale going on now) Apart from all that, I wonder why we don't have a "champion" project here that does pretty much everything in a single offering. Like for mail servers there's Mail-In-a-Box, for file storage there's Nextcloud (though some prefer Seafile). Such offerings are seldom ideal for all use cases, but are good for mass adoption.
- matkoniecz 4y ago>The nuance is in the value that Google Maps brings: expertise, scalability, and proprietary map data. note that this proprietary map data may be completely beating OSM or being vastly inferior, depending on your use case
- yetihehe 4y agoSometimes even scalability may be vastly inferior. I've implemented geocoding/geodecoding on OSM data, which for our use was 10-50x faster and our usage would chew through first tier plan in about an hour. Instead, our single server is about as expensive as that first tier.
- xchip 4y agoThis is awesome, this is why HN rocks! Thanks for sharing!
- mradek 4y agoGoogle maps with its massive places data set is just too good. It’s expensive but I find it is always consistently up to date and mostly reliable. Have found some bugs with the places api which I reported, such as it not working for some queries which are off by 0.001 lat/lng
- Aachen 4y agoOf course Google is going to be more up to date and complete for POIs when these POIs need customers to survive and customers use Google search to find info. Google uses its monopoly in the search market to also become dominant in the geo data market. There's no competing with a hundred million shop owners contributing and updating their own data. Hiking trails and other more niche things, though. Compare the data quality there :)
- lukeqsee 4y agoFor businesses who don't want to self-host maps, but still want to migrate away from Google Maps (or other major cloud providers' offerings), there's quite a few options (full disclosure, I run one of them): - https://mapbox.com https://mapbox.com - https://stadiamaps.com https://stadiamaps.com - https://maptiler.com https://maptiler.com - https://jawg.io https://jawg.io - https://thunderforest.com https://thunderforest.com - https://locationiq.com https://locationiq.com
- curiousfab 4y agoAs a solution in between, for those who want to include a OSM map on their website but don't want to put load on the official OSM tile servers, a simple tile proxy may be a good idea. I am using something based on https://wiki.openstreetmap.org/wiki/ProxySimplePHP5 https://wiki.openstreetmap.org/wiki/ProxySimplePHP5 for a long time already and since I don't need to have up to date tiles every day, I set the TTL to a few weeks. Together with leaflet this works beautifully.
- recuter 4y ago> Even on this smaller extract, these services already use a large portion of my 1TB SSD (667 GB total). Assuming the usage scales proportionally, I would need around 3.7TB of storage for the entire planet. Not to mention the RAM requirements also scaling. Why? 20TB consumer storage is a thing. https://www.amazon.com/Western-Digital-20TB-Internal-Drive/dp/B09TBF6GHJ https://www.amazon.com/Western-Digital-20TB-Internal-Drive/d... ($420, heh) What in the implementation makes the RAM usage explode?
- lukeqsee 4y agoServing large data sets at acceptable latency typically requires some proportional amount of RAM to keep frequently accessed files and indexes in memory (especially if you're serving off of HDDs). It depends on the service, but we frequently find geo services are RAM limited up to a certain point (at which point there's enough cached to make it CPU limited).
- recuter 4y agoI'm curios about self hosting for personal usage. An offline google maps, just on my laptop, or hosted somewhere but serving very few users.
- lukeqsee 4y agoIf it's just local--depending on the exact service--you probably wouldn't need a lot of RAM. Expect memory requirements to scale somewhat sub-linearly with diversity of regions simultaneously accessed.
- pramsey 4y agoValhalla in particular in an in-memory router, so it's holding the whole transportation graph in memory. Not sure about the tiling and geocoding pieces. Most organizations with a "need to serve the world" requirement presumably don't balk at buying all-the-RAMs. Amazingly, the max-RAM-in-machine number has grown faster than the data-in-the-world number, and just being memory bound is a perfectly reasonable design decision, given the performance and complexity wins.
- theandrewbailey 4y agoI work in e-commerce, and some of my clients have physical stores. Those clients want their site to have a store locator and a map to show the closest physical stores to customers. Over the years, I've looked into doing it with a self-hosted OSM solution, but never got too far, as it wasn't clear on what had to be done or run. Everyone seems to be OK with using a Google Maps product in the end (live or static map). I'll favorite this submission so I'll have something to reference if anyone balks at Google Maps ripping them off, and has a spare server around.
- Aachen 4y ago> Everyone seems to be OK with using a Google Maps product in the end (live or static map). Everyone is also okay with driving combustion vehicles for the time being, even while realizing that it might not be the cleanest option. Supporting Google similarly feels dirty when necessary, but yes it's the norm. For some things like traffic info, there also just isn't much of an alternative that works in most of the world with one simple thing to implement. There are things where OSM or TomTom or so just can't compete because it requires tracking half a billion people's locations in real time. Or showing up with your opening hours on Google's search monopoly by existing as a POI on TomTom or OSM will also just never happen, whereas existing as a POI on Google Maps is enough (using dominance in one market to influence another market). I know "everyone" is fine with using these products, but that's not why nerds get enthusiastic about seeing OSM in different places :)
- sylware 4y agoI do, and my web interface works with noscript/basic (x)html browsers.
- byyll 4y agoLink?
- croisillon 4y agohttps://rocketgit.com/user/sylware/lnanohtmltiledmap/source/tree/branch/master https://rocketgit.com/user/sylware/lnanohtmltiledmap/source/...
- traverseda 4y agoPersonally I'd really like to see an OsmAnd based tile server. OsmAnd has a lovely file format that's compact and kept up to date.
- sorenjan 4y agoHow come these map projects still use raster tiles? Are there no open source map projects that render the OSM data to vector data, and renders that vector data on the clients GPU? Maybe raster tiles are better at something I'm missing, but vector maps are easier to style[0], localize, they're sharper, easier to rotate and zoom smoothly. Maybe it's harder than I think to render it on all sorts of clients including mobile? When writing this I found out that MapTiler[1] is maintaining MapLibre GL JS[2], a fork of a Mapbox project to do just that. It would be interesting to see the difference between self hosting raster and vector maps and compare pros and cons. You can even render raster tiles from vector tiles on the server if the client needs it[3]. [0] https://openmaptiles.org/docs/style/mapbox-gl-style-spec/ https://openmaptiles.org/docs/style/mapbox-gl-style-spec/ [1] https://www.maptiler.com/open-source/ https://www.maptiler.com/open-source/ [2] https://github.com/MapLibre/maplibre-gl-js https://github.com/MapLibre/maplibre-gl-js [3] https://openmaptiles.org/docs/host/tileserver-gl/ https://openmaptiles.org/docs/host/tileserver-gl/
- chrisdalke 4y agoYou’re absolutely right and here’s an open source self-hosted project for MBTiles: https://github.com/akhenakh/kvtiles https://github.com/akhenakh/kvtiles More info from the author here: https://blog.nobugware.com/post/2019/self_hosted_world_maps/ https://blog.nobugware.com/post/2019/self_hosted_world_maps/ The vector tiles are much smaller in filesize than pixel data and the rendering technology is much better. Almost all the styling is done on the client side so the server is basically just querying a spatial database.
- deleted 4y ago[deleted]
- bdon 4y agoA few reasons: 1) Some of the most popular map library frontends like Leaflet support only raster tile layers out of the box. 2) Quality vector generalization (feature-dropping) is much more difficult than raster generalization. 3) A large fraction of use cases just need a "good enough" basemap without those extra features.
- 2Gkashmiri 4y agohey........ i have a wildly awesome idea about improving OSM. can anyone build this and help the community? i would help by giving my time.... here is the idea. a ride sharing app uses OSM for routing and such. fine. The driver follows the map but some times there are new turns or changes to road that are not in the map, or there are some improvements. my idea. the ride sharing app has the historical "ACTUAL" rides that have already taken place. we build a tool that takes point A&B from the route given and plots its own normal route. the actual trip and "Expected" trip are overlaid and if there are deviations, the software (after some adjustments for errors) this can give us a high level idea of the general map to actual route. this can also tell mappers which routes to fix and stuff... there is one tool that does manually but i would be like for large number of routes that would be matched 1:1.
- mtmail 4y agoGrab (https://www.grab.com/my/ https://www.grab.com/my/), Amazon Logistics, Apple (afaik) and some other mobile apps already do this. Full-time staff are correcting OpenStreetMap with one-way restrictions, speed limits, road width. Strava allows OpenStreetMap mappers to see where people walked/cycled to identify missing paths. Facebook is tracing new roads based on machine-learning satellite imagery (https://wiki.openstreetmap.org/wiki/RapiD https://wiki.openstreetmap.org/wiki/RapiD).
- 2Gkashmiri 4y agoI get that. I am saying such a tool should exist for people to do the same thing.
- raybb 4y agoFYI there's a list of all the companies doing stuff with OSM on the wiki https://wiki.openstreetmap.org/wiki/Organised_Editing/Activities https://wiki.openstreetmap.org/wiki/Organised_Editing/Activi...
- duiker101 4y agoUnfortunately, I am not aware of any open source project that covers the one feature that I still use Google Maps for. Reviews. Does anyone know of any? I am wondering now if that's something that could be federated well.
- spelledwrong 4y agohttps://mangrove.reviews/ https://mangrove.reviews/ exists but has almost no users. As far as I know, there's currently only the main instance, but the software is open source and they provide regular database dumps.
- gmiller123456 4y ago>Finally, to get external traffic from the internet connected to my computer (and specifically to Nginx), I had to set up port-forwarding on my router. FYI: Most providers will not allow this and will disconnect your services for it.
- bfgoodrich 4y ago
- eptcyka 4y agoWhat exactly do you mean by most? None of the ISPs I've used have ever done this.
- gmiller123456 4y agoEvery one I've ever looked at, here's the policy from my current provider: https://www.spectrum.com/policies/internet-use-policy#:~:text=Prohibited%20non%2Dresidential%20purposes%20include,or%20any%20multi%2Duser%20forums https://www.spectrum.com/policies/internet-use-policy#:~:tex.... I have run a personal web server open to the Internet. But a good 15 years ago, I actually tried running a public website. It lasted for a few months, then they disconnected me until I called and agreed to turn it off. I'm willing to bet your provider has something similar, enforcement may be lax, but it's not something you can count on.
- jonathantf2 4y agoThe only reason they have this in the contract is so they can cancel your service over it, I can guarantee they're not monitoring this at all any more. If they wanted to block hosting services they'd block the ports on their side.
- strken 4y agoThis would be very unusual in Australia. Perhaps it varies by country. Here's my current ISP's policy: https://www.tpg.com.au/forms/FINAL%20-%20TPG%20Acceptable%20Use%20Policy%20-%20combined%20acceptable%20and%20fair%20use%20policies%20-%2030%20Nov%202016.pdf https://www.tpg.com.au/forms/FINAL%20-%20TPG%20Acceptable%20...
- thex10 4y agoI notice an absence of transit directions despite an otherwise robust set of options. I would love to see OpenTripPlanner[0] included in this! [0] http://www.opentripplanner.org http://www.opentripplanner.org
- jmkb 4y agoYes, I was disappointed that the "bus" routing option appears to be for driving a bus. The Valhalla pedestrian routing engine does include ferry routes, though it completely ignores ferry schedules. (Ferry use can be discouraged in the routing options... the interface for fine-tuning options for the different routing profiles is quite impressive. )
- efxhoy 4y agographhopper supports loading gtfs public transit data.
- aquova 4y agoMight be worth noting that Nextcloud offers an OSM maps plugin that handles a lot of this stuff with a single click. I haven't used the service too much, but I was surprised how easy it was to set up.
- karussell 4y agoNextcloud only offers a user interface to external services.
- mvexel 4y agoFor those interested in deploying their own OSM stack including all the bells and whistles like Overpass, TagInfo etcetera, have a look at osmseed: https://github.com/developmentseed/osm-seed https://github.com/developmentseed/osm-seed
- pkalinowski 4y agoVector map of the whole Earth in PMTiles format is only ~65GB[1] and doesn't need any server or database - it's just a static file which you can host wherever you want. bdon (author of PMTiles) already commented on this thread. I recommend taking a look at https://protomaps.com/docs https://protomaps.com/docs - compared to this, raster tile servers sound like ancient technology. [1]: https://app.protomaps.com/store/planet-z14 https://app.protomaps.com/store/planet-z14
- ck2 4y agoI was marveling at my new Garmin watch yesterday that has topographical street maps for the entire world in only eight gigabytes. A watch having more than enough space for that is amazing in itself but really that's quite the compression for a seriously intense dataset. Technically everyone could have that already pre-installed on their PC or phone these days, the problem of course that is a commercial dataset buut openstreetmap solves that part.
- ear7h 4y ago> Based on the cheapest instance that matches my own PC's specs I wonder how much comoute and ram you need for the routing part. When I worked on a maps stack (no routing and cloud) we would only provision a big compute instance for importing data and seeding (pre-caching) the new tiles. The server itself could be less powerful, though you might have to pay extra for more hard drive space.
- sibman 4y agoI found that Organic Maps (https://organicmaps.app https://organicmaps.app) is a good open-source OSM-based alternative to Google Maps. Please check it out.
- efxhoy 4y agoI did a similar thing but with graphhopper for routing since it supports gtfs for public transit. I was just barely able to host tiles for and travelroute Sweden on a 16GB M1 MBP. It wasn’t fun though, graphhopper felt yanky and the travel time isochrones looked very jagged and not quite right. OSM style tiles were fine to host though with enough disk. Routing is the tricky part, especially public transit.
- karussell 4y ago> graphhopper felt yanky Can you explain this in more detail? Slow? Is this slow for you too: https://graphhopper.com/maps/ https://graphhopper.com/maps/ ? > I was just barely able to host tiles for and travelroute Sweden Hosting tiles with graphhopper? Do you mean the vector tiles we serve only for debugging purposes? > the travel time isochrones looked very jagged and not quite right For public transit? The GTFS does not give much room to interpret this. Or do you mean road vehicles? > Routing is the tricky part, especially public transit. Exactly. And this is the reason your comment is tricky to interpret as the original post was about road routing and for isochrones you meant probably also road routing but in your case you included GTFS and then the initial setup is a lot more demanding. So not really comparing apples with apples ...
- efxhoy 4y agoI don’t remember in detail but it wasn’t obvious for me how to set it up, which version to use, it was difficult to reason about error messages, etc. I used the docker image overv/openstreetmap-tile-server for the tiles. The isochrones looked jagged for both public transit and road as far as i remember. What’s tricky to interpret about my comment? I wanted to share that it’s possible to host google maps alternatives on a laptop with free software but it’s tricky to setup and not a smooth and fun experience, especially if you also want public transport routing, which is a hard problem.
- time4tea 4y agoIf you just want map tiles you don't really need much of anything. I run a map service on cheapest hetzner box, cost €4.50/month. Sure its not massive scale, but it would cost about $1000/month on mapbox (about 2m tiles). Just nginx + tileserver-gl + certbot.
- friend_and_foe 4y agoThis is cool and all, but I don't quite understand the point. You're not serving maps as part of a business case, what is your use case? I use OSM exclusively, for car navigation, topographical information, waterways and some custom overlay data and I run Osmand on my phone and store all the data for the entire US locally. If you're just planning trips and navigating around in your car, why run a server for it, especially one that powerful?
- SergeAx 4y agoGreat writing, thanks for sharing! Special kudos to author for improving interface and contribute it to upstream. Concerning hardware: I would not compare real hardware with cloud virtual servers. For a task like that I would rent a bare metal server. For example, Hetzner offers 6 cores AMD Ryzen 5 server with 128G RAM and 2T NVMe for only 90 EUR/month [1], but in Germany. I believe it is possible to find similar offer in US for comparable price. [1] https://www.hetzner.com/dedicated-rootserver?ram_from=128&ram_to=128&drive_type=nvme&nvme_count_from=1&nvme_size_from=1000&nvme_size_to=2000 https://www.hetzner.com/dedicated-rootserver?ram_from=128&ra...
- qwertox 4y agoThank you! It's on my todo-list to set up such a server and your work will really help with it. Here is another excellent write-up from Stefan Erhardt who is the founder of OpenTopoMap [0][1] which gives step-by-step instructions [2] on how to set up a tile server with custom tile rendering, also based on OSM's data. Also worth mentioning is GeoServer [3] [0] https://opentopomap.org/ https://opentopomap.org/ [1] https://github.com/der-stefan/OpenTopoMap https://github.com/der-stefan/OpenTopoMap [2] https://github.com/der-stefan/OpenTopoMap/blob/master/mapnik/README.md https://github.com/der-stefan/OpenTopoMap/blob/master/mapnik... [3] https://geoserver.org/ https://geoserver.org/
- 3np 4y agoIn a similar vain, there is maps.earth / headway. Aiming to be easy to self-host and very open to contributions. https://github.com/headwaymaps/headway https://github.com/headwaymaps/headway https://about.maps.earth/ https://about.maps.earth/ https://news.ycombinator.com/item?id=32551273 https://news.ycombinator.com/item?id=32551273