gvSIG bugs #4196

shapefiles with dbf containing duplicated fields doesn't load

Added by Andrea Antonello about 8 years ago. Updated almost 8 years ago.

Status:Closed% Done:

0%

Priority:NormalSpent time:-
Assignee:Francisco Díaz Carsí
Category:Application
Target version:2.3.0-2430 (rev. org.gvsig.desktop-2.0.136, NOT USABLE)
Severity:Minor Add-on version:
gvSIG version:2.3.0 Add-on build:
gvSIG build: Add-on resolve version:
Operative System: Add-on resolve build:
Keywords: Proyecto:
Has patch: Hito:
Add-on name:Unknown

Description

This can happen when data are coming from a wfs.
I attach an example of shapefile coming from the open data of the city of Vienna.

In gvSIG, if you try to load the layer, nothing happens. The log instead tells about the double field problem.

It would be good to:

  • have the layer loaded anyways (in uDig we used to append a number at the end of the name to make them different)
  • or at least let the user know through a dialog what the problem is, so he can act accordingly

double_field_dbf.zip (5.34 KB) Andrea Antonello, 04/14/2016 11:41 AM

Associated revisions

Revision 42814
Added by Francisco Díaz Carsí almost 8 years ago

refs #4196 Allow load SHP and DBF files with duplicated field names through a new parameter.

History

#1 Updated by Antonio Falciano about 8 years ago

Hi Andrea,
this is a known issue (#2164) that may affect also some geoprocesses (e.g. #2851, #3117, #3118). It's tedious and time consuming when working with nested geoprocesses that create usually an ID field. There's also a feature request about it (#2976).
I'm agree about your suggestions. IMHO the best solution is to use the GDAL/OGR field name truncation method, yet implemented in the "Export to" tool (#2681).

#2 Updated by Andrea Antonello about 8 years ago

Thanks for the reference to the issue!

I see that it is marked as won't fix. It is even ok for me if this is not fixed as such, but I think the least that should be available to the user is a way to know what the problem is and a way to solve it.
Where solving it can also be to manually remove/rename columns in a geoprocess.

#3 Updated by Antonio Falciano about 8 years ago

Andrea Antonello wrote:

Where solving it can also be to manually remove/rename columns in a geoprocess.

This is the actual (time-consuming) workaround used by power users who know exactly where the problem is. For other ones the geoprocesses will seem to be broken. Furthermore if you nest geoprocesses in a model you have to apply the "Rename field" one each time a potential duplicated field is generated!

I'd leave also all the "ID" fields in the geoprocesses classes because it's a good practise to have a shape with one field at least. So the only way to exit from this bottleneck is to truncate the field name when loading, nothing else.

#4 Updated by Álvaro Anguix almost 8 years ago

  • Assignee set to Francisco Díaz Carsí

#5 Updated by Francisco Díaz Carsí almost 8 years ago

  • Status changed from New to Fixed

Esta es la manera en la que lo hemos arreglado.

Cuando se intente cargar un SHP con nombres duplicados en las columnas, mostrará un mensaje de error advirtiendo del hecho al usuario e informándole de que puede habilitar un check nuevo que hemos puesto en la pestaña "Advanced" de las propiedades en el cuadro de diálogo de carga de capas.
Si se selecciona esta opción, los campos se renombrarán con un sufijo numérico recortándolos a al tamaño máximo que admite el DBF y la capa pasará a ser de solo lectura para preservar los datos que tenga originalmente el archivo.
Así, si la capa se pone en edición, cuando termine edición, la aplicación avisará al usuario de que la capa no se puede escribir y le propondrá exportarla (este es el procedimiento habitual cuando una capa está marcada como de solo lectura).

Nota:
También hemos puesto la capa como solo lectura cuando se marcan las otras opciones que implican una modificación de los datos de entrada:
  • load corrupt geometries as null
  • allow inconsistencies in goemetry type
  • fix linear ring

#6 Updated by Antonio Falciano almost 8 years ago

  • Target version set to 2.3.0-2430 (rev. org.gvsig.desktop-2.0.136, NOT USABLE)
  • Status changed from Fixed to Closed

Activating the "Allow duplicated field names" checkbox in the Advanced parameters (and also deleting the prj and declaring the CRS manually), it works. Thank you very much, Francisco.
But unfortunately the same issue in geoprocesses still remains.

Also available in: Atom PDF