<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Luis,</p>
<p>the issue is that shapefile layers do not really support a
genuine unknown layer geometry type. They accept it on layer
creation, but as soon as you write the first feature into it, the
feature layer geometry type is used as the layer geometry type,
and shapefile don't accept a mix of points and multipoints. Which
brings to another issue is that <span lang="EN-GB">PROMOTE_TO_MULTI
until now only affected lines and polygons, not points. I've
fixed this with <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/pull/10258">https://github.com/OSGeo/gdal/pull/10258</a> .</span></p>
<p><span lang="EN-GB">One workaround for you is to write your result
in a Memory layer or a GeoPackage layer for example, and then
use gdal.VectorTranslate() to convert it to a multipoint
shapefile</span></p>
<p><span lang="EN-GB">Even<br>
</span></p>
<div class="moz-cite-prefix">Le 20/06/2024 à 14:11, Michaelis, Luis
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:FR2P281MB0186C68FDF929971A6FFD83FDAC82@FR2P281MB0186.DEUP281.PROD.OUTLOOK.COM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Hello GDAL devs! <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I’ve got a question
about layer intersection detection.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I’d like to use the GDAL
Python interface to do batched intersection checks between
two vector layers, one containing only two-point line
strings and one containing terrain contour lines. To compute
these intersections, I would like to use the
`ogr.Layer.Intersection` function, since it is supposed do
batched intersection detection in native code.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Since all of the
intersections will either be points or multi points, I was
expecting to use the `KEEP_LOWER_DIMENSION_GEOMETRIES` and
`PROMOTE_TO_MULTI` options, to record the intersections into
a new layer with a multi-point geometry. This, however, does
not work and I simply don’t get any intersections at all.
Setting the geometry to just points does also not work. In
neither of these cases are any errors or warnings issued.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">When I use a destination
layer with a `wkbUnknown` geometry however, I do get
warnings about it trying to add muti-point geometries to a
point layer (which I would sort of expect). Setting
`SKIP_FAILURES` and saving the resulting shape, I can
actually see the intersection points but as expected, I
can’t see the multipoint intersections. They’re simply
missing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">So, the question is: am
I missing something? Do need to add some metadata
information to the destination layer before computing the
intersections or is what I’m trying to do impossible?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Here’s the code I’ve
written: <a
href="https://gist.github.com/lmichaelis-fhg/3ae5ba63b92c1a6ad609baa3ccbfbf80#file-dem-generate-rix-gdal-py-L109-L121"
moz-do-not-send="true" class="moz-txt-link-freetext">
https://gist.github.com/lmichaelis-fhg/3ae5ba63b92c1a6ad609baa3ccbfbf80#file-dem-generate-rix-gdal-py-L109-L121</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">- Luis<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<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>