I have two shapefiles: One point file (occ_master) and 1 polygon file (geol_1m). The point file represents mineral occurrences. The polygon file represents geology, which can be subcategorized by field lith_name, as displayed in the image. I need to find a way to determine how many mineral occurrences (points) occur in each lith_name. This query will allow me to figure out which geological unit has the most mineral occurrences.

I know it will involve a ST_Contains and GROUP BY query but it is my first day on PostGIS and so I am rather inexperienced.

enter image description here

  • 1
    So, do you have shapefiles (file-based geodata format from last century) or database tables (in PostgreSQL using PostGIS geometry)? When loaded into the database, shapefiles become "tables" not "files". If you have tables, we ask that you make an attempt at the SQL (note that ST_Contains will not handle boundary conditions, so you might get a lower total than the actual number of points). – Vince Feb 19 at 14:24
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works – Ian Turton Feb 19 at 17:31

Your Answer

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

Browse other questions tagged or ask your own question.