Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIO example a few more details #36

Open
apiszcz opened this issue Sep 11, 2015 · 2 comments
Open

StringIO example a few more details #36

apiszcz opened this issue Sep 11, 2015 · 2 comments

Comments

@apiszcz
Copy link

apiszcz commented Sep 11, 2015

Similar to what is the manual page with a few more details.

from io import BytesIO as StringIO
import shapefile as sf

wb=sf.Writer(shapeType=sf.POINT)

wb.field('test','N',16,3)
wb.record(test=100)
wb.point(1.0,1.0)

wbshp=StringIO()
wbshx=StringIO()
wbdbf=StringIO()
wb.saveShp(wbshp)
wb.saveShx(wbshx)
wb.saveDbf(wbdbf)

with open('testdata.shp', 'wb') as f:
f.write(wbshp.getvalue())
with open('testdata.shx', 'wb') as f:
f.write(wbshx.getvalue())
with open('testdata.dbf', 'wb') as f:
f.write(wbdbf.getvalue())

@micahcochran
Copy link
Contributor

Are you suggesting that the README file would be improved by adding this more detailed example? If so you might need to make a few tempfiles so the doc tests will delete the files.

@apiszcz
Copy link
Author

apiszcz commented Jan 22, 2016

Yes. Thank you.

On Tue, Jan 19, 2016 at 1:38 AM, Micah Cochran [email protected]
wrote:

Are you suggesting that the README file would be improved by adding this
more detailed example? If so you might need to make a few tempfiles so the
doc tests will delete the files.


Reply to this email directly or view it on GitHub
#36 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants