Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shapefile which defines for me the area of each oil field in the North Sea (~300 fields). I also have a shapefile which defines the location of every well that has been drilled (~13000) wells. I am looking for a way to associate the wells to the fields.

I have managed to do this for a single field by splitting the oil fields shapefile into a shapefile for each oil field, then taking the intersection with the wells shapefile, and copy-pasting the attributes table out. It will take me a very long time to do this for 300 fields!

Is there a better way?


share|improve this question
Do you need well info in the field layer or field info in the well layer? – underdark Jan 14 '13 at 20:27

I like to use Spatialite's virtual tables for tasks like this. Here's a guide on how to set them up:

Once you make virtual tables you can run any spatial sql query you want on them. You'd end up with something like:

UPDATE wells SET oil_field_name = (SELECT 
FROM wells, fields WHERE ST_Intersects(fields.geometry, wells.geometry)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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