26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (2024)

The “Dimensionally Extended 9-Intersection Model” (DE9IM) is a framework for modelling how two spatial objects interact.

First, every spatial object has:

  • An interior

  • A boundary

  • An exterior

For polygons, the interior, boundary and exterior are obvious:

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (1)

The interior is the part bounded by the rings; the boundary is the rings themselves; the exterior is everything else in the plane.

For linear features, the interior, boundary and exterior are less well-known:

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (2)

The interior is the part of the line bounded by the ends; the boundary is the ends of the linear feature, and the exterior is everything else in the plane.

For points, things are even stranger: the interior is the point; the boundary is the empty set and the exterior is everything else in the plane.

Using these definitions of interior, exterior and boundary, the relationships between any pair of spatial features can be characterized using the dimensionality of the nine possible intersections between the interiors/boundaries/exteriors of a pair of objects.

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (3)

For the polygons in the example above, the intersection of the interiors is a 2-dimensional area, so that portion of the matrix is filled out with a “2”. The boundaries only intersect at points, which are zero-dimensional, so that portion of the matrix is filled out with a 0.

When there is no intersection between components, the square the matrix is filled out with an “F”.

Here’s another example, of a linestring partially entering a polygon:

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (4)

The DE9IM matrix for the interaction is this:

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (5)

Note that the boundaries of the two objects don’t actually intersect at all (the end point of the line interacts with the interior of the polygon, not the boundary, and vice versa), so the B/B cell is filled in with an “F”.

While it’s fun to visually fill out DE9IM matrices, it would be nice if a computer could do it, and that’s what the ST_Relate function is for.

The previous example can be simplified using a simple box and line, with the same spatial relationship as our polygon and linestring:

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (6)

And we can generate the DE9IM information in SQL:

SELECT ST_Relate( 'LINESTRING(0 0, 2 0)', 'POLYGON((1 -1, 1 1, 3 1, 3 -1, 1 -1))' );

The answer (1010F0212) is the same as we calculated visually, but returned as a 9-character string, with the first row, second row and third row of the table appended together.

1010F0212

However, the power of DE9IM matrices is not in generating them, but in using them as a matching key to find geometries with very specific relationships to one another.

CREATE TABLE lakes ( id serial primary key, geom geometry );CREATE TABLE docks ( id serial primary key, good boolean, geom geometry );INSERT INTO lakes ( geom ) VALUES ( 'POLYGON ((100 200, 140 230, 180 310, 280 310, 390 270, 400 210, 320 140, 215 141, 150 170, 100 200))');INSERT INTO docks ( geom, good ) VALUES ('LINESTRING (170 290, 205 272)',true), ('LINESTRING (120 215, 176 197)',true), ('LINESTRING (290 260, 340 250)',false), ('LINESTRING (350 300, 400 320)',false), ('LINESTRING (370 230, 420 240)',false), ('LINESTRING (370 180, 390 160)',false);

Suppose we have a data model that includes Lakes and Docks, and suppose further that Docks must be inside lakes, and must touch the boundary of their containing lake at one end. Can we find all the docks in our database that obey that rule?

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (7)

Our legal docks have the following characteristics:

  • Their interiors have a linear (1D) intersection with the lake interior

  • Their boundaries have a point (0D) intersection with the lake interior

  • Their boundaries also have a point (0D) intersection with the lake boundary

  • Their interiors have no intersection (F) with the lake exterior

So their DE9IM matrix looks like this:

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (8)

So to find all the legal docks, we would want to find all the docks that intersect lakes (a super-set of potential candidates we use for our join key), and then find all the docks in that set which have the legal relate pattern.

SELECT docks.*FROM docks JOIN lakes ON ST_Intersects(docks.geom, lakes.geom)WHERE ST_Relate(docks.geom, lakes.geom, '1FF00F212');-- Answer: our two good docks

Note the use of the three-parameter version of ST_Relate, which returns true if the pattern matches or false if it does not. For a fully-defined pattern like this one, the three-parameter version is not needed – we could have just used a string equality operator.

