<div dir="ltr"><div class="gmail_default" style="color:#666666">I fixed it. Sorry for the inconvenience:<br></div><div class="gmail_default" style="color:#666666"><br></div><div class="gmail_default" style="color:#666666">layer1 = QgsVectorLayer('Polygon?crs=epsg:32612', 'layer2', 'memory') <br>layer2 = QgsVectorLayer('Polygon?crs=epsg:32612', 'layer1', 'memory') <br><br>print(layer1.source())<br>print(layer2.source())<br>layer1.setDataSource(layer2.source(), <a href="http://layer2.name">layer2.name</a>(), layer2.dataProvider().name())<br>print(layer1.source())<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 12 Jun 2019 at 00:28, Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 11 Jun 2019 at 15:06, Ivan Ivanov <<a href="mailto:suricactus@gmail.com" target="_blank">suricactus@gmail.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
><br>
> Can you give me some idea why I'm getting two uids in the layer's source? And also how I can fix this because now the layer just disappears from the map canvas. (all layers are isValid() = True)<br>
><br>
> oldLayer.source()<br>
> # MultiLineString?crs=EPSG:32737&field=fid:integer(0,0)&uid={6cd1f176-9c05-4d2a-961a-3143a8fa422b}<br>
><br>
> newLayer = processing.run('save:selectedfeatures', {<br>
> 'INPUT': oldLayer,<br>
> 'OUTPUT': 'memory:newLayer'<br>
> )<br>
><br>
> oldLayer.setDataSource(newLayer.source(), oldLayer.name(), newLayer.dataProvider().name())<br>
><br>
> newLayer.source()<br>
> # MultiLineString?crs=EPSG:32737&field=fid:integer(0,0)&uid={d36aff88-4248-4ffb-be2f-2ac1891ac26d}<br>
> oldLayer.source()<br>
><br>
> # WRONG, I would expect the same as above. Also, the uid is completely new.<br>
> # MultiLineString?crs=EPSG:32737&field=fid:integer(0,0)&uid={d36aff88-4248-4ffb-be2f-2ac1891ac26d}&uid={3422de07-cf38-4249-af55-23c7d9779daf}<br>
<br>
Hi Ivan,<br>
<br>
Your code seems incomplete and has some syntax errors -- maybe it<br>
wasn't copied correctly? Can you repost please?<br>
<br>
Nyall<br>
</blockquote></div>