<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Frando Alexis,</p>
<p>when using ogr2ogr, there are 3 components involved:</p>
<p>- the driver that reads the input file</p>
<p>- the driver that writes the output file</p>
<p>- the ogr2ogr specific logic<br>
</p>
<p>So when analyzing an issue, it is important to try to localize
where it is.</p>
<p>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)</p>
<p>$ ogrinfo test.xtf -al<br>
INFO: Open of `test.xtf'<br>
using driver `Interlis 2' successful.<br>
<br>
Layer name: testModel.table<br>
Geometry: Unknown (any)<br>
Feature Count: 1<br>
Layer SRS WKT:<br>
(unknown)<br>
TID: String (0.0)<br>
name: String (0.0)<br>
OGRFeature(testModel.table):1<br>
TID (String) = 234921<br>
name (String) = angela<br>
</p>
<p>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.</p>
<p>Even<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Le 11/06/2022 à 04:11, Gonzalez
Velasquez, Frando Alexis a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:GV1P193MB2071BDA7B9DCF0A74C39847ADDA99@GV1P193MB2071.EURP193.PROD.OUTLOOK.COM">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi dev team!</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">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:
</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">We are using the ogr2ogr
executables commands like this :</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><b><i><span lang="EN-US">ogr2ogr -f GeoJSON
C:\tmp\nombres.json C:\tmp\TUNJA1R_ejemplo.xtf
testModel.table</span></i></b></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">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 :</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">“<?xml version="1.0"
encoding="UTF-8"?><TRANSFER xmlns=<a
href="http://www.interlis.ch/INTERLIS2.3"
moz-do-not-send="true" class="moz-txt-link-freetext">http://www.interlis.ch/INTERLIS2.3</a>></span></p>
<p class="MsoNormal"><span lang="EN-US"><HEADERSECTION
SENDER="ili2ora-4.4.3-658b7daf37ba45ed2330ca3e3a3c3d59c96e91fa"
VERSION="2.3"><MODELS></span></p>
<p class="MsoNormal"><span lang="EN-US"><MODEL
NAME="testModel" VERSION="2022-06-10" URI=<a
href="mailto:PC4@localhost" moz-do-not-send="true">mailto:PC4@localhost</a>></MODEL></MODELS></HEADERSECTION></span></p>
<p class="MsoNormal"><span lang="EN-US"><DATASECTION></span></p>
<p class="MsoNormal"><span lang="EN-US"><testModel
BID="testModel"></span></p>
<p class="MsoNormal"><span lang="EN-US">
</span><testModel.table TID="234921"></p>
<p class="MsoNormal"> <span
lang="EN-US">
<name>pepe</name></span></p>
<p class="MsoNormal"><span lang="EN-US">
< name >maria</ name ></span></p>
<p class="MsoNormal"><span lang="EN-US">
< name >juana</</span><span lang="EN-US">
</span>name <span lang="EN-US">></span></p>
<p class="MsoNormal"><span lang="EN-US">
</span><nestedfield></p>
<p class="MsoNormal"> <span
lang="EN-US">
< name >julia</ name > //also try a nested
field, wioth results….</span></p>
<p class="MsoNormal"><span lang="EN-US">
</span></nestedfield></p>
<p class="MsoNormal"> <span
lang="EN-US">
< name >mario</ name ></span></p>
<p class="MsoNormal"><span lang="EN-US">
< name >luz</ name ></span></p>
<p class="MsoNormal"><span lang="EN-US">
</span>< name ><b>angela</b></ name ></p>
<p class="MsoNormal"> </testModel.table></p>
<p class="MsoNormal"></Submodelo_Insumos_SNR_V1_0.Datos_SNR></p>
<p class="MsoNormal"><span lang="EN-US"></DATASECTION></span></p>
<p class="MsoNormal"><span lang="EN-US"></TRANSFER>”</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">After execution, the
output file “ nombres.json ”of conversion always leaves
only the last key value :</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">{</span></p>
<p class="MsoNormal"><span lang="EN-US">"type":
"FeatureCollection",</span></p>
<p class="MsoNormal"><span lang="EN-US">"name":
"testModel.table",</span></p>
<p class="MsoNormal"><span lang="EN-US">"features": [</span></p>
<p class="MsoNormal"><span lang="EN-US">{ "type": "Feature",
"properties": { "TID": "234921", " name ": "<b>angela</b>"
}, "geometry": null }</span></p>
<p class="MsoNormal"><span lang="EN-US">]</span></p>
<p class="MsoNormal"><span lang="EN-US">}</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><b><span lang="EN-US">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 ?</span></b><span lang="EN-US"> </span><span
lang="EN-US">because, i saw that ogr2ogr always update the
same key with the last value, and we need
<b><i>all the seven names</i></b> array in the output json
file on the same registry.
</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">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.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Any advice would be
really appreciated, thanks!!!</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span><img id="Imagen_x0020_10"
src="cid:part1.BrxN0vFI.TT9jb5Zj@spatialys.com"
alt="minsait-indra" class="" width="72" height="43"></span><span></span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>FRANDO GONZÁLEZ</span></p>
<p class="MsoNormal"><span>Senior Systems Engineer</span></p>
<p class="MsoNormal"><span><a
href="mailto:fagonzalezv@indracompany.com"
moz-do-not-send="true"><span>fagonzalezv@indracompany.com</span></a>
</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>Calle 93 16 25</span></p>
<p class="MsoNormal"><span lang="ES">Bogotá, Colombia</span></p>
<p class="MsoNormal"><span lang="ES">T +57 1 646 36 00</span></p>
<p class="MsoNormal"><span lang="ES">M +57 3006604908</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span><a
href="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"
target="_blank" moz-do-not-send="true"><span>minsait.com</span></a></span></p>
<p class="MsoNormal"><span><a
href="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"
target="_blank" moz-do-not-send="true"><span>indracompany.com</span></a></span><span></span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"> </p>
</div>
<br>
<hr>
<br>
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.<br>
Evite imprimir este mensaje si no es estrictamente necesario.<br>
<br>
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.<br>
Avoid printing this message if it is not absolutely necessary.<br>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>