[GRASS5] v.in.ogr with spatial

Markus Neteler neteler at itc.it
Thu May 13 06:04:30 EDT 2004


On Thu, May 13, 2004 at 02:00:04PM +1200, Hamish wrote:
> On Mon, 22 Mar 2004 16:31:36 +0100
> Markus Neteler <neteler at itc.it> wrote:
> 
> > the spatial filter in v.in.ogr is fixed in CVS.
> >
> > > Stephan wrote:
> > > I am trying to import some vector-datasets into GRASS via v.in.ogr.
> > > The spatial switch does not work as expected, I guess.
> 
> 
> This still doesn't work for me:
> 
> v.in.ogr dsn=. layer=rivers output=rivers \
>   spatial=1084000,4847000,1224000,5092000
> 
> 
> It imports everything.

" Works for me ..."

Here an example: (using the Spearfish5.7 database)

[If using Spearfish 5.0/5.3: 
  v.convert soils out=soils ]

g.region -dp
v.out.ogr in=soils dsn=soils.shp lay=soils typ=area
d.zoom
g.region -g
v.in.ogr dsn=soils.shp out=soils_cut spatial=598260,4920600,601920,4923300
d.erase
d.vect soils_cut
d.zoom
#unzoom
-> result is correct.

Note: Maybe you have a problem with the OGR behaviour to cut/intersect.
All vector features which fall within the spatial subset region, are
imported *completely*. Above example demonstrates it.

Solution:
 g.region n=yyy s=yyy2 w=xxx e=xxx2 -p
 v.in.region out=cutter
 v.overlay ....

So this is not a problem of v.in.ogr but of the way how OGR handles it.

Markus




More information about the grass-dev mailing list