However, for looser pattern searches, the three-parameter allows substitution characters in the pattern string:

  • “*” means “any value in this cell is acceptable”

  • “T” means “any non-false value (0, 1 or 2) is acceptable”

So for example, one possible dock we did not include in our example graphic is a dock with a two-dimensional intersection with the lake boundary:

INSERT INTO docks ( geom, good ) VALUES ('LINESTRING (140 230, 150 250, 210 230)',true);

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (9)

If we are to include this case in our set of “legal” docks, we need to change the relate pattern in our query. In particular, the intersection of the dock interior lake boundary can now be either 1 (our new case) or F (our original case). So we use the “*” catchall in the pattern.

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (10)

And the SQL looks like this:

SELECT docks.*FROM docks JOIN lakes ON ST_Intersects(docks.geom, lakes.geom)WHERE ST_Relate(docks.geom, lakes.geom, '1*F00F212');-- Answer: our (now) three good docks

Confirm that the stricter SQL from the previous example does not return the new dock.

26.1. Data Quality Testing

The TIGER data is carefully quality controlled when it is prepared, so we expect our data to meet strict standards. For example: no census block should overlap any other census block. Can we test for that?

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (11)

Sure!

SELECT a.gid, b.gidFROM nyc_census_blocks a, nyc_census_blocks bWHERE ST_Intersects(a.geom, b.geom) AND ST_Relate(a.geom, b.geom, '2********') AND a.gid != b.gidLIMIT 10;-- Answer: 10, there's some funny business

Similarly, we would expect that the roads data is all end-noded. That is, we expect that intersections only occur at the ends of lines, not at the mid-points.

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (12)

We can test for that by looking for streets that intersect (so we have a join) but where the intersection between the boundaries is not zero-dimensional (that is, the end points don’t touch):

SELECT a.gid, b.gidFROM nyc_streets a, nyc_streets bWHERE ST_Intersects(a.geom, b.geom) AND NOT ST_Relate(a.geom, b.geom, '****0****') AND a.gid != b.gidLIMIT 10;-- Answer: This happens, so the data is not end-noded.

26.1.1. Function List

ST_Relate(geometry A, geometry B): Returns a text string representing the DE9IM relationship between the geometries.

© Copyright 2012-2023, Paul Ramsey | Mark Leslie | PostGIS contributors. 26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (13)

26. Dimensionally Extended 9-Intersection Model — Introduction to PostGIS (2024)

FAQs

What is dimensionally extended nine intersection model? ›

The Dimensionally Extended Nine‐Intersection Model considers the two objects' interiors, boundaries and exteriors and analyzes the intersections of these nine objects parts for their relationships (maximum dimension (−1, 0, 1, or 2) of the intersection geometries with a numeric value of –1 corresponding to no ...

How to start using PostGIS? ›

Connect to your database as the postgres user or another super-user account, and run:
  1. CREATE EXTENSION postgis;
  2. SELECT PostGIS_Full_Version();
  3. SELECT * FROM pg_available_extensions WHERE name = 'postgis';
  4. SELECT postgis_extensions_upgrade(); -- verify you are running latest now SELECT postgis_full_version();

What are the spatial relationships of de 9IM? ›

The spatial relationships described by the DE-9IM are “Equals”, “Disjoint”, “Intersects”, “Touches”, “Crosses”, “Within”, “Contains” and “Overlaps”.

What is the 9th dimension theory? ›

The superstring theory predicts that there are nine dimensions of space. Of these, three are our three-dimensional space, expressed as length, width, and height. The remaining six dimensions are folded and compactified very tightl, and we cannot perceive them directly.

What is the dimensional formula of extension? ›

Dimensional Formula:
Physical quantityUnitDimensional formula
Force (mass x acceleration)newton (N)MLT 2
Force constant or spring constant (force/extension)Nm 1MT 2
Frequency (1/period)HzT 1
Gravitational potential (work/mass)Jkg 1L 2T 2
87 more rows

