Frando Alexis,

when using ogr2ogr, there are 3 components involved:

- the driver that reads the input file

- the driver that writes the output file

- the ogr2ogr specific logic

So when analyzing an issue, it is important to try to localize where it is.

Here the issue comes from the input driver, as you can easily see when running "ogrinfo your.xtf" (I had to slightly edit the one you pasted since it was invalid XML)

$ ogrinfo test.xtf -al
INFO: Open of `test.xtf'
      using driver `Interlis 2' successful.

Layer name: testModel.table
Geometry: Unknown (any)
Feature Count: 1
Layer SRS WKT:
(unknown)
TID: String (0.0)
name: String (0.0)
OGRFeature(testModel.table):1
  TID (String) = 234921
  name (String) = angela

So the issue lies in the Interlis 2 driver. I've not dug further to know if the Interlis 2 format is supposed to deal with repeated XML element names.

Even


Le 11/06/2022 à 04:11, Gonzalez Velasquez, Frando Alexis a écrit :

Hi dev team!

I am writing to inquire about conversion to geojson problem, I will show you in a little and simple example that shows my big problem:

We are using the ogr2ogr executables commands like this :

*/ogr2ogr -f GeoJSON C:\tmp\nombres.json C:\tmp\TUNJA1R_ejemplo.xtf testModel.table/*

As you can see, The input file is “TUNJA1R_ejemplo.xtf” a simple array of names in xml example, but with the same name of key :

“<?xml version="1.0" encoding="UTF-8"?><TRANSFER xmlns=http://www.interlis.ch/INTERLIS2.3>

<HEADERSECTION SENDER="ili2ora-4.4.3-658b7daf37ba45ed2330ca3e3a3c3d59c96e91fa" VERSION="2.3"><MODELS>

<MODEL NAME="testModel" VERSION="2022-06-10" URI=mailto:PC4@localhost <mailto:PC4@localhost>></MODEL></MODELS></HEADERSECTION>

<DATASECTION>

<testModel BID="testModel">

<testModel.table TID="234921">

<name>pepe</name>

< name >maria</ name >

< name >juana</name >

<nestedfield>

< name >julia</ name > //also try a nested field, wioth results….

</nestedfield>

< name >mario</ name >

< name >luz</ name >

< name >*angela*</ name >

                </testModel.table>

</Submodelo_Insumos_SNR_V1_0.Datos_SNR>

</DATASECTION>

</TRANSFER>”

After execution, the output file  “ nombres.json ”of conversion always leaves only the last key value :

{

"type": "FeatureCollection",

"name": "testModel.table",

"features": [

{ "type": "Feature", "properties": { "TID": "234921", " name ": "*angela*" }, "geometry": null }

]

}

*Is there any strategy to handle this problem like an extra command or option (-option) on the command line to get in the output file with all the names even the input file has the same key name ?*because, i saw that ogr2ogr always update the same key with the last value, and we need */all the seven names/* array in the output json file on the same registry.

Finally, I have come to think that I should modify the ogr2ogr code to better handle this and not always leave the last value in the conversion, but I hope it is the last option that I should take.

Any advice would be really appreciated, thanks!!!

minsait-indra

FRANDO GONZÁLEZ

Senior Systems Engineer

[email protected] <mailto:[email protected]>

Calle 93 16 25

Bogotá, Colombia

T +57 1 646 36 00

M +57 3006604908

minsait.com <https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.minsait.com%2F&data=04%7C01%7Cfagonzalezv%40indracompany.com%7C6c419c97a7134841c0da08d9f7ce4282%7C7808e00514894374954bd3b08f193920%7C0%7C0%7C637813287514711623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=0Jr%2BkI3f3Uh3g%2FG5C5yElQX9pHauhEi9ds6w%2FPOxLtM%3D&reserved=0>

indracompany.com <https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.indracompany.com%2F&data=04%7C01%7Cfagonzalezv%40indracompany.com%7C6c419c97a7134841c0da08d9f7ce4282%7C7808e00514894374954bd3b08f193920%7C0%7C0%7C637813287514711623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=W2xsw4RMlZ8TUymKMTE5zqosvKN2LV5QhwvGmAxgZM0%3D&reserved=0>


------------------------------------------------------------------------

Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Si no es vd. el destinatario indicado, queda notificado que la lectura, utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.
Evite imprimir este mensaje si no es estrictamente necesario.

This email and any file attached to it (when applicable) contain(s) confidential information that is exclusively addressed to its recipient(s). If you are not the indicated recipient, you are informed that reading, using, disseminating and/or copying it without authorisation is forbidden in accordance with the legislation in effect. If you have received this email by mistake, please immediately notify the sender of the situation by resending it to their email address.
Avoid printing this message if it is not absolutely necessary.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to