7 ms·
Let me plug OpenLayers, which uses OSM and is way harder to use than google maps but once you stop hating on it you realize it can do a bunch of things that goo
by kristopolous 6y ago
Let me plug OpenLayers, which uses OSM and is way harder to use than google maps but once you stop hating on it you realize it can do a bunch of things that google maps really can't and is more versatile in numerous ways - ymmv as always. (https://openlayers.org/en/latest/examples/ https://openlayers.org/en/latest/examples/).
I've found it more useful for specific applications that I build because it's far more customizable. The map truly feels like it's part of the app and not just some mapbox or leaflet thing sitting on top of gmaps. Again, these aren't hard facts, just stylistic preferences on my part.
The ES6 is not really a dealbreaker if you're using something more traditional. I just make my own "map.js" that exposes the interfaces I need, then I transpile it and include it like anything else.
I know that sounded really complicated, but my package.json is 10 lines, that's it.
This way you can use it in a much more conventional classical way without jumping the whole project over to ES6 syntax.
- veza 6y agoI feel like this is the story of open source tools. Way harder to use but once you know the tool the power and freedom is much greater, and even the pleasure of using it. I'm also thinking of cli vs gui here. Sounds like delayed gratification.
- 7952 6y agoI find that if you need more complex mapping features then OpenLayers is really good. It can do an amazing amount straight out of the box, but it does take time to get used to the API. It is more like an actual mapping or GIS program. But for building functionality outside of the map I tend to use Leaflet instead due to the ease of use. You can treat the map more like a black box and the API is easier to use.
- kristopolous 6y agoAbsolutely. If you want something that's no hassles there's a lot of great options. Heck I'll just do the straight Google maps api often, it's really easy. OpenLayer is like vim/emacs, some people think the hassle is worth it.
- alec_kendall 6y agoThe viability of using Google maps really comes down to the application. An application with a lot of users that rely on the usage of street view can become very expensive. Nice quote: “Don't lose out on the potential of tomorrow by thinking too big today.”
- xfour 6y agoSurprised that no one is talking about ways to leverage the server so you’re not doing all the work on the client. You can shift layers by precomputing either raster or vector so you don’t push your poor, maybe mobile client to the max. Classically you would do this with Tilemill for rasters which was amazing software, if crashy. And since we’re on a mapbox thread what I think put them on the map. I wish it was still actively developed and adapted for vectors.
- bdon 6y agoPrecomputing raster tiles became painful once screen densities started to demand @2x and even @3x resolution images. https://github.com/go-spatial/fresco https://github.com/go-spatial/fresco and https://github.com/maputnik/editor https://github.com/maputnik/editor are TileMill-like editing programs, though specific to one tile format and renderer (MapboxGL)
- bentaber 6y agotippecanoe (also from mapbox) is fantastic software for vector tile generation. https://github.com/mapbox/tippecanoe https://github.com/mapbox/tippecanoe
- everybodyknows 6y agoOpenLayers supports rotation, Leaflet does not -- a considerable difference in implementation burden. https://github.com/Leaflet/Leaflet/issues/268 https://github.com/Leaflet/Leaflet/issues/268 https://openlayers.org/en/latest/examples/rotation.html https://openlayers.org/en/latest/examples/rotation.html This is a critical point for anyone selecting an API to build on top of with their own ambitious new web app idea.
- jokoon 6y agoHow can I generate raster tiles myself for a specific region, so I don't have to use planet.osm? I can find regions on geofabrik.
- bdon 6y agoMost production raster tile systems use osm2pgsql + Mapnik. These are not easy to install. You may need to generate two or three sets of raster tiles for different pixel densities. The total number of tiles will explode past around zoom level 15. https://switch2osm.org https://switch2osm.org is a good intro. The newer way to do raster tiles is to actually generate vector tiles first, and then do the rasterization dynamically. Mapnik can do this, renderers like MapboxGL can be run in headless mode to do this as well. Yes, I wish this was easier too.
- berkes 6y agoIn addition, modern browsers can display vector tiles directly. Mobile and apps have a somewhat harder time with this. https://www.maptiler.com/ https://www.maptiler.com/ has a good introduction for this wrt Open Street Map.
- bdon 6y agoVector tiles with OpenLayers doesn't feel as smooth to me compared to MapboxGL or Tangram https://openlayers.org/en/latest/examples/mapbox-style.html https://openlayers.org/en/latest/examples/mapbox-style.html but it seems to be improving rapidly.
- for_xyz 6y agoLast time I checked (almost 2 years ago) OpenLayers did not support webgl backend for vector graphics. That's why it was slower.
- jokoon 6y agoAren't those vector tiles a little heavy, since they're likely json? Of course I can guess a lot of data can be removed and simplified, but still, PNG seem lighter...
- kalyanganjam 6y agoStarted using OpenLayers 2 weeks ago for a side project. Agree with you on power of OL. I just started basic features and already loving it. Apart from OL API doc. Could you please recommend any book/course to learn both concepts & API.
- kristopolous 6y agoNope. Just read the source code. All the references I have seen online are outdated or aggravatingly incomplete. Seriously. The nicest part about the source is that it doesn't lie. It's rarely as scary as your anxiety tells you it's going to be. Even for larger projects. You got it, may as well use is.
- jseliger 6y agoLet me plug OpenLayers, which uses OSM and is way harder to use than google maps but once you stop hating on it you realize it can do a bunch of things that google maps really can't and is more versatile in numerous ways I have Open Street Map on my phone, and "harder to use" describes it well. The problem is that for me, and, I'd bet, for many others, "easy to use" is the most important thing a map app can do.
- D_Guidi 6y agoopenlayers is more a gis platform, while leaflet is easier to use and closer to Google maps api
- simonw 6y agoAny chance you could share your package.json in a gist? I'm trying to get more familiar with them, would love to see a clean 10-line example.
- grawprog 6y agoYears ago I used openlayers and osm to develop an online map to display data for a research project I was working on. I originally considered using Google's api, but their licensing at the time was incompatible with the terms of our grant regarding our collected data. I enjoyed working with OSM, it was actually my first experience building an application around an external API. It was a fun experience and i was fairly pleased with the way it turned out. It ended up going live for a small time, though, we ended up running into a snag with the government after finding an endangered species in an active mine site and were forced to remove our public data and submit it all to a private government database locked behind fees.