Introducing Crunchy Data Warehouse: A next-generation Postgres-native data warehouse. Crunchy Data Warehouse Learn more

Posts about Spatial

  • 7 min read

    Querying Spatial Data with PostGIS and ogr_fdw

    Kat Batuigas

    In my last post, I did a simple intro to foreign data wrappers in PostgreSQL. postgres_fdw is an extension available in Postgres core that allows you to issue queries against another Postgres database. It's just one of many foreign data wrappers

    Read More
  • 6 min read

    Waiting for PostGIS 3.2: Secure Cloud Raster Access

    Paul Ramsey

    Raster data access from the spatial database is an important feature, and the coming release of PostGIS will make remote access more practical by allowing access to private cloud storage.

    Previous versions could access rasters in public buckets, which is fine for writing blog posts

    Read More
  • 6 min read

    Waiting for PostGIS 3.2: ST_Contour and ST_SetZ

    Paul Ramsey

    One theme of the 3.2 release is new analytical functionality in the raster module, and access to cloud-based rasters via the "out-db" option for rasters. Let's explore two new functions and exercise cloud raster support at the same time.

    OpenTopography

    Read More
  • 5 min read

    Using PostGIS and pg_featureserv with QGIS

    Martin Davis

    My colleague Kat Batuigas recently wrote about using the powerful open-source QGIS desktop GIS to import data into PostGIS from an ArcGIS Feature Service. This is a great first step toward moving your geospatial stack onto the performant, open source platform provided by PostGIS. And there's no need to stop there! Crunchy Data

    Read More
  • 4 min read

    Waiting for PostGIS 3.2: ST_MakeValid

    Paul Ramsey

    One of the less visible improvements coming in PostGIS 3.2 (via the GEOS 3.10 release) is a new algorithm for repairing invalid polygons and multipolygons.

    Algorithms like polygon intersection, union and difference rely on guarantees that the structure of inputs follows certain rules. We call geometries that follow those rules "valid" and those that do not "invalid".

    The rules are things like:

    • Polygon rings should not cross themselves
    • Polygon rings should not cross other rings
    • Multipolygon components should neither touch nor overlap
    Read More
  • 4 min read

    Waiting for PostGIS 3.2: ST_InterpolateRaster

    Paul Ramsey

    A common situation in the spatial data world is having discrete measurements of a continuous variable. Every place in the world has a temperature, but there are only a finite number of thermometers: how should we reason about places without thermometers and how should we model temperature?

    For many use cases, the right way to model a continuous spatial variable is a raster: a regularly spaced grid where each square in the grid contains a value of the variable. This works for temperature and precipitation; it works for elevation and slope; it even works for travel times and wayfinding.

    For this blog post, we will build up a temperature surface for Washington State, using the discrete temperature measurements of a set of Department of Transportation (WSDoT) weather stations.

    Getting the Data

    Read More
  • 6 min read

    (The Many) Spatial Indexes of PostGIS

    Paul Ramsey

    Spatial indexes are used in PostGIS to quickly search for objects in space. Practically, this means very quickly answering questions of the form:

    • "all the things inside this this" or
    • "all the things near this other thing"

    Because spatial objects are often quite large and complex (for example, coastlines commonly are defined with thousands of points), spatial indexes use "bounding boxes" as index and search keys:

    • Bounding boxes are of a small, fixed size, only 4 floats for a 2D box; and,
    • Bounding boxes are very inexpensive to compare to test things like containment.
    Read More
  • 6 min read

    Performance Improvements in GEOS

    Paul Ramsey

    We at Crunchy Data put as much development effort into improving GEOS as we do improving PostGIS proper, because the GEOS library is so central to much geospatial processing.

    The GEOS library is a core piece of PostGIS. It is the library that provides all the "hard" computational geometry functionality:

    • Intersections of geometry
    • Unions of geometry
    • Differences of geometry
    • Buffers of geometry
    • Geometry relationship evaluation
    Read More
  • 8 min read

    ArcGIS Feature Service to PostGIS: The QGIS Way

    Kat Batuigas

    As a GIS newbie, I've been trying to use local open data for my own learning projects. I recently relocated to Tampa, Florida and was browsing through the City of Tampa open data portal and saw that they have a Public Art map

    Read More
  • 8 min read

    Loading Data into PostGIS: An Overview

    Kat Batuigas

    There are a lot of ways to load data into a PostgreSQL/PostGIS database and it's no different with spatial data. If you're new to PostGIS, you've come to the right place. In this blog post, I'll outline a few free, open source tools you can use for your spatial data import needs.

    You can use a desktop GUI application like QGIS, and/or command-line utilities. If you want more flexibility, it's great to have both types in your toolkit.

    I'll talk about importing to PostGIS within the context of vector data, since it's a much more common use case. It's possible to import raster data

    Read More