Out of curiosity, why do you use pyshp when shapefiles are already supported by qgis?
On Tue, Dec 10, 2013 at 2:51 PM, Suryo Miles <[email protected]>wrote: > 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 > > Traceback (most recent call last): > File "C:\Users\Mr.Pakde/.qgis2/python/plugins\shpread\shpreaddialog.py", > line 42, in baca > shapefile.Reader("shapefiles/blockgroups") > File "C:\Users\Mr.Pakde/.qgis2/python/plugins\shpread\shapefile.py", > line 220, in __init__ > self.load(args[0]) > File "C:\Users\Mr.Pakde/.qgis2/python/plugins\shpread\shapefile.py", > line 253, in load > raise ShapefileException("Unable to open %s.shp" % shapeName) > ShapefileException: Unable to open shapefiles/blockgroups.shp > > Python version: > 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] > > ------and this is code i use ( i put it in dialog.py)------- > > # insert every signal connection here! > cariButton = self.ui.btnShp > QtCore.QObject.connect(cariButton, > QtCore.SIGNAL('clicked()'),self.baca) > > def baca(self): > sf = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '*.shp') > shapefile.Reader("shapefiles/blockgroups") > shapes = sf.shapes() > # Read the bounding box from the 4th shape > shapes[3].bbox > [-122.485792, 37.786931000000003, -122.446285, 37.811019000000002] > # Read the 8th point in the 4th shape > shapes[3].points[7] > [-122.471063, 37.787402999999998] > > #panggil isi data > self.isiDataFile(sf) > > def isiDataFile(self, nmfile): > #buka dengan open mode baca > teksFile = open(nmfile, 'r').read() > > self.ui.textShp.setText(teksFile) > > > can someone help me? > > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user >
_______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
