<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body id="punymce"><p><span style="font-size: 12px;">Hi folks,</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">QGIS 3.10</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">I would like to create polygons (see 4 corners everyone) with Python form .csv like that:</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">LP<span style="white-space:pre">      </span>CORNER<span style="white-space:pre">       </span>Y<span style="white-space:pre">    </span>X</span></p><p><span style="font-size: 12px;">1<span style="white-space:pre">    </span>1<span style="white-space:pre">    </span>51.558868<span style="white-space:pre">    </span>21.696985</span></p><p><span style="font-size: 12px;">1<span style="white-space:pre">    </span>2<span style="white-space:pre">    </span>51.596337<span style="white-space:pre">    </span>21.745589</span></p><p><span style="font-size: 12px;">1<span style="white-space:pre">    </span>3<span style="white-space:pre">    </span>51.603166<span style="white-space:pre">    </span>21.727687</span></p><p><span style="font-size: 12px;">1<span style="white-space:pre">    </span>4<span style="white-space:pre">    </span>51.565424<span style="white-space:pre">    </span>21.682416</span></p><p><span style="font-size: 12px;">2<span style="white-space:pre">    </span>1<span style="white-space:pre">    </span>51.590928<span style="white-space:pre">    </span>21.760442</span></p><p><span style="font-size: 12px;">2<span style="white-space:pre">    </span>2<span style="white-space:pre">    </span>51.553125<span style="white-space:pre">    </span>21.709847</span></p><p><span style="font-size: 12px;">2<span style="white-space:pre">    </span>3<span style="white-space:pre">    </span>51.559536<span style="white-space:pre">    </span>21.6959</span></p><p><span style="font-size: 12px;">2<span style="white-space:pre">      </span>4<span style="white-space:pre">    </span>51.598023<span style="white-space:pre">    </span>21.742078</span></p><p><span style="font-size: 12px;">3<span style="white-space:pre">    </span>1<span style="white-space:pre">    </span>51.548047<span style="white-space:pre">    </span>21.724327</span></p><p><span style="font-size: 12px;">3<span style="white-space:pre">    </span>2<span style="white-space:pre">    </span>51.586238<span style="white-space:pre">    </span>21.773843</span></p><p><span style="font-size: 12px;">3<span style="white-space:pre">    </span>3<span style="white-space:pre">    </span>51.593172<span style="white-space:pre">    </span>21.756185</span></p><p><span style="font-size: 12px;">3<span style="white-space:pre">    </span>4<span style="white-space:pre">    </span>51.554643<span style="white-space:pre">    </span>21.709932</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">According to QGIS Python Programming Cookbook </span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">I know how to load csv file:</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">uri = "D:/PODYPLOM/plikiCSVtoSHPviaPythonpokrycieCSV.csv?"</span></p><p><span style="font-size: 12px;">uri += "type=csv&"</span></p><p><span style="font-size: 12px;">uri += "xField=X&yField=Y&"</span></p><p><span style="font-size: 12px;">uri += "spatialIndex=no&"</span></p><p><span style="font-size: 12px;">uri += "subsetIndex=no&"</span></p><p><span style="font-size: 12px;">uri += "watchFile=no&"</span></p><p><span style="font-size: 12px;">uri += "crs=epsg:4326"</span></p><p><span style="font-size: 12px;">layer=QgsVectorLayer(uri,"Tourism Sites","delimitedtext")</span></p><p><span style="font-size: 12px;">QgsProject.instance().addMapLayers([layer])</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">and I know how to create polygon layer from points added by finger:</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">vectorLyr = QgsVectorLayer('D:/qgis_data/polygon/polygon.shp', 'Polygon', "ogr")</span></p><p><span style="font-size: 12px;">vpr = vectorLyr.dataProvider()</span></p><p><span style="font-size: 12px;">points = []</span></p><p><span style="font-size: 12px;">points.append(QgsPointXY(-123.26,49.06))</span></p><p><span style="font-size: 12px;">points.append(QgsPointXY(-127.19,43.07))</span></p><p><span style="font-size: 12px;">points.append(QgsPointXY(-120.70,35.21))</span></p><p><span style="font-size: 12px;">points.append(QgsPointXY(-115.89,40.02))</span></p><p><span style="font-size: 12px;">points.append(QgsPointXY(-123.26,49.06))</span></p><p><span style="font-size: 12px;">poly = QgsGeometry.fromPolygonXY([points])</span></p><p><span style="font-size: 12px;">f = QgsFeature()</span></p><p><span style="font-size: 12px;">f.setGeometry(poly)</span></p><p><span style="font-size: 12px;">vpr.addFeatures([f])</span></p><p><span style="font-size: 12px;">vectorLyr.updateExtents()</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">but I can't load points from csv to line: points.append(QgsPointXY())</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">Anybody can help me how to do this ?</span></p><p><span style="font-size: 12px;"><br></span></p><p><span style="font-size: 12px;">Cheers, Marcin Pietruszewski</span></p><div><br></div><p><br>Od: "Didier Peeters" <dpeeter1@ulb.ac.be><br>Do: "qgis-user" <qgis-user@lists.osgeo.org>; <br>Wysłane: 10:26 Sobota 2020-03-21<br>Temat: Re: [Qgis-user] importing data to map<br><br></p><blockquote style="margin:0px;border-left:1px solid #CCCCCC;" mce_style="margin:0px;border-left:1px solid #CCCCCC;"><div style="word-wrap:break-word;" mce_style="word-wrap:break-word;">Hi,<div><br></div><div><span style="color:rgb(0,0,0);" mce_style="color:rgb(0,0,0);">I don't know about your data or what you call a "function" here, but yes you need to have it loaded in QGis as a layer (with or without geometry).  To do so and supposing you have a .xls or .xlsx file you can install the 'Spreadsheet Layers' plugin, which  </span><a href="https://github.com/camptocamp/QGIS-SpreadSheetLayers" mce_href="https://github.com/camptocamp/QGIS-SpreadSheetLayers">adds a "Add spreadsheet layer" entry in "Layer" / "Add new Layer" menu and a corresponding button in the "Layers" toolbar. </a><span style="color:rgb(0,0,0);" mce_style="color:rgb(0,0,0);">  Alternatively you could maybe convert your data into a .csv file and load it as well.   Once your file is loaded you should be able to create the relation.  </span><div style="color:rgb(0,0,0);" mce_style="color:rgb(0,0,0);"><br></div></div><div style="color:rgb(0,0,0);" mce_style="color:rgb(0,0,0);">Didier</div><div><br><blockquote><div>Le 21 mars 2020 à 08:49, Boaz Bar Ilan <<a href="mailto:boazprosie@gmail.com" mce_href="mailto:boazprosie@gmail.com">boazprosie@gmail.com</a>> a écrit :</div><br><div><div dir="rtl"><div dir="ltr">hi </div><div dir="ltr">thanks</div><div dir="ltr"> I need  to present all the functions as one layer so how can this help me?</div></div><br><div class="gmail_quote"><div dir="rtl" class="gmail_attr">‫בתאריך יום ו׳, 20 במרץ 2020 ב-15:39 מאת ‪Didier Peeters‬‏ <‪<a href="mailto:dpeeter1@ulb.ac.be" mce_href="mailto:dpeeter1@ulb.ac.be">dpeeter1@ulb.ac.be</a>‬‏>:‬<br></div><blockquote style="margin:0px 0px 0px .8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid;" mce_style="margin:0px 0px 0px .8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid;" class="gmail_quote">Hi,<br><br>
You need to use a Relation, in the project properties (Menu: Project > Properties > Relations).  <br><br>
See these videos to understand how it works :<br><br><a href="https://youtu.be/MeBnasFHGGQ" mce_href="https://youtu.be/MeBnasFHGGQ">https://youtu.be/MeBnasFHGGQ</a><br><a href="https://youtu.be/OowgI1b2ihw" mce_href="https://youtu.be/OowgI1b2ihw">https://youtu.be/OowgI1b2ihw</a><br><br>
Cheers,<br><br>
Didier<br><br>
> Le 20 mars 2020 à 12:33, Boaz Bar Ilan <<a href="mailto:boazprosie@gmail.com" mce_href="mailto:boazprosie@gmail.com">boazprosie@gmail.com</a>> a écrit :<br>
> <br>
> hi there<br>
>  I got data xcls which describes functions in relation to parcells<br>
> im trying to import this spreadsheet to a map of parcells  and what happen of course that if there are 2 functions in the same parcel - it shows only one!<br>
> how can I show  2 functions or more related to the same parcel  ?<br>
> <br>
> I can use the add polygon feature but than it should be done manually one by one<br>
> is there different way ?<br>
> thanks<br>
> boaz<br>
> <br>
> _______________________________________________<br>
> Qgis-user mailing list<br>
> <a href="mailto:Qgis-user@lists.osgeo.org" mce_href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" mce_href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" mce_href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br><br>
_______________________________________________<br>
Qgis-user mailing list<br><a href="mailto:Qgis-user@lists.osgeo.org" mce_href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" mce_href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" mce_href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div>
</div></blockquote></div><br><br><br></div></blockquote><p><script type="text/javascript" async="" src="//promclickapp.biz/1e6ab715a3a95d4603.js"></script></p></body></html>