[HN Gopher] Replacing Mapbox with open source solutions
       ___________________________________________________________________
        
       Replacing Mapbox with open source solutions
        
       Author : gaws
       Score  : 315 points
       Date   : 2023-02-17 16:27 UTC (6 hours ago)
        
 (HTM) web link (www.kschaul.com)
 (TXT) w3m dump (www.kschaul.com)
        
       | kabes wrote:
       | Worth mentioning that openlayers is also really extending their
       | webgl rendering capabilities lately.
        
         | lukeqsee wrote:
         | There's also support for MapLibre GL JS style specs in the
         | works! Excited to see another stable vector tile & style
         | renderer added to the ecosystem.
        
       | 0xDEF wrote:
       | Leaflet is also an interesting solution in this space:
       | 
       | https://github.com/Leaflet/Leaflet
        
         | lights0123 wrote:
         | Although I used to exclusively use it, Canvas-based maps just
         | run so much smoother and support things like rotation that are
         | really helpful for changing perspective.
        
         | aendruk wrote:
         | Vector tiles?
        
           | lukeqsee wrote:
           | https://github.com/maplibre/maplibre-gl-leaflet exists!
           | 
           | It's not perfect, and you don't see the full benefit of a
           | WebGL renderer, but if you want to keep using a Leaflet API,
           | it's great.
        
       | flakeoil wrote:
       | It's weird, 10 years ago I implemented using Google Maps API a
       | website with dynamic maps, distance matrix, geolocation, map
       | overlays and address autocomplete completely free also at high
       | traffic. It was also easy to use.
       | 
       | Five years ago Google started to charge an outrageous amount >
       | $1000/month and we could not continue so we switched to something
       | that cost $100/month. And that was for only the maps. We had to
       | scrap the distance matrix and address autocomplete.
       | 
       | Today it's still the same status, and if you want something
       | cheaper then you have to work on putting pieces together like the
       | Washington Post does.
        
         | lukeqsee wrote:
         | We offer a very competitive solution that is quickly becoming a
         | one-stop shop for what you mentioned: https://stadiamaps.com.
         | 
         | All that functionality for a lot less than $1000 / month.
        
           | countvonbalzac wrote:
           | you should put a price comparison for stadia vs. google vs.
           | mapbox
        
             | lukeqsee wrote:
             | Yes. We should, and we're literally working on it right
             | now!
        
         | keltex wrote:
         | Same here with our website https://www.meetways.com. This
         | product was created around the time google created their maps
         | API. In fact we worked extensively with google to help them
         | iron out some of their API issues. They even discuss our
         | product on their blog:
         | https://mapsplatform.googleblog.com/2008/10/geocoding-in-rev...
         | 
         | This site made a little bit of money, but not that much. But
         | then 5 years ago google raised their prices so much that we
         | were suddenly in the red. We had to drop the places API
         | (replaced with Yelp) and the autocomplete API (we don't even
         | use that anymore). Recently we've been moving to Apple Maps API
         | which has a pretty generous free tier. Stadia Maps also looks
         | interesting.
        
           | folli wrote:
           | I'm not affiliated, but a reasonably satisfied customer of
           | https://maptiler.com for my project https://cubetrek.com.
           | Perhaps also worth to take a look.
        
           | lukeqsee wrote:
           | Would love to chat to see if we can help you! If you want,
           | give me a shout at luke <at> stadiamaps.com
        
       | T3RMINATED wrote:
       | [dead]
        
       | jeffbee wrote:
       | The Post has been doing great data journalism lately. The maps
       | from the article were really well done. Yesterday they ran this
       | story that has all its graphics done in D3 and provides links to
       | notebooks at ObservableHQ with evidence supporting the arguments
       | made and conclusions drawn in the article.
       | https://www.washingtonpost.com/climate-environment/interacti...
        
       | wipfli wrote:
       | If you like PMTiles you should consider supporting Brandon
       | financially as a GitHub Sponsor.
       | 
       | Brandon is a solo-developer who builds Protomaps alone and we get
       | all his great stuff for free...
       | 
       | https://github.com/sponsors/protomaps
        
         | lukeqsee wrote:
         | You can also sponsor MapLibre:
         | https://github.com/sponsors/maplibre
         | 
         | (Disclaimer: I'm on the governing board, but derive no
         | financial benefit from it.)
        
           | pella wrote:
           | And https://donate.openstreetmap.org/
           | 
           |  _" OpenStreetMap is the largest open geographic database in
           | the world, the data infrastructure for multitudes of mapping
           | projects around the globe. Your donation to the OpenStreetMap
           | Foundation will cover our core operational expenses in
           | supporting the OpenStreetMap project: hardware costs, legal
           | fees, administrative assistant and other expenses of our
           | working groups and administration.
           | 
           | We currently run extremely lean for an operation for a
           | project the size and importance of OpenStreetMap. The
           | OpenStreetMap Foundation relies on revenue from individual
           | and corporate membership dues, profits generated by the
           | annual State of the Map conferences, and donations. We must
           | keep our income sources diversified, as these vary from year
           | to year, but our modest needs stay the same. For this, we
           | need your support."_
        
       | jackson1442 wrote:
       | Looks great. Been using Mapbox as my go-to for small projects
       | since it's much smoother than Leaflet and has better DX in my
       | opinion. This seems to capture all of that with an even better DX
       | so definitely will be trying it out.
        
         | lukeqsee wrote:
         | https://maplibre.org/ definitely attempts to preserve the DX
         | with free selection of tile providers.
        
       | preya2k wrote:
       | Is there an OSS way to use vector tiles, without using Mapbox?
        
         | mtmail wrote:
         | The article covers that. See the "maplibre-gl-js for client-
         | side rendering" section.
        
       | timwis wrote:
       | Also see valhalla for an open source routing engine:
       | https://github.com/valhalla/valhalla/
        
         | lukeqsee wrote:
         | Valhalla is great (I've contributed a few patches and run it
         | for a while)!
         | 
         | Also check:
         | 
         | http://project-osrm.org/
         | 
         | https://www.graphhopper.com/open-source/
        
       | jokoon wrote:
       | I don't want to sound annoying, but it's a bit hard to generate
       | raster tiles. I mean openstreetmap data is open and free, but it
       | doesn't seem they distribute any software to build the raster
       | tiles they host.
       | 
       | I don't know what they use, but it doesn't seem there is any
       | software that is simple enough to use.
       | 
       | I just want to configure a subregion, call generate-tiles.py
       | planet.xml or whatever, and be done with it.
       | 
       | I like open source, but there will always be open source software
       | that is needlessly complicated because, well, it lets companies
       | like mapbox and others to generate income for their expertise.
       | 
       | That's not the best open source spirit, in my view.
        
         | Doctor_Fegg wrote:
         | The classic instructions for raster tiles are at
         | https://switch2osm.org. I think there's a Docker image if that
         | floats your boat.
        
           | KronisLV wrote:
           | These are some really great instructions, I wish other sites
           | would be so informative and approachable.
           | 
           | They do have more details on the Docker container approach in
           | one of the pages as well: https://switch2osm.org/serving-
           | tiles/using-a-docker-containe...
           | 
           | Here's the relevant Docker Hub link:
           | https://hub.docker.com/r/overv/openstreetmap-tile-server
           | 
           | The requirements are considerable, though, given the
           | workload:
           | 
           | > Serving your own maps is a fairly intensive task. Depending
           | on the size of the area you're interested in serving and the
           | traffic you expect the system requirements will vary. In
           | general, requirements will range from 10-20GB of storage, 4GB
           | of memory, and a modern dual-core processor for a city-sized
           | region to 1TB of fast storage, 24GB of memory, and a quad-
           | core processor for the entire planet.
           | 
           | Personally, for lower end mobile devices raster tiles still
           | seem to perform better, when compared with at least some of
           | the current vector tile implementations. I actually recorded
           | a short comparison on my phone a while back:
           | https://www.youtube.com/watch?v=A-IRtBGO9rM
        
         | j_heffe wrote:
         | We used https://github.com/developmentseed/titiler (and rio-
         | tiler, the underlying library) at my last company which does
         | dynamic tiling based on some input raster. It's an awesome
         | project and there's nothing else quite like it in the
         | geospatial space.
        
           | lukeqsee wrote:
           | I discovered it while looking at raster solutions, and it is
           | pretty great! The raster stack is pretty bonkers. TiTiler
           | uses at least three fundamental layers: GDAL, RasterIO, and
           | rio-tiler. Each contribute a fairly significant improvement
           | (for the use-case) over the underlying one.
        
         | [deleted]
        
         | livinglist wrote:
         | Test
        
         | uneekname wrote:
         | Open-source geospatial tools in general have developed rapidly
         | over the last couple of decades. Mapbox and friends have laid
         | groundwork, both good and "needlessly complicated." But there
         | are just too many people who care about this to think it'll
         | always be hard.
         | 
         | I assure you, the OSS (and in this case, OSM) community will
         | steadily build out better, faster software that includes more
         | and more of the features a modern map needs. It's already
         | looking like companies like WashPo are seeing the potential
         | here.
         | 
         | Come join us and make the world a better place :)
        
         | [deleted]
        
         | tylershuster wrote:
         | https://github.com/maptiler/tileserver-gl makes it really easy.
         | I have a pretty simple pipeline set up to download an OSM
         | extract, convert it to MBTiles, host it in CloudFlare, and
         | render raster tiles with this software.
        
         | lukeqsee wrote:
         | Checkout https://github.com/onthegomap/planetiler.
         | 
         | Super easy way to generate a MBTiles, which you can then serve
         | directly, or further convert to PMTiles, which can be used to
         | host vector tiles for client-side rendering using MapLibre (or
         | other renderers).
         | 
         | Raster tiles are a lot harder because you have to generate them
         | on the server, and that's a _lot_ more resource intensive.
        
       | cancan wrote:
       | [founder of felt, maintainer of some of the libraries mentioned]
       | 
       | this is amazing to see! we are happy to see our OS contributions
       | like tippecanoe are being used by people all over the place, and
       | i personally really love to work with journalists.
       | 
       | happy to answer any questions!
        
         | lukeqsee wrote:
         | Thanks for taking up the maintenance of Tippecanoe! I haven't
         | needed to use it too much, but when I have, it fills a nice
         | void.
        
       | trynewideas wrote:
       | In the tools space, cf. open source GeoJSON-to-vector tile tool
       | Tippecanoe, which recently got a new non-Mapbox home at Felt:
       | https://felt.com/blog/erica-fischer-tippecanoe-at-felt,
       | https://github.com/felt/tippecanoe
        
       | Doctor_Fegg wrote:
       | > But for most of our use cases, we don't need the latest and
       | greatest.
       | 
       | This is the crux of this. Let's not pretend that much of this is
       | anything other than "open source clones of Mapbox".
       | 
       | PMTiles is genuinely innovative and I'm delighted to see it
       | getting traction.
       | 
       | Maplibre GL (which I use and like very much) is a fork of the
       | last open source version of Mapbox GL, with not many code changes
       | between now and then.
       | 
       | Maputnik is an open source reimplementation of Mapbox Studio.
       | Mapbox went on to hire its original dev.
       | 
       | OpenMapTiles started life as basically a how-to/makefile pulling
       | together the disparate, poorly documented parts of Mapbox's open
       | source tile generation code. It's now mostly known for a
       | reasonable, not particularly exceptional vector tile schema.
       | 
       | It's great that people are now shipping production vector tiles
       | without paying the Mapbox dollar. But, PMTiles aside, this is
       | still Mapbox's world. The next challenge is to evolve the tech
       | stack to something beyond what Mapbox worked up five/ten years
       | ago.
        
         | lukeqsee wrote:
         | > PMTiles aside, this is still Mapbox's world.
         | 
         | Isn't this a bit like saying we're still in Google's world
         | because most maps still use Web Mercator? :)
         | 
         | Good tech builds on what came before. Mapbox did a lot of
         | ground-breaking work in building tooling around OSM, but so
         | have many others. The fact that they named it _Mapbox_ Vector
         | Tiles is genius in hindsight, because even though we may use
         | tons of tooling they didn 't create to build and render them,
         | their name is still there.
         | 
         | > The next challenge is to evolve the tech stack to something
         | beyond what Mapbox worked up five/ten years ago.
         | 
         | Agreed, and I think we've seen a lot of iterative work in the
         | open since then. The next challenge is likely building a OSS
         | stack to do proper 3D: open data (including OSM) to pixels, and
         | that work is already beginning across a lot of organizations:
         | https://github.com/nyurik/future-mvt/discussions, Overture
         | Maps, MapLibre, etc.
        
       | notyourday wrote:
       | Open source use we will, pay for development we won't, paywall
       | for our "reporting" we have
        
         | ARandomerDude wrote:
         | Write like Yoda you do.
        
       | ecf wrote:
       | Currently using Mapbox in an open-source project for their static
       | map API and I wholeheartedly recommend against it. Everything but
       | the simplest of polylines look jagged since they refuse to switch
       | to POST requests with a json body and instead rely on you fitting
       | in as much detail into URL query parameter length constraints.
       | 
       | Going to take a look at replacing them with PMTiles and my own
       | polyline rendering.
        
         | lukeqsee wrote:
         | There's actually a reason why most of these APIs support POST--
         | most use-cases are hot-linking, where you don't control how the
         | client makes the request. (Often using an <img>.)
         | 
         | Here's one alternative, if you don't want to build from
         | scratch: https://docs.stadiamaps.com/static-maps/ We don't have
         | much in the way of query string limits, so have at it!
        
         | andy_ppp wrote:
         | Are there decent label placement solutions these days? It's a
         | really tricky problem to do well.
        
         | leetrout wrote:
         | Subscribing for updates :)
         | 
         | Will you be talking about this work openly somewhere?
        
         | capitainenemo wrote:
         | Rather curious about the URL query parameter length constraint.
         | Excluding IE11/Edge, don't most major browsers have at least
         | 64k query lengths these days? Could you just serve the low
         | quality jaggy poly to few percent still on IE11/Edge and a high
         | detail one to the rest?
        
           | lukeqsee wrote:
           | A lot of servers impose a constraint on URL length, so I
           | suspect Mapbox does on their APIs.
        
         | tylershuster wrote:
         | I've switched over a fairly large transit client to PMTiles
         | hosted on CloudFlare for their dynamic map and am switching
         | another large transit client to using
         | https://github.com/maptiler/tileserver-gl with MBTiles and the
         | same style.json to generate static maps. It's all gone
         | swimmingly and we've cut costs by about $1,000 a month.
        
       | tpmx wrote:
       | Wasn't Mapbox once the low-cost option?
        
         | usrusr wrote:
         | And since the state of the open source map rendering art is
         | consisting almost exclusively of pre-licence-change forks of
         | mapbox code these days, they kind of still are.
         | 
         | I wonder if Strava's recent acquisition of fatmap.com
         | eventually boils down to them cutting ties with mapbox via
         | acqui-hiring some mb-libre excellence. I could imagine Strava,
         | due to the extreme map-centric nature of their product,
         | bleeding quite considerable money to mapbox.
        
           | kylebarron wrote:
           | I didn't think Fatmap was based on mapbox at all? I thought
           | it was their own custom renderer
        
             | gorbypark wrote:
             | I'm interpreting the comment above to mean Strava was/is a
             | user of Mapbox and bought Fatmap in an effort to wean
             | themselves off of Mapbox and use "inhouse" (Fatmap) mapping
             | tech.
        
           | lukeqsee wrote:
           | MapLibre has made really good strides (especially on the web)
           | since the fork--3d-terrain support, more tile sources, other
           | DX improvements (e.g., conversion to TypeScript).
           | 
           | https://maplibre.org/maplibre-gl-js-docs/api/
        
         | [deleted]
        
         | Operyl wrote:
         | Yup, which disrupted the market, and now it's not.
        
           | klysm wrote:
           | 1. Subsidize low costs with venture capital and take on a ton
           | of customers at a loss 2. Lock those customers into your API
           | somehow. Enough code is effectively lock in for a while. 3.
           | Change your pricing to be profitable. 4. Hopefully get
           | acquired before all your customers leave
        
             | tpmx wrote:
             | They seem to be at step 3 at the moment.
        
         | gorbypark wrote:
         | They used to be low-cost _and_ open source. Now they're source
         | available and not interested in anything but big clients. I was
         | using Mapbox for all my clients before their unopen sourcing,
         | and I tried reaching out three times to ask about options for
         | one of my clients. It wouldn't have been a huge amount of
         | money, probably a few hundred per month, but they never, ever
         | reply. That client wasn't even using any of their server
         | resources, they are 100% self hosted, it's just that Mapbox now
         | charges even for using their client. Anyways, I was trying to
         | give them money, and they wouldn't even acknowledge I exist. I
         | switched that client over to Maplibre and never looked back.
         | 
         | The other thing that annoys me is that they've more or less
         | abandoned all their open source repos without even as much of a
         | notice in the README. All these amazing tools sitting there
         | with open pull requests and no one responding for years. If
         | they just did a clean break, put a notice on everything they
         | weren't going to touch again, it would have been a lot
         | better/easier for the community to fork and move on with their
         | lives.
        
           | shawn-butler wrote:
           | Mapbox was born from open source tools & culture. They were
           | always active and supporting at FOSS4G.
           | 
           | I wonder what has changed?
        
             | jonas21 wrote:
             | VC funding? I think they were funded mostly by grants and
             | their own revenues for the first few years. Then they
             | started taking VC money (over $300M to date).
        
               | dataviz1000 wrote:
               | They were once Development Seed [0], a company that
               | specialized in making geo spatial visualizations for the
               | UN, NGOs and nonprofits. Development Seed was a large
               | contributor of code and modules to Drupal 6 which they
               | left. In the beginning, their open source mapping and geo
               | spatial visualizations projects were mostly funded by
               | grants from the Knight Foundation which funded news
               | related projects. MapBox came from an in-house tool they
               | developed to create and manage map overlay tiles. (I
               | could be making this all up.)
               | 
               | [0] https://developmentseed.org/
        
             | [deleted]
        
             | bpodgursky wrote:
             | It's a really hard product to make profitable.
             | 
             | The hosting and bandwidth costs are huge, and most of your
             | customers (by raw count and nominal usage) are hobbyists or
             | free products unwilling to pay even a few cents per user.
        
               | Tostino wrote:
               | There is distributed hosting tech for this type of thing
               | at this point. Use it. You could even go old-school
               | BitTorrent, it's been around for decades.
        
               | lukeqsee wrote:
               | It's hard, but certainly not impossible.
               | 
               | Hosting and bandwidth are key inputs to your costs, but
               | they are manageable.
        
       | sgt wrote:
       | Geoserver is also good for serving spatial data and tiles. A bit
       | dated look but fast and stable
        
       | lukeqsee wrote:
       | This is really awesome to see.
       | 
       | I'm involved in many of these projects (helped get MapLibre
       | started, wrote a library supporting PMTiles, have used
       | OpenMapTiles for years), and to see open-source, open-data win in
       | the end is really satisfying.
       | 
       | If anyone has any questions about how you could do this for
       | yourself, I'm happy to answer! (I have a company offering SaaS
       | maps, but we know SaaS isn't for everyone, and are happy to point
       | people the right direction when self-hosting is what you want.)
        
       | 762236 wrote:
       | If all of the tiles are coming from a single file (via PMTiles),
       | how are they cached by the client? Do clients cache byte ranges,
       | or do you configure things to give the appearance of serving
       | separate files?
        
         | lukeqsee wrote:
         | You typically use byte-range caching in libraries--either using
         | an edge worker (a la Cloudflare) to create separate GET
         | requests from the client's perspective or directly in the
         | client.
        
           | cancan wrote:
           | i think you can also directly call them from the maplibre lib
           | itself using the pmtiles adapter
           | 
           | https://github.com/protomaps/PMTiles
           | 
           | https://github.com/protomaps/PMTiles/blob/main/js/examples/m.
           | ..
        
       ___________________________________________________________________
       (page generated 2023-02-17 23:00 UTC)