ThinkGeo.com    |     Documentation    |     Premium Support

Generate New Layer based upon intersect of two vector layers

I am new to thinkgeo. I seen the examples to do a query for an intersect of a selection with a layer, but is it possible to choose two or more layers and then generate a physically separate layer that is the intersect of these layers?

Steve

Hey @Steve_Paplanus,

Welcome to ThinkGeo! Good to hear that the HowDoI samples are helping you get familiar with things.

What you are asking is indeed possible. I created a project that demonstrates this for you:

CreateLayerFromIntersect.zip (793.1 KB)

The project loads two shapefiles, countries(shown in white) and disputed areas(shown in red). In order to find the intersect of both layers, we need to combine all the features from one layer (in this case, the disputed areas layer) into a single shape using a Union operation. From there, we can easily determine which countries have disputed areas using the intersect query on the countries layer. We can then take those features from the intersect query and create a completely new shapefile. The demo then finally adds the newly created shapefile to the map in green. Below is a screenshot of the result:

NOTE:
The created shapefile will be placed in a data folder in the bin directory

Let me know if you have any more questions!

Thanks,
Kyle