You probably don't need PostGIS
blog.rebased.pl
blog.rebased.pl
I don't disagree in this specific case, but that's not always true.
I remember on a contract years ago another team working on a project - that started before I joined and was still going when I left - to build a big data analytics pipeline (hadoop, kafka, etc.) that achieved nothing. The whole thing could much more easily have been implemented with SQL Server (which they already had), PostgreSQL, or whatever.
At the very least it cost them a lot of wasted effort plus maybe a dozen sets of salaries and contractor rates (there was a mix). But it also stymied solutions in other areas because the answer was, "oh, we don't need to do that because the big data project has it covered." The opportunity cost was significant: the company lacked the capabilities it needed for as long as this white elephant continued lumbering on its way.
So yeah maybe if you only need to store the data and don't need operations (why even bother then), otherwise just use postgis.
[1] https://en.wikipedia.org/wiki/Geographic_coordinate_system#G...
You don’t need PostGis to find the nearest McDonald’s closest to an IP address of every visitor. A degree of lat is 69 miles, and a degree of long is easy to calculate based on the lat, but you may need an extra case if you want to be correct for the tiny number of people that live near the antimeredian line.
I wonder if people run toward PostGis just because they don’t know to google haversine or the spherical law of cosines.
That being said, I have often come up with decent hacks that solve a customer problems but biting the bullet and adopting Postgres may have been ultimately better. I wish PostGis was a skill I have, but in a pinch the law of cosines is quite passable.
I'll gleefully counter-argue some run toward PostGis just because they don't like NIH syndrome ^^
Even if they do know how, it looks like running PostGis is an easier way to achieve the desired outcome.
Also, as was mentioned, this was posted earlier today: https://news.ycombinator.com/item?id=22820485
PostGIS is a whole big external thing that Postgres doesn't ship with.
Any running Postgres cluster can load and use the extensions in the article, with no ops work. Even environments like RDS have these extensions available.
If you want PostGIS, you need to explicitly run PostGIS; if you want PostGIS-as-a-Service, you need to find someone who is explicitly offering PostGIS-as-a-Service.
https://redislabs.com/redis-best-practices/indexing-patterns...
Here's a couple Lyft talks:
Redis at Lyft: 1,000 Instances (2017)
https://www.youtube.com/watch?v=U4WspAKekqM
Geospatial Indexing: The 10 Million QPS Redis Architecture Powering Lyft (2017)
PostgreSQL geometry field are just that, 2D geometries, on a plane, in no particular projection system.
Spatial geometries are relative to a projection system. Try to "draw" a square with GPS coordinate and project it in your local official projection reference, you'll probably not get a squared.
Now, if you don't need precision, feel free to use geometries. But be very aware of the trade off you're making. The article, in my opinion, dismisses them a little too fast.
I basically agree with the post because I found myself in a similar position a few years ago. I inherited a map with dots on it, and I thought “oh, I need to move this to PostGIS.” But it turned out to be overkill. I wasn’t using any geometries, and I didn’t even need distances from a radius. I was just showing events by location, time, and type. Two columns for latitude and longitude were more than enough.
But there is a major trade-off and the article does not even mentions it. It is perfectly fine to consider the GPS coordinate system and basic geometries are good enough for short distance. As long as you're aware that GPS coordinate are actually set in a precise projection system and that you are making a informed decision.
https://mapnik.org/news/update
When it got so far along, OSM started using it in the demo rendering system that backs the 'standard' tiles on openstreetmap.org. Those tiles often get called "mapnik", because Mapnik is a big chunk of the rendering system, but they are really OpenStreetMap-Carto, a map style maintained for OSM.
Edit: maybe I should have said "higher level geometries" than "more complex". In the sense that OSM "knows" about point and edges and nothing else.
https://wiki.openstreetmap.org/wiki/Rails_port/Database_sche...
This is a strong reason to use PostGIS.
https://macwright.org/2016/07/15/longitude-latitude-is-the-r...
PostGIS's built-in Geometry types maintain their shape anywhere on the globe.
Geography types try to deal with this sort of weirdness but are unfortunately slower and more complicated to work with.
Maybe I'm missing the point but I don't really see how that is easier then using "CREATE EXTENSION postgis;" and "ST_Distance" ?
And the real problem with all that isn't the size/deps themselves, but rather the fact that the size/deps will probably lead to you wanting to use a binary distribution (or pre-made Docker image) of PostGIS rather than treating PostGIS as any other Postgres extension installed against a regular running Postgres cluster. Which then means that you'll need to find/settle for the set of extensions that are packaged for that binary distribution, rather than just using the standard set of extensions that come with a standard Postgres distribution (e.g. the PGDG Postgres apt repo, which contains many individually-packaged extensions.)
These images contain geometry engine binaries like GEOS, which you will likely need if you want to perform operations other than `distance` at decent speeds.
(These days, it's actually quite a common request though and it's generally one of the first extensions most e.g. cloud offerings support)
If the web frameworks - specifically Django - do a lot of the heavy lifting with their integration and the installation in modern Postgres is so much easier, I don't really understand why NOT use it?
What is the downside, exactly? I guess you have to learn a few things, but it might be good to know anyway.
I've done a lot of ops work in my dev career, and I'm always reluctant to add another dependency (JS, btw, makes me crazy with how little is included in the standard library, and NPM is required for everything). So, I might be tempted to follow the advice in the article, and avoid using PostGIS for the simple use cases provided in the article.
For reference, I've also helped with non-devs work on python code for GIS systems for daily delivery systems. So I would most definitely be tempted to try to utilize PostGIS if I was in the GIS world dealing with map updates, and daily starts and stops.
Side note. Having been a programmer for several decades, and professionally for a decade at the time, I had truly forgotten how bad novice programmers are. Nested loops on long running functions all over the place (calculating optimal routes is not cheap computationally). It felt good to get some perspective at the time by helping the GIS department with their code.
One of the best talks I've ever seen, although if you do that much work yourself, you might as well form a company.
I consulted for the Canadian JPL, so I had tons of satellite data, but it was mostly ice, tundra and forest regions. Not much urban data, alas. :)
Although you could take your notebook down to the Ministry of Works and they would plug in a cable and give you all their street data at the time for free. I actually did that once.