lannymac / pyshp

Automatically exported from code.google.com/p/pyshp
MIT License
0 stars 0 forks source link

Line/polygon features not displayed in QGIS #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Adapted from my identical question on gis.stackexchange.com:
http://gis.stackexchange.com/questions/68164/how-to-get-quantum-gis-display-a-li
ne-or-polygon-feature-created-by-python-packa

What steps will reproduce the problem?
1. Execute the following example script, taken directly from the pyshp docs:

    import shapefile
    w = shapefile.Writer(shapefile.POLYLINE)
    w.line(parts=[[[1,5],[5,5],[5,1],[3,3],[1,1]]])
    w.field('FIRST_FLD','C','40')
    w.field('SECOND_FLD','C','40')
    w.record(FIRST_FLD='First', SECOND_FLD='Line')
    w.save('test-line')

2. Load resulting shapefile into Quantum GIS (tested with versions 1.7.3, 1.8.0 
and 1.9.0 Alpha)

What is the expected output? What do you see instead?

    Expected: A line.
    Actual: Nothing.

What version of the product are you using? On what operating system?

    Pyshp 1.1.7 with Python 2.7 on Windows 7 x64.

Additional information

Another user on stackexchange reproduced the issue for the following polygon 
example. He ran the tool ogrinfo, which reported an "invalid shp file".

    import shapefile
    w = shapefile.Writer(shapefile.POLYGON)
    w.poly(parts=[[[1,5],[5,5],[5,1],[3,3],[1,1]]])
    w.field('FIRST_FLD','C','40')
    w.field('SECOND_FLD','C','40')
    w.record('First','Polygon')
    w.save('test-polygon')

Original issue reported on code.google.com by jdorf...@gmail.com on 8 Aug 2013 at 3:05

GoogleCodeExporter commented 9 years ago
This issue is resolved in PyShp version 1.1.9.  Please upgrade.  I used PyShp 
1.1.9, Python 2.7 on Windows 7 x64, and the above sample to produce the 
attached shapefile and QGIS 1.8.0 screenshot.  

Original comment by geospati...@gmail.com on 8 Aug 2013 at 3:25

Attachments:

GoogleCodeExporter commented 9 years ago
It worked.
Thanks for the incredibly quick response!

Original comment by jdorf...@gmail.com on 8 Aug 2013 at 3:37