<div dir="ltr">Out of curiosity, why do you use pyshp when shapefiles are already supported by qgis?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 10, 2013 at 2:51 PM, Suryo Miles <span dir="ltr"><<a href="mailto:suryomiles666@gmail.com" target="_blank">suryomiles666@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I try to make plugin to read shapefile with plugin builder in QGIS and i try to import pyshp in plugin to read shapefiles but i got this error message<br>
<br> Traceback (most recent call last):<br>
File "C:\Users\Mr.Pakde/.qgis2/python/plugins\shpread\shpreaddialog.py", line 42, in baca<br> shapefile.Reader("shapefiles/blockgroups")<br> File "C:\Users\Mr.Pakde/.qgis2/python/plugins\shpread\shapefile.py", line 220, in __init__<br>
self.load(args[0])<br> File "C:\Users\Mr.Pakde/.qgis2/python/plugins\shpread\shapefile.py", line 253, in load<br> raise ShapefileException("Unable to open %s.shp" % shapeName)<br>ShapefileException: Unable to open shapefiles/blockgroups.shp<br>
<br>Python version:<br>2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]<br><br></div>------and this is code i use ( i put it in dialog.py)-------<br><br># insert every signal connection here!<br> cariButton = self.ui.btnShp<br>
QtCore.QObject.connect(cariButton, QtCore.SIGNAL('clicked()'),self.baca)<br><br> def baca(self):<br> sf = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '*.shp')<br> shapefile.Reader("shapefiles/blockgroups")<br>
shapes = sf.shapes()<br> # Read the bounding box from the 4th shape<br> shapes[3].bbox<br> [-122.485792, 37.786931000000003, -122.446285, 37.811019000000002]<br> # Read the 8th point in the 4th shape<br>
shapes[3].points[7]<br> [-122.471063, 37.787402999999998]<br> <br> #panggil isi data<br> self.isiDataFile(sf)<br><br> def isiDataFile(self, nmfile):<br> #buka dengan open mode baca<br>
teksFile = open(nmfile, 'r').read()<br><br> self.ui.textShp.setText(teksFile)<br><br><br></div><div>can someone help me?<br></div></div>
<br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div><br></div>