Bug report #2733
fTools Add geometry column fails to add XCOORD if source is GPX file or PostGIS Layer
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | - | ||
Category: | Processing/QGIS | ||
Affected QGIS version: | master | Regression?: | |
Operating System: | Easy fix?: | ||
Pull Request or Patch supplied: | Yes | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 12793 |
Description
Plugins -> GPS -> GPS tools -> load waypoint GPX file -> fTools -> Geometry tools -> Export/add geometry column -> Choose GPX waypoint layer -> Choose any output name -> OK -> Open attribute table: only YCOORD is present, XCOORD is missing.
Saving GPX as shapefile and then running fTools add geometry column works just fine for WGS84 and projected files.
QGIS 1.4.0 and trunk r13529
fTools 0.5.10
Associated revisions
History
#1 Updated by Giovanni Manghi over 14 years ago
Hi,
I noticed that if you open the GPX file trough the standard "add vector" interface things are pretty different: the attribute table is different and the "Export/add geometry column" works fine. So it should not be a ftools problem after all, but a problem of QGIS GPS tools toolbox.
#2 Updated by Giovanni Manghi over 14 years ago
this should not be a ftools problem. Please leave further feedback and change the summary if you confirm my observations.
#3 Updated by Horst Düster almost 14 years ago
I found the same behaviour with PostGIS layers as well. The bug depends on the position of the geometry column in the column-list.
With the following POINT table-definition, geometry column at the beginning of the columns list:
CREATE TABLE test1 ( id serial NOT NULL, wkb_geometry geometry, feld1 text, feld2 text, feld3 integer, CONSTRAINT test1_pkey PRIMARY KEY (id) )
only the YCOORD column will be exported.
With the following POINT table-definition, with geometry at the end of the columns list:
CREATE TABLE test1 ( id serial NOT NULL, feld1 text, feld2 text, feld3 integer, wkb_geometry geometry CONSTRAINT test1_pkey PRIMARY KEY (id) )
all columns XCOORD and YCOORD will be exported fine.
#4 Updated by Giovanni Manghi about 13 years ago
- Pull Request or Patch supplied set to No
- Status changed from Open to Feedback
- Target version deleted (
Version 1.7.0)
Horst Düster wrote:
I found the same behaviour with PostGIS layers as well. The bug depends on the position of the geometry column in the column-list.
With the following POINT table-definition, geometry column at the beginning of the columns list:
[...]
only the YCOORD column will be exported.
With the following POINT table-definition, with geometry at the end of the columns list:
[...]
all columns XCOORD and YCOORD will be exported fine.
Hi, I just tested with a PostGIS point table like
CREATE TABLE topo_c
(
gid serial NOT NULL,
"DESIGNACAO" character varying(28),
"CODNUTS" character varying(12),
"DTCC" integer,
"DT" integer,
"DISTRITO" character varying(25),
"AGRUPC" character varying(25),
"NUTSII" character varying(4),
"NUSTIII" character varying(5),
"REGIAO" character varying(30),
"INC" integer,
"POP" integer,
pop10 integer,
the_geom geometry
)
and it worked fine (with both ftools and the field calculator). I'm using qgis-trunk under Ubuntu. Please check again and leave feedback.
#5 Updated by Giovanni Manghi about 13 years ago
- Operating System deleted (
All) - Must fix deleted (
Yes)
Horst Düster wrote:
I found the same behaviour with PostGIS layers as well. The bug depends on the position of the geometry column in the column-list.
With the following POINT table-definition, geometry column at the beginning of the columns list:
[...]
only the YCOORD column will be exported.
With the following POINT table-definition, with geometry at the end of the columns list:
[...]
all columns XCOORD and YCOORD will be exported fine.
You are right, if the geometry column is not at the end of the table, then FTOOLS just compute the YCOORD field. On the other hand computing the coordinates with the field calculator works ok. So after all it may be very well a Ftools issue (or not, maybe is a GEOS one. Carson, can you leave feedback?).
I'll remove the "must fix: yes" because we can use the field calculator instead as workaround.
#6 Updated by Giovanni Manghi almost 13 years ago
- Target version set to Version 1.7.4
#7 Updated by Paolo Cavallini over 12 years ago
- Affected QGIS version set to master
- Crashes QGIS or corrupts data set to No
- Target version changed from Version 1.7.4 to Version 1.8.0
#8 Updated by Salvatore Larosa over 12 years ago
- Assignee deleted (
cfarmer -) - Status info deleted (
0)
Anyone can confirms?
In my case with sample data of the comment n.3, both columns (XCOORD and YCOORD) are not esported!
#9 Updated by Giovanni Manghi over 12 years ago
Salvatore Larosa wrote:
Anyone can confirms?
In my case with sample data of the comment n.3, both columns (XCOORD and YCOORD) are not esported!
I still can confirm the behaviour described in #2733-3. now I will test with gpx files.
#10 Updated by Giovanni Manghi over 12 years ago
Salvatore Larosa wrote:
Anyone can confirms?
In my case with sample data of the comment n.3, both columns (XCOORD and YCOORD) are not esported!
and I confirm also the behaviour described in the original ticket description and #2733-1
#11 Updated by Salvatore Larosa over 12 years ago
Right now, the problems are two:
ext/add geometry tool does not work:
1) with data from database (not sure for Spatialite)
2) if the position of the field geometry is intermediate to the other, not at the end of the list.
In fact, dataProvider().fields().keys() returns [0, 2, 3] if the table is defined as follows:
CREATE TABLE test ( id serial NOT NULL < ----------------- 0 geom geometry <----------------------- 1 name text <--------------------------- 2 descr text <-------------------------- 3 CONSTRAINT test_pkey PRIMARY KEY (id) )
skipping a key, geom one!
well, I succeeded in solving this and I'll do a pull request after doing some more tests!
XCOORD and YCOORD work fine, I still have to test for linear and polygonal geometries!
Can anyone send me a GPX data to test it?
"... I forgot a thing very curious ....
extract/add geometry tool works even if the attribute table is open! (ref. #5335)"
#12 Updated by Giovanni Manghi over 12 years ago
1) with data from database (not sure for Spatialite)
it works
#13 Updated by Giovanni Manghi over 12 years ago
- File wpt.gpx added
Can anyone send me a GPX data to test it?
attached
#14 Updated by Salvatore Larosa over 12 years ago
- Pull Request or Patch supplied changed from No to Yes
Thanks Giovanni!
here the patch
#15 Updated by Alexander Bruy over 12 years ago
- Status changed from Feedback to Closed
Fixed in changeset f97b043e701cc466e35b2feddf02b791c26f67fe.
#16 Updated by Giovanni Manghi over 7 years ago
The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.