What is the difference between PostgreSQL and PostGIS? ›

PostGIS extends the capabilities of the PostgreSQL relational database by adding support for storing, indexing, and querying geospatial data. PostGIS features include: Spatial Data Storage: Store different types of spatial data such as points, lines, polygons, and multi-geometries, in both 2D and 3D data.

Why should I use PostGIS? ›

PostGIS utilizes geospatial data analysis by offering advanced tools for operations such as identifying the nearest points or calculating areas within polygons. The functions are optimized through spatial indexing for quicker and better queries of complex geospatial analyses, improving overall performance.

Is PostGIS free? ›

PostGIS is an open source, freely available, and fairly OGC compliant spatial database extender for the PostgreSQL Database Management System.

What are the 4 basic types of spatial relationships? ›

Spatial description, as the name implies, is defining the spatial relations among objects in a certain way. The spatial relations among objects can be described from the position relations, the distance relations, the directional relations, and the topological relations between the objects.

How do you explain spatial relationships? ›

Spatial relationships refer to children's understanding of how objects and people move in relation to each other. In infancy, children use their senses to observe and receive information about objects and people in their environment. They can see and follow people and objects with their eyes.

What is dimensionally transcendental? ›

Dimensional transcendentalism was the state wherein an object's interior was bigger than its exterior, an effect made possible by transdimensional engineering. ( TV: The Robots of Death) It was in opposition to being dimensionally immanent, where something's interior was smaller than its exterior. ( PROSE: Cold Fusion)

What is H in dimensional analysis? ›

Planck's constant would be a basic constant equivalent to the energy of an electromagnetic radiation's quantum split by its own frequency. Planck's constant is denoted by “h”.

Top Articles
Minot Daily News Obituary
Ucsd Lab Locations
Hickory Back Pages
Nycers Pay Schedule
Understanding British Money: What's a Quid? A Shilling?
Drift Boss 911
Muckleshoot Bingo Calendar
What is international trade and explain its types?
NYC Drilled on Variant Response as Vaccine Limits Push State Appointments to Mid-April
organization | QAssurance
Tabdil Tarikh
Real Estate Transfers Erie Pa
Integrations | Information Technology
Circloo Unblocked
8 Casablanca Restaurants You’ll Want to Fly For | Will Fly for Food
The Guardian Crossword Answers - solve the daily Crossword
Monster From Sherpa Folklore Crossword
Jinx Cap 17
Bearpaws Tropical Weather
St Paul Pioneer Obituaries Past 30 Days Of
Zen Leaf New Kensington Menu
Carlitos Caribbean Bar & Grill Photos
Mercedes E-Klasse Rembekrachtigers voorraad | Onderdelenlijn.nl
When Is Moonset Tonight
Myanswers Com Abc Resources
Gmail Psu
Unveiling AnonIB: The Controversial Online Haven for Explicit Images - The Technology For The Next Generation.
Sealy Posturepedic Carver 11 Firm
12 30 Pacific Time
Grave Digger Wynncraft
Hux Lipford Funeral
Anmed My Chart Login
Mission Impossible 7 Showtimes Near Regal Willoughby Commons
Best Truck Lease Deals $0 Down
Juicy Deal D-Art
Rte Packaging Marugame
Craigslist For Port Huron Michigan
Degreeworks Sbu
Tamusso
Dinar Guru Recaps Updates
Minute Clinic Schedule 360
Pre-Order Apple Watch Series 10 – Best Prices in Dubai, UAE
Nailery Open Near Me
'It's huge': Will Louisville's Logan Street be the next Findlay or Pike Place market?
Souvenir Shopping and Local Markets in Belgium
Busted Newspaper Zapata Tx
The most memorable songs from '90s movies
Siswa SMA Rundung Bocah SD di Bekasi, Berawal dari Main Sepak Bola Bersama
R Warhammer Competitive
Make Monday Better: Dive Into These Hilarious Monday Memes!
Diora Thothub
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6333

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.