I have a two shapefiles, one is a DMA level and one of US states level.

How do I create a shapefile containing DMA of a certain state, for instance, Texas from a larger shapefile.

I tried running this query, but with no success.

SELECT geom FROM usdma
WHERE ST_Overlaps(usdma.geom, usstates.geom)
WHERE usstates.name = 'TX';
    ST_Overlaps(usdma.geom, usstates.geom) AND
    usstates.name = 'TX';

I'd rather go for ST_Intersects or ST_Within though.

  • Thanks! Can you explain the difference between ST_Within and ST_Intersects? My understand is that those two are used to count points, but I may be misunderstanding the functions? – Minh Mai Jul 28 '15 at 18:03
  • 2
    Please see the docs :-) – Michal Zimmermann Jul 28 '15 at 18:36
  • @MinhMai you can also see "spatial predicates" for the DE-9IM to understand the language – Mike T Jul 28 '15 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.