Spatial intersections


Hi, I’m looking to build a system that requires the intersection of arbitrary polygons with points (possibly other geometry types down the line). What is the recommended way to do this?




You may have to share a little more detail about what you are trying to do.

This forum post may address your question?

We are currently adding more geo function into the product so your usecase and high priority ‘wants’ would be helpful to us to identify where best to focus our energies first.



Thanks for the quick response! I saw that one, but as mentioned it is a rather large and complex query so I was hoping to find something automated or at least a little easier to understand before diving in and doing it myself. The core of what I’d like to do is:

  1. Create a table with latitude/longitude points tied to an ID
  2. Run a query that filters down to rows that are within a dynamically defined polygon
  3. Join the selected rows with other tables.

In PostGIS this is st_intersects(). Should also mention that the polygons are small enough that projection doesn’t matter.



Yeah, its not pretty but that is what that big ugly query does.

I suspect we will be wrapping that ear-clipping query generation as one of the first items we add. Keep an eye on the release notes of up coming releases to see when it lands.

For now, If you use the mapd charting, you get a selection tool which takes care of the big complex query so you might want to take a look at that. See:



I’ll take a look. Thanks!


FYI, this area is in active development - support for geometry types and operators. To the extent that you can share use case info such as respective cardinalities for combination of geometries input to st_contains/intersects this would be useful.


Hi Bill, when are these features currently expected to be released?

As for our particular needs - any way I can reach you privately to discuss more?


So, query like this?
SELECT t1.resultcol
FROM t1 JOIN t2 ON =
WHERE ST_CONTAINS(t1.pointcol, ‘POLYGON( 2 0, 2 2, 0 2, 2 0)’)
I’m guessing here that t1 is a large fact table, and by “dynamic” polygon you mean the sort of thing you’d create with a selection tool rather than a spatial join another table. If so, that’s the example5 above, and MapD is quite fast for even large numbers of points. Server side also should satisfy this and also the join cases. Oh, and I think contains is same as intersects for point+poly.


Bill, you’ve got it. I imagine MapD could blow nearly any other GIS database out of the water with a full suite of geometric and topological operations. Looking forward to seeing it in action!


Is there any more update on support for geometry types and operators. I have a potential use case using 5 to 100’s of millions features for a national cadastre time series analysis that could really benefit from multidimensional queries on polygons using near real time table scans!


Hi, I couldn’t tell from the conversation, @billmaimone, @dwayneberry, is this query currently supported or not?

SELECT t1.resultcol
FROM t1 JOIN t2 ON =
WHERE ST_CONTAINS(t1.pointcol, ‘POLYGON( 2 0, 2 2, 0 2, 2 0)’)

Because the github ticket seems to be still open:

If not currently supported, is there any expected date here? Thanks!


hi @dfernan, we’re working on a comprehensive geo roadmap across multiple releases this year, which covers the usual gamut of spatial operators and types including those you’ve listed here. we’ll reaching out to our interested community members when we get closer, so please stay tuned!

Assign lat/lon records to cells on a custom grid

Hi @niviksha this is great news and can’t wait for this features to be released, they will truly be a game changer for the capabilities of MapD when processing spatial data. Please keep us posted, thanks again!