
Tools I Recommend for Building Geospatial Web Applications - DoreenMichele
https://medium.com/swlh/tools-i-recommend-for-building-geospatial-web-applications-274d6939536c
======
rohansingh
Really interesting to see how stable these recommendations are over time. I
built a commercial GIS system at a startup almost ten years ago, and
GeoServer, PostGIS and OpenLayers were the go-to tools back then too.

I left that startup soon after, but I heard that the backends for the GIS
product really didn't have to be upgraded or revamped for years— PostGIS and
GeoServer were just running solidly. Really a testament to the developers of
those tools.

------
lbutler
If you want to use vector maps you should also check out Mapbox GL JS. I use
their tiles but can use other providers or generate and host your own, which I
also do.

I've been making spatial apps for probably 8 years now and moved from Google
maps and Leaflet towards vector maps and I don't think I'd ever go back.

[https://github.com/mapbox/awesome-vector-
tiles/](https://github.com/mapbox/awesome-vector-tiles/)

~~~
spython
Do you know of any tutorials on how to generate and host own (raster) tiles?

~~~
lbutler
I would suggest starting with something static if you're just starting out.
Best way to get a feel for how it works without having to worry about setting
up a spatial database.

I used this article myself to learn: [https://geovation.github.io/build-your-
own-static-vector-til...](https://geovation.github.io/build-your-own-static-
vector-tile-pipeline)

There are a couple more articles at the bottom of the awesome vector tiles I
linked to before but haven't read them myself.

Reading through the list is good as well because it's a good overview of the
whole ecosystem.

Edit: This article also shows a simple way to dynamically serve vector tiles
directly from PostGIS. I didn't realise you could do it without the
middlewear, time to look into doing it this way!

[https://medium.com/nyc-planning-digital/using-the-new-mvt-
fu...](https://medium.com/nyc-planning-digital/using-the-new-mvt-function-in-
postgis-75f8addc1d68)

~~~
spython
Thanks for the explanation on the vector maps! Do you also happen to know how
to get started on raster maps, e.g. where to get satellite imagery, prepare
and host the tiles?

I am currently interested in it because I want to feed tiles to a GAN to
automatically generate maps of an imaginary earth..

~~~
jofer
Tiling and hosting is the straightforward part, FWIW.

For the reprojection, tile cutting, and overview building in gdal, see
[https://gdal.org/programs/gdal2tiles.html](https://gdal.org/programs/gdal2tiles.html)
You can also implement it yourself fairly easily if gdal2tiles.py doesn't have
the features you need. The files and directory structure it outputs you can
slap into into a static webserver and visualize directly with something like
leaflet.

As far as where to get data, that's a whole topic unto itself, but you can
start with things like
[https://earthexplorer.usgs.gov/](https://earthexplorer.usgs.gov/) for Landsat
or [https://datagateway.nrcs.usda.gov/](https://datagateway.nrcs.usda.gov/)
for NAIP or [https://scihub.copernicus.eu/](https://scihub.copernicus.eu/) for
Sentinel.

------
appleflaxen
These are awesome tools. Do any of them support non-earth coordinates? I have
a project where I want to do the equivalent of mapping data onto an asteroid
(arbitrary shape, including the possibilities of concavities).

What tools would work best / support that workflow?

~~~
jofer
That has nothing to do with these types of frontend tools and everything to do
with projection libraries.

In your case, all of the full libraries like proj4 already support it. What
you're describing is a custom ellipsoid and datum. Plug that in, and you're
good to go. You'll need to define the shape of your asteroid's equipotential
surface through a reference ellipsoid dimensions and a datum that defines
deviations from that ellipsoid. Making those is definitely non-trivial, but
once you've got the datum grids made, the math is the same as it is for Earth.

Also note that the datum is _not_ the shape of the asteroid directly. It's the
3D shape of a surface that's "flat" gravitationally. In other words, it's the
shape of sea level. It's something that depends on the density distribution of
the body and it's really not easy to measure, though it is easy to predict if
you know the density distribution a-priori.

The shape of the asteroid's surface is topography. That's independent of the
coordinate system.

~~~
beerandt
>The shape of the asteroid's surface is topography. That's independent of the
coordinate system.

I would have stated this first.

You don't really need a equipotential surface or even vertical datum, unless
you're trying to model potential energy, uphill and downhill, the flow of a
river, or the gravity well. All of which are unlikely to be known or easily
measurable on an astroid.

And if all you want to do is look at the geometry of a surface, you don't
need, or even want to use a horizontal datum and projection. It will just
overcomplicate the math.

Lat long or a similar polar (or elipsiodal) coordinate system using
orthometric height from the origin (or an arbitrary "zero" datum height) will
be much easier. Especially in the case of a body without existing coordinate
systems or projections that need to be "tied-in."

On the other hand, there are cases where using the GPS style coordinate system
makes more sense (which is just an x,y,z or x,y,H version of lat, long,
height. Yes, at it's heart, GPS uses Cartesian x,y,z). This is especially true
if you're not concerned with defining an ellipsoid, prime meridian or equator.
(Especially true for shapes that might not rotate, or fit well to an elipsiod
or sphere.)

The thing to remember is that coordinate systems and projections mainly exist
to translate between the many different ways people have been mapping and
measuring the Earth for hundreds or thousands of years. Sometimes there are
good reasons for these different methods (shape, area, directional
constraints), and sometimes it's advanced tech/ systems (SI vs Imperial,
Clarke elipsiod vs Hayford , or convenience/locality (relating Rose line
observations with those made in Greenwich), or national security (USA not
wanting nuclear icbm targeting stolen by USSR to be useful/meaningful/etc).

I say that to say this: If you're doing everything from scratch, there's no
need to complicate things. Stick to the simplest math that works for the
projects demands. There's nothing wrong with spherical polar or xyz.

~~~
jofer
Very true! You don't need a datum unless you're measuring angles on the
surface and elevations.

My point was more that the standard mapping tools allow non-Earth bodies just
fine. E.g. here's a UTM-like projection for Mars using a simple ellipsoid in
proj4: "+proj=tmerc +lat_0=0 +lon_0=0 +k=0.9996 +x_0=0 +y_0=0 +a=3396190
+b=3376200 +units=m +no_defs" You can happily define a simple sphere of the
right general size and have things work correctly.

It's not overcomplicating the math to use existing libraries, it's avoiding
rewriting a lot of fairly complex operations that are easy to get wrong.

You can use gdal, proj, org, et al quite well on other planets. It's a hell of
a lot easier than writing everything from scratch. They're set up to do things
like this.

~~~
beerandt
Yes, I didn't mean to imply that the software wouldn't be useful. (Or for
anyone to attempt to do all the math on their own.) Most people just don't
realize you can define a generic coordinate system, and depending on the
software, leave the projections/ datums blank (or set a generic/custom one),
and still get good use out of many of the tools. (The danger is some tools
that should only be used with projections might run error free without having
one defined and return a meaningless answer.

Although admittedly I haven't kept up with the different capabilities for the
last few years.

What method/format would even be used to generate points for an astroid?
Radar? Lidar? Photogrammetry? From a "where do you start" perspective, knowing
that would probably narrow down practical approaches...

------
pierredewet
I’ve used PostGIS with a Flask (and some js) front end when I was working on
my MSc. (Mapping deprivation and services by postcode) Worked amazingly well
and was relatively easy to get used to once I read the O’Reilly PostGIS book
to get used to the function calls. As with any data project; munging the data
into a usable format was the biggest hassle.

Edit: used google maps for the display before they changed their licence.
Haven’t updated to OSM yet...

~~~
thibautg
Same. I use Flask because it's one of the lightest frameworks I could find.
GeoJSON can be generated on the fly by PostGIS with very good performance. So
Flask is just used as middleware to submit the query from URL params to
PostgreSQL.

For the front-end I usually use Leaflet with Mapbox (raster) tiles. I should
switch to vector tiles but "@2x" raster tiles look good enough on HiDPI/Retina
displays.

I'm also an heavy QGIS user. I've managed to convince IT to put it in our
internal Software Center so users can install it in one click without needing
to be admin. It's becoming quite successful internally ;-). Take this Esri!

However we still pay hundreds of k€ to Esri and nothing to QGIS. I've
personnally donated a few euros but it's a really small amount compared to
what we pay to Esri.

------
tmostak
Also worth checking out OmniSci,
([https://www.omnisci.com](https://www.omnisci.com)), formerly known as MapD,
which can query and visualize tens of billions of geospatial records in sub-
second timeframes. See here for an interactive demo of 11.6 billion ship AIS
records:
[https://www.omnisci.com/demos/ships](https://www.omnisci.com/demos/ships).
Note that the backend database is open source, but the rendering engine and
web front end are part of the paid offering. [Disclaimer: I work there]

~~~
john_minsk
Hi. Checked out the demo. Super interesting!

If I want to become a developer and sell the projects on your platform: How
can I start?

What is proximate pricing schema?

~~~
tmostak
Hi John, thanks!

One option is our cloud (pricing is on the page).
[https://www.omnisci.com/cloud](https://www.omnisci.com/cloud) . You can also
spin us up from the AWS, Azure, or GCP marketplaces. If you need an on-prem
option, feel free to reach out: info@omnisci.com.

------
based2
[https://medium.com/@mbostock/command-line-cartography-
part-1...](https://medium.com/@mbostock/command-line-cartography-
part-1-897aa8f8ca2c)

Alt. for java devs:

[http://geoserver.org/about/](http://geoserver.org/about/)

[https://geotools.org/about.html](https://geotools.org/about.html)

[https://sis.apache.org/](https://sis.apache.org/)

------
leowoo91
I'm surprised Redis hasn't been mentioned for simple use cases. It has built-
in distance and search functionality: [https://redislabs.com/redis-best-
practices/indexing-patterns...](https://redislabs.com/redis-best-
practices/indexing-patterns/geospatial/)

~~~
Stevvo
It's essential if you are pulling any significant amount of data, e.g. shapes
for dividing a country into administrative districts will be a couple MB
uncompressed pulling from a PostGIS database.

~~~
thinkingemote
Interesting, looking over the docs I couldn't find anything beyond simple
radius queries.

It seems that all redis handles is points.

How would you query from shapes with redis?

~~~
Stevvo
Just using it as a response cache for GeoJSON.

------
softwarelimits
There is of course [https://github.com/sshuair/awesome-
gis](https://github.com/sshuair/awesome-gis)

I would be interesting to read more about why a tool was used, also: what are
the current limitations?

------
jijik
We started building a web geospatial platform 5 years ago. We migrated from
GeoServer to Mapbox VT but still using Leaflet because it brings us a better
interactivity on the map.

During the time, we've build a self service GIS SaaS product. In contrast with
a layers based GIS tools, it supports a complex Data models as you know from
BI tools.

If you are interested, try our free trial: [https://www.clevermaps.io/free-
trial](https://www.clevermaps.io/free-trial) and documentation:
[https://clevermaps.atlassian.net/wiki/spaces/CDD/overview](https://clevermaps.atlassian.net/wiki/spaces/CDD/overview)

------
eric_khun
\- Which API would you recommend to get accurate transit information data?

\- Is there any article talking about and path optimization including time
constraint? I've done something homemade (a mix of bird flight distance and
time to destination) it looks "okay" but I'm sure can be better.

I've just built a tool to calculate directions for long flights layover [1],
but the Google Maps API Directions sometimes lack of those data
(Tokyo/Singapore/Istanbul for example). Any recommendations appreciated!

[1] [https://travelhustlers.co/layover-in/](https://travelhustlers.co/layover-
in/)

~~~
jimktrains2
I would see if your system has a gtfs feed.

[https://developers.google.com/transit/gtfs/](https://developers.google.com/transit/gtfs/)

You could use pgrouting for routing.

[https://pgrouting.org/](https://pgrouting.org/)

~~~
rohansingh
GTFS and GTFS-RT definitely work, but in practice it seems each transit agency
implements them a little differently.

I'm actually a fan of the HERE Transit API. They've done the work of
interfacing with a bunch of providers, and you can query their whole dataset
with a REST API. Unfortunately it's proprietary and only free at small
volumes. But I found it much easier to hook up than working directly with a
transit agency.

That said, their coverage can be a bit random. For example, I ended up having
to do direct GTFS-RT anyway because HERE doesn't seem to have real-time data
for NYC subways.

------
Game_Ender
If you are looking for something to handle large amounts of data I would take
a look at deck.gl [0]. It useful when you have some rich data you want to
layer on top of a high quality map, with built in Mapbox GL integration [1].

0 - [https://deck.gl](https://deck.gl)

1 - [https://deck.gl/#/examples/core-layers/geojson-layer-
polygon...](https://deck.gl/#/examples/core-layers/geojson-layer-polygons)

~~~
jandrewrogers
It isn't clear how this handles large amounts of data? The examples are
thousands of polygons, which while useful isn't "large". Drone data models and
similar are often trillions of polygons. How do you scale-out the data model
processing?

As a tangent, deck.gl (first time I've looked at it) describes their 64-bit
floating point computation as having "unparalleled accuracy". It is not
possible to correctly compute some double precision geospatial relationships
using double precision computation (it requires quad precision or greater to
produce a correct double precision result) and other software systems,
including in open source, do this correctly.

~~~
Game_Ender
Everything is relative and in the Web usually large is quite a bit smaller
than native, so here I assume “large” really meant “bigger than 2D Canvas or
SVG could handle”. This example has a few 100k things [0] so you could judge
by how well that works.

Not sure about the 64 bit statement, but I assume it means relative to normal
32 GL shader math. Which is definitely not “unparalleled”, but I assume better
than the truncated doubles of native JavaScript or the standard shader math.

0 - [https://deck.gl/#/examples/core-layers/geojson-layer-
paths](https://deck.gl/#/examples/core-layers/geojson-layer-paths)

------
ArtRichards
Ive used elasticsearch geoapi in the past. Cant speak to its current status,
but it was very helpful! [https://www.elastic.co/blog/geo-location-and-
search](https://www.elastic.co/blog/geo-location-and-search)

------
shade
I have a question that's kind of adjacent to this. I've wanted to play with
mapping and especially with geolocating data, but at least right now, I don't
want to put much money into it. Are there any reasonably decent tools for
doing bulk address to latitude/longitude geolocation, preferably something I
could pull down and run in Docker containers on my desktop machine? I'm aware
of the Data Science Toolkit, but it seems a bit out of date.

------
thecodemonkey
Great article! One thing that wasn’t mentioned was Geocoding — Converting
between addresses and coordinates. This is also a very common need for
geospatial web applications.

Here’s a couple of options:

geocode.earth -> Worldwide coverage

geocod.io -> US/Canada only, but supports spreadsheets, data appends and batch
geocoding

smartystreets.com -> Ideal for USPS address verification

Disclaimer: I’m the co-founder of Geocodio

------
alexhutcheson
If you outgrow PostGIS, you may want to look into GeoMesa, which allows you to
set up spatio-temporal indexing on top of NoSQL column stores including HBase
and Cassandra:
[https://github.com/locationtech/geomesa](https://github.com/locationtech/geomesa)

~~~
ohlookabird
Thanks for the pointer, haven't heard about it. Spatial-temporal indexing
sounds interesting!

Do you happen to have any estimates when things start to break down for you in
PostGIS? My largest table of PostGIS 3D geometries (line strings) has
~800,000,000 entries and most bounding box queries are still very fast
(<100ms).

~~~
alexhutcheson
No, I'm not a PostGIS expert unfortunately. It probably depends a lot on the
balance between reads and writes/updates.

------
franky47
I've been using Mapbox for client and personal projects, and so far it's been
great but I'd like to give Leaflet a try (for the sake of less dependence on
commercial companies for personal non-profit projects), anybody here went down
the same road, especially in the context of React applications ?

~~~
jbeales
Leaflet doesn't provide tiles, but lets you get tiles from a variety of
sources including OSM, & Mapbox, so you still need a tile provider, or need to
render your own tiles.

------
sergiomattei
GeoDjango is really awesome. I’ve used it for a few things geospatial and I
had no big troubles with it.

------
jakobdabo
Thanks for the recommendations.

I need to create a polygon of specified width based on an arbitrary GPS track
(which can cross itself multiple times). Can anybody recommend a JS library
which is capable of doing this?

~~~
randomgis
You should be able to this JSTS I think. Create a line with the gps track,
create a buffer with the specified distance, feed the resulting polygon to
your mapping library.

[https://github.com/bjornharrtell/jsts/blob/master/README.md](https://github.com/bjornharrtell/jsts/blob/master/README.md)

Sample use:
[http://bjornharrtell.github.io/jsts/](http://bjornharrtell.github.io/jsts/)

------
ProjectBarks
For anyone who is looking for good 3D geospatial tools I recommend Cesium JS.
It works great for pretty much any amount of data.

cesiumjs.com

(In full disclosure I did work as an Intern for CesiumGS)

------
tobilg
In case someone needs geofencing capabilities, have a look at
[http://www.tile38.com](http://www.tile38.com)

------
chvid
Suppose one wants a simple world map with one or two levels of zoom and some
interactive points plotted over it. What would be the recommended approach?

------
askytb
Can anyone recommend any tools for routing? Ideally with a couple sentence
pros/cons breakdown

~~~
sampo
> Can anyone recommend any tools for routing?

Google's Operations Research Tools has implementations for some vehicle
routing algorithms.

[https://developers.google.com/optimization/routing](https://developers.google.com/optimization/routing)

------
EGreg
Why not just use geohash and text ranges?

------
mlevental
is there a js framework that has most (some) of the functionality of qgis?

~~~
drewda
For geographic and geometric operations in JavaScript:

[https://turfjs.org/](https://turfjs.org/)
[http://bjornharrtell.github.io/jsts/](http://bjornharrtell.github.io/jsts/)

For projections:

[http://proj4js.org/](http://proj4js.org/)

[https://github.com/d3/d3-geo](https://github.com/d3/d3-geo)

