<div dir="ltr"><div style="color:rgb(0,0,0);font-size:16px">Looking at the source, 2.99 seems to fix the issue that the multipart to singlepart vector geometry tool does not preserve Z values for 3d geometries. 2.18.10 seems to still have this issue, at least 2.18.3 has it.</div><div style="color:rgb(0,0,0);font-size:16px"><br></div><div style="color:rgb(0,0,0);font-size:16px">It turns out that it is straightforward to backport the 2.99 fix to 2.18, so I thought it may be useful to share the fix:</div><div style="color:rgb(0,0,0);font-size:16px"><br></div><div style="color:rgb(0,0,0);font-size:16px">After backing up the installed</div><div style="color:rgb(0,0,0);font-size:16px"><br></div><div style="color:rgb(0,0,0);font-size:16px"><span style="font-family:monospace">qgis/python/plugins/<wbr>processing/algs/qgis/<wbr>MultipartToSingleparts.py<br></span></div><div style="color:rgb(0,0,0);font-size:16px"><br></div><div style="color:rgb(0,0,0);font-size:16px">file, edit this file at the bottom (with notepad++ or emacs) and change the function extractAsSingle to (this much shorter) definition:</div><div style="color:rgb(0,0,0);font-size:16px"><br></div><div style="color:rgb(0,0,0);font-size:16px"><span style="font-family:monospace"><span style="color:rgb(175,0,255)">def</span> <span style="color:rgb(0,0,255)">extractAsSingle</span>(<span style="color:rgb(175,0,255)">self</span>, geom): <br>       <span style="color:rgb(175,0,255)">print</span>(<span style="color:rgb(135,0,95)">'<wbr>multipart2single: use .asGeometryCollection'</span>) <br>       <span style="color:rgb(175,95,0)">multiGeom</span> = QgsGeometry() <br>       <span style="color:rgb(175,95,0)">geometries</span> = [] <br>       <span style="color:rgb(175,0,255)">if</span> geom.isMultipart(): <br>           <span style="color:rgb(175,95,0)">multiGeom</span> = geom.asGeometryCollection() <br>           <span style="color:rgb(175,0,255)">for</span> g <span style="color:rgb(175,0,255)">in</span> multiGeom: <br>               geometries.<wbr>append(g) <br>       <span style="color:rgb(175,0,255)">else</span>:     <br>           geometries.append(<wbr>geom)</span></div><div style="color:rgb(0,0,0);font-size:16px"><span style="font-family:monospace;color:rgb(175,0,255)">       return</span><span style="font-family:monospace"> geometries</span><span style="font-family:monospace"><br></span></div><br style="color:rgb(0,0,0);font-size:16px"><span style="color:rgb(0,0,0);font-size:16px">.asGeometryCollection() preserves Z, while the original .as or .from methods do not.</span><div style="color:rgb(0,0,0);font-size:16px"><br><div>Also rename the corresponing MultipartToSinglePart.pyc and .pyo files to something else.<div><br></div><div>Restart qgis and try it out. This is only tested on linux and with MultiPointZ but may work with other types as well.<br><div><br></div><div>Good luck,</div><div><br></div><div>Andreas</div><div><br></div><div>PS: I did not submit this as a PR to the github repo since the issue seems already fixed and the strict requirements for a PR.</div><div class="gmail-yj6qo gmail-ajU" style="margin:2px 0px 0px"><div id="gmail-:39e" class="gmail-ajR" tabindex="0"><img class="gmail-ajT" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div></div></div></div></div>