[gdal-dev] Ogr2ogr conversion to geojson problem..... any suggestion?

Gonzalez Velasquez, Frando Alexis fagonzalezv at indracompany.com
Fri Jun 10 19:11:09 PDT 2022


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 at 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
fagonzalezv at indracompany.com<mailto:fagonzalezv at indracompany.com>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220611/6a53170a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1476 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220611/6a53170a/attachment-0001.png>


More information about the gdal-dev mailing list