Thu, Apr 15 2004
19:48:47
|
|
Request created by guest
|
|
Subject: v.in.ogr -spatial /postgis
Platform: GNU/Linux/i386
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: G57_CVS checkout_20040415
Dear developers,
v.in.ogr ignores the -spatial-switch when importing maps from PostGIS.
It always pulls out the whole dataset.
It works with shape-files as espected.
just to keep an eye on it... already briefly discussed with Markus Neteler.
Stephan Holl |
|
Sat, Jul 23 2005
12:51:31
|
|
Mail sent by msieczka
|
|
Hi Stephen
Does this bug still apply in 6.0 or 6.1?
Maciek
Please "reply to all" so I receive a copy directly. |
|
Mon, Jul 25 2005
08:43:28
|
|
Mail sent by sholl
|
|
Hi Maciek,
yes, the bug is still active. It always pulls out the whole dataset and the
spatial-switch is ignored.
best
stephan
|
|
Tue, Jul 26 2005
08:36:08
|
|
Area changed to grass6.1 by msieczka
|
|
Wed, Jul 27 2005
14:19:16
|
|
Mail sent by mneteler
|
|
Hi,
works for me with SHAPE file:
v.out.ogr roads olayer=roads dsn=roads.shp
Exporting 825 points/lines...
100%
825 features written
WARNING: 6 features without category written
v.in.ogr roads.shp out=roads_subregion spatial=598200,4924320,602280,4926240
A datum name nad27 (North_American_Datum_1927) was specified without
transformation parameters.
WARNING: Non-interactive mode: the GRASS default for nad27 is
towgs84=-22.000,157.000,176.000.
Projection of input dataset and current location appear to match.
Proceeding with import...
Layer: roads
WARNING: Column name changed: 'cat' -> 'cat_'
-----------------------------------------------------
Building topology ...
40 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 35
Number of primitives: 40
Number of points : 0
Number of lines : 40
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
g.region -dp
d.erase
d.vect roads
d.vect roads_subregion col=red
#-> result ok, only subset.
####################################
PostGIS:
I cannot test, because
v.external dsn="PG:host=myserver user=postgres dbname=spearfish"
layer=streams output=streams_pg
ERROR 1: ERROR: Attribute "fid" not found
DBMI-OGR driver error:
Cannot select:
select FID from streams where FID = -1
Building topology ...
WARNING: Random read is not supported by OGR for this layer, cannot build
support.
Which trick do you use?
Markus
|
|
Wed, Jul 27 2005
14:58:11
|
|
Comments added by sholl
|
|
mneteler wrote (Wed, Jul 27 2005 14:19:16):
> Hi,
>
> works for me with SHAPE file:
>
> v.out.ogr roads olayer=roads dsn=roads.shp
[works with shape]
>
> #-> result ok, only subset.
>
> ####################################
> PostGIS:
>
> I cannot test, because
>
> v.external dsn="PG:host=myserver user=postgres dbname=spearfish"
> layer=streams output=streams_pg
> ERROR 1: ERROR: Attribute "fid" not found
>
> DBMI-OGR driver error:
> Cannot select:
> select FID from streams where FID = -1
>
> Building topology ...
> WARNING: Random read is not supported by OGR for this layer, cannot build
> support.
>
>
> Which trick do you use?
shouldn`t you use v.[in|out].ogr for postgis-layers to import only a subset?
spearfish:
v.in.ogr -o dsn="PG:dbname=postgis user=holl" layer=soils out=soils_bla
spatial="601320, 4921830, 594930, 4927230"
[...]
737 Eingabepolygone
total area: 2.762475e+08 (737 areas)
overlapping area: 0.000000e+00 (0 areas)
area without category: 0.000000e+00 (0 areas)
GRASS 6.1.cvs (spearfish57):~/cvs/qgis_HEAD >
... which means, it is the whole soils-dataset
Using v.extrenal works with some error, and no database-connection because of
the fid-column-error.
GRASS 6.1.cvs (spearfish57):~/cvs/qgis_HEAD > v.external
dsn="PG:dbname=postgis user=holl" layer=soils out=soils_external
ERROR 1: ERROR: column "fid" does not exist
DBMI-OGR driver error:
Cannot select:
select FID from soils where FID = -1
Erzeuge Topologie ...
Feature: 737700
Die Topologie wurde erstellt.
Anzahl von Knoten : 1389
Anzahl von Primitives : 1515
Anzahl von Punkten : 0
Anzahl von Linien : 0
Anzahl von Boundaries : 778
Anzahl von Zentroiden : 737
Anzahl von Flächen : 778
Anzahl von Inseln : 778
Anzahl von Flächen ohne Zentroid : 41
GRASS 6.1.cvs (spearfish57):~/cvs/qgis_HEAD >
Does this help?
Stephan
|
|
Wed, Jul 27 2005
15:30:29
|
|
Comments added by sholl
|
|
mneteler wrote (Wed, Jul 27 2005 14:19:16):
> Hi,
>
> works for me with SHAPE file:
>
> v.out.ogr roads olayer=roads dsn=roads.shp
[works with shape]
>
> #-> result ok, only subset.
>
> ####################################
> PostGIS:
>
> I cannot test, because
>
> v.external dsn="PG:host=myserver user=postgres dbname=spearfish"
> layer=streams output=streams_pg
> ERROR 1: ERROR: Attribute "fid" not found
>
> DBMI-OGR driver error:
> Cannot select:
> select FID from streams where FID = -1
>
> Building topology ...
> WARNING: Random read is not supported by OGR for this layer, cannot build
> support.
>
>
> Which trick do you use?
shouldn`t you use v.[in|out].ogr for postgis-layers to import only a subset?
spearfish:
v.in.ogr -o dsn="PG:dbname=postgis user=holl" layer=soils out=soils_bla
spatial="601320, 4921830, 594930, 4927230"
[...]
737 Eingabepolygone
total area: 2.762475e+08 (737 areas)
overlapping area: 0.000000e+00 (0 areas)
area without category: 0.000000e+00 (0 areas)
GRASS 6.1.cvs (spearfish57):~/cvs/qgis_HEAD >
... which means, it is the whole soils-dataset
Using v.extrenal works with some error, and no database-connection because of
the fid-column-error.
GRASS 6.1.cvs (spearfish57):~/cvs/qgis_HEAD > v.external
dsn="PG:dbname=postgis user=holl" layer=soils out=soils_external
ERROR 1: ERROR: column "fid" does not exist
DBMI-OGR driver error:
Cannot select:
select FID from soils where FID = -1
Erzeuge Topologie ...
Feature: 737700
Die Topologie wurde erstellt.
Anzahl von Knoten : 1389
Anzahl von Primitives : 1515
Anzahl von Punkten : 0
Anzahl von Linien : 0
Anzahl von Boundaries : 778
Anzahl von Zentroiden : 737
Anzahl von Flächen : 778
Anzahl von Inseln : 778
Anzahl von Flächen ohne Zentroid : 41
GRASS 6.1.cvs (spearfish57):~/cvs/qgis_HEAD >
Does this help?
Stephan
|
|
Mon, Aug 1 2005
19:05:20
|
|
Mail sent by mneteler
|
|
Hi Stephan,
- v.external: I have a local patch to overcome the FID/ogc_fid
problem. Awaits comment from Radim
- v.in.ogr: sure, I should have used that. Currently it doesn't
work at all for me after updating to current OGR...
More soon
Markus |
|
Thu, Aug 11 2005
23:03:21
|
|
Mail sent by mneteler
|
|
hi Stephan
[unrelated, but mentioned here]
> - v.external: I have a local patch to overcome the FID/ogc_fid
> problem. Awaits comment from Radim
Fixed in 6.1-CVS.
Markus |
|
Thu, Aug 11 2005
23:07:47
|
|
Mail sent by mneteler
|
|
Stephan,
(cc'ing Frank and Radim)
the problem: which v.in.ogr supports well spatial constraints for SHAPE
files, it doesn't for PostGIS. The "spatial" settings are ignored
when importing a map from PostGIS.
> - v.in.ogr: Currently it doesn't
> work at all for me after updating to current OGR...
Now OGR is fixed for the various PostGIS versions (8/2005).
I made the following tests within Spearfish60:
ogr2ogr out.shp PG:'host=grass.itc.it user=postgres dbname=spearfish' streams_pg
ogrinfo -summary out.shp out | grep Feature
Feature Count: 116
# -> full map. ok.
ogr2ogr -spat 598800 4920510 604170 4924710 out_spat.shp PG:'host=grass.itc.it
user=postgres dbname=spearfish' streams_pg
ogrinfo -summary out_spat.shp out_spat | grep Feature
Feature Count: 26
# -> partial map. ok.
This indicates that the OGR-PG driver supports it.
GRASS 6.1-CVS test:
v.in.ogr dsn="PG:host=grass.itc.it user=postgres
dbname=spearfish"layer=streams_pg output=streams_pg
...
Topology was built.
Number of nodes : 136
Number of primitives: 116
Number of points : 0
Number of lines : 116
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
#-> full map imported from PG into GRASS. ok.
v.in.ogr dsn="PG:host=grass.itc.it user=postgres
dbname=spearfish"layer=streams_pg output=streams_pg_spatial
spatial=598800,4920510,604170,4924710
...
Number of nodes : 136
Number of primitives: 116
Number of points : 0
Number of lines : 116
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
#-> also full map imported from PG into GRASS. Failure as partial map should
be imported
I can confirm the bug for v.in.ogr/PG. However, for SHAPE import it works.
Very strange.
The bug in main.c of v.in.ogr *may* be that we do
poSpatialFilter = OGR_G_CreateGeometry( wkbPolygon );
Ogr_oRing = OGR_G_CreateGeometry( wkbLinearRing );
But see:
http://lists.maptools.org/pipermail/gdal-dev/2004-March/002265.html
and
http://lists.maptools.org/pipermail/gdal-dev/2004-March/002324.html
"You have to make sure the SRID reference from the layer table is present in
the spatial_ref_sys table. Otherwise it seems that OGR is unable to apply the
spatial filter."
and
http://lists.maptools.org/pipermail/gdal-dev/2004-March/002327.html
Maybe it has to do with BOX3D?
http://www.gdal.org/ogr/drv_pg.html
"DIM={2,3}: Control the dimension of the layer. Defaults to 3. Important to
set to 2 for 2D layers with PostGIS 1.0+ as it has constraints on the geometry
dimension during loading."
Sorry, but I am clueless.
Markus |
|
Wed, Aug 31 2005
20:47:17
|
|
Area changed to grass6 by mneteler
|
|
Thu, Aug 3 2006
15:56:52
|
|
Mail sent by sholl
|
|
Hi all,
tested with spearfish roads and they were cut based on the spatial extent as
expected now using current GRASS 6.1 CVS HEAD.
BTW this is tested against postgis 1.1.2/postgres8.1.4 and the original post
was against postgis 0.9/postgres7.4
I consider this bug as fixed, if someone could verify this please.
Best
Stephan
|
|
Thu, Aug 3 2006
17:06:41
|
|
Mail sent by msieczka
|
|
sholl wrote (Thu, Aug 3 2006 15:56:52):
> I consider this bug as fixed, if someone could verify this please.
So you are not sure? What's causing that? (sorry, I'm a postgis ignorant).
Maciek
|
|
Thu, Aug 3 2006
20:13:22
|
|
Status changed to resolved by sholl
|
|
Thu, Aug 3 2006
20:15:18
|
|
Mail sent by sholl
|
|
works with polygon-data as well, also with postgis 0.9/postgres7.4
marked as resolved
Best
Stephan |
|