[GRASS-user] How to find all vectors that overlay a given region

Patton, Eric epatton at nrcan.gc.ca
Wed Sep 19 09:39:11 EDT 2007


Michael Barton wrote:

>> Running v.info will give you the extents of a vector file. You can parse
>> this and compare the extents to the region extents to see if they overlap.
>> 
>> You could also use the approach I gave for finding the intersection of 2
>> raster maps.
>> 
>> parse g.region -ugp vect=vector1
>> parse g.region -ugp vect=vector2
>> 
>> compare the extents of the regions defined by the vectors with extents of
>> the current region 
>> 
>> parse g.region -ugp

>beware the case where the bounding boxes overlap but the vector features within
>do not. 

>Hamish

I'm using the approach that Hamish suggested; I have the script almost finished
and I just have to debug it now. Any vector map region extents that overlap the
Grass region extent get their names populated in a list of candidates which each
get further checked for overlapping geometry with v.select. If a vector has
geometry which passes this check, its name gets printed to the terminal.

This same approach could be used for answering the question "Find me all the
raster data sets that falls within the current region, with some modification.

Frequently I have several hundred vector maps representing ship naivgation
tracklines from multiple surveys and I need to know when the vessel was in a
certain region of interest, hence the need for this kind of script.

Thanks for the feedback,

--
Eric Patton
Technologist
Geological Survey of Canada (Atlantic)
Bedford Institute of Oceanography
Dartmouth, Nova Scotia, Canada
902.426.7732
epatton at nrcan.gc.ca
     




More information about the grass-user mailing list