<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;"> I would use ogr sql syntax to select whatever you would like to keep. Experiment first with ogrinfo. Then do it with ogr2ogr. /Lars S.<br><br><br>4 januari 2020 kl. 12:50, "LE LAMER Romain" <<a target="_blank" tabindex="-1" href="mailto:rlelamer@hotmail.fr?to=%22LE%20LAMER%20Romain%22%20<rlelamer@hotmail.fr>">rlelamer@hotmail.fr</a>> skrev:<br> <blockquote><div><div style="word-wrap: break-word;-webkit-nbsp-mode: space;line-break: after-white-space">Hi,<div> <div>During a kml export, from a shp, I have many tags that do not interest me and that I would like to delete.</div> <div>I cannot find the information if it is possible via a parameter in the ogr2org program.</div> </div> <div></div> <div><span style="caret-color: rgb(16, 16, 16);color: rgb(16, 16, 16);font-family: Monaco;font-size: 10px;background-color: rgba(255, 255, 255, 0.85098)">ogr2ogr -f KML output.kml input.shp</span></div> <div></div> <div>Ex:</div> <div> <div><i><?xml version="1.0" encoding="utf-8" ?></i></div> <div><i><kml xmlns="<a rel="external nofollow noopener noreferrer" target="_blank" tabindex="-1" href="http://www.opengis.net/kml/2.2">http://www.opengis.net/kml/2.2</a>"></i></div> <div><i><Document id="root_doc"></i></div> <div><i><Schema name="gbl_0_0" id="gbl_0_0"></i></div> <div><i><SimpleField name="DN" type="int"></SimpleField></i></div> <div><i></Schema></i></div> <div><i><Folder><name>gbl_0_0</name></i></div> <div><i><Placemark></i></div> <div><i><Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style></i></div> <div><i><ExtendedData><SchemaData schemaUrl="#gbl_0_0"></i></div> <div><i><SimpleData name="DN">0</SimpleData></i></div> <div><i></SchemaData></ExtendedData></i></div> <div><i><LineString><coordinates>-180,90 -168.75,90.0 -168.75,78.75 -180.0,78.75 -180,90</coordinates></LineString></i></div> <div><i></Placemark></i></div> <div><i><Placemark></i></div> <div><i><Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style></i></div> <div><i><ExtendedData><SchemaData schemaUrl="#gbl_0_0"></i></div> <div><i><SimpleData name="DN">0</SimpleData></i></div> <div><i></SchemaData></ExtendedData></i></div> <div><i><LineString><coordinates>-180,90 -168.75,90.0 -168.75,78.75 -180.0,78.75 -180,90</coordinates></LineString></i></div> <div><i></Placemark></i></div> <div><i><Placemark></i></div> <div><i><Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style></i></div> <div><i><ExtendedData><SchemaData schemaUrl="#gbl_0_0"></i></div> <div><i><SimpleData name="DN">0</SimpleData></i></div> <div><i></SchemaData></ExtendedData></i></div> <div><i><LineString><coordinates>-180,90 -168.75,90.0 -168.75,78.75 -180.0,78.75 -180,90</coordinates></LineString></i></div> <div><i></Placemark></i></div> <div><i></Folder></i></div> <div><i></Document></kml></i></div> </div> <div></div> <div>1 - I don't know why I have the triplicate entries ... Surely my input.shp from QGIS, I must be doing something wrong, but I can correct this via this (which was given to me):</div> <div></div> <div><div style="margin: 0px;font-stretch: normal;font-size: 10px;line-height: normal;font-family: Monaco;color: rgb(16, 16, 16);background-color: rgba(255, 255, 255, 0.85098)"><span style="font-variant-ligatures: no-common-ligatures">gawk 'BEGIN{PROCINFO["sorted_in"]="@val_num_asc"}/LineString/{A[$0]=NR;next}{A[NR ":" $0]=NR}END{for (i in A) { sub(/^[0-9]+:/,"",i); print i }}' input.kml | gsed '/<Placemark>/{:bc;N;s/\/Placemark>/&/;tcc;bbc;:cc;/LineString/!d;}’ >input_simp.kml</span></div></div> <div></div> <div>which gives me :</div> <div> <div><i><?xml version="1.0" encoding="utf-8" ?></i></div> <div><i><kml xmlns="<a rel="external nofollow noopener noreferrer" target="_blank" tabindex="-1" href="http://www.opengis.net/kml/2.2">http://www.opengis.net/kml/2.2</a>"></i></div> <div><i><Document id="root_doc"></i></div> <div><i><Schema name="gbl_0_0" id="gbl_0_0"></i></div> <div><i><SimpleField name="DN" type="int"></SimpleField></i></div> <div><i></Schema></i></div> <div><i><Folder><name>gbl_0_0</name></i></div> <div><i><Placemark></i></div> <div><i><Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style></i></div> <div><i><ExtendedData><SchemaData schemaUrl="#gbl_0_0"></i></div> <div><i><SimpleData name="DN">0</SimpleData></i></div> <div><i></SchemaData></ExtendedData></i></div> <div><i><LineString><coordinates>-180,90 -168.75,90.0 -168.75,78.75 -180.0,78.75 -180,90</coordinates></LineString></i></div> <div><i></Placemark></i></div> <div><i></Folder></i></div> <div><i></Document></kml></i></div> </div> <div></div> <div> <span style="font-style: normal">2 - </span>And we arrive at what is the object of my question, which is to know if via a parameter of ogr2ogr it is possible that it does not write these lines</div> <div> <div><i><Schema name="gbl_0_0" id="gbl_0_0"></i></div> <div><i><SimpleField name="DN" type="int"></SimpleField></i></div> <div><i></Schema></i></div> </div> <div></div> <div><span style="font-style: normal">and</span></div> <div></div> <div> <div><i><ExtendedData><SchemaData schemaUrl="#gbl_0_0"></i></div> <div><i><SimpleData name="DN">0</SimpleData></i></div> <div><i></SchemaData></ExtendedData></i></div> </div> <div></div> <div><span style="font-style: normal">which would give me a kml like this</span></div> <div> <div style="font-style: italic"><?xml version="1.0" encoding="utf-8" ?></div> <div style="font-style: italic"><kml xmlns="<a rel="external nofollow noopener noreferrer" target="_blank" tabindex="-1" href="http://www.opengis.net/kml/2.2">http://www.opengis.net/kml/2.2</a>"></div> <div style="font-style: italic"><Document id="root_doc"></div> <div style="font-style: italic"><Folder><name>gbl_0_0</name></div> <div style="font-style: italic"><Placemark></div> <div style="font-style: italic"><Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style></div> <div style="font-style: italic"><LineString><coordinates>-180,90 -168.75,90.0 -168.75,78.75 -180.0,78.75 -180,90</coordinates></LineString></div> <div style="font-style: italic"></Placemark></div> <div style="font-style: italic"></Folder></div> <div style="font-style: italic"></Document></kml></div> <div style="font-style: italic"></div> <div>I know it is possible to do it via sed but if I can do without this step it would be a plus</div> </div> <div></div> <div>Thanks</div> </div></div></blockquote> <br><br><signature></signature> </div></body></html>