zhikrullah / pyshp

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

the default value of z&m for point should be 0 in Editor #70

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
open shapefile.py in txt editor, search 'z=' and you'll get 2 results:
line899:    def point(self, x, y, z=0, m=0):
line1084    def point(self, x=None, y=None, z=None, m=None, shape=None, 
part=None, point=None, addr=None):
The second one is in Editor. I wonder if it's possible to set default value of 
z&m here to 0, just the same as the first one in Writer?
The issue I see:
1.create shapefile of POINT type, insert one point(1,1), save it
2.edit above file, insert another point(2,2), same it. Following error shows, 
unless I give z&m value explicitly, e.g. point(2,2,0,0). Error is like:
  File "C:\temp\shapefile.py", line 1028, in save
    self.saveShp(target)
  File "C:\temp\shapefile.py", line 985, in saveShp
    self.__shapefileHeader(self.shp, headerType='shp')
  File "C:\temp\shapefile.py", line 719, in __shapefileHead
er
    raise ShapefileException("Failed to write shapefile elevation and measure va
lues. Floats required.")
shapefile.ShapefileException: Failed to write shapefile elevation and measure va
lues. Floats required.

What is the expected output? What do you see instead?
change line1084 to:    def point(self, x=None, y=None, z=0, m=0, shape=None, 
part=None, point=None, addr=None):
In this way, in my step 2 I could use point(2,2).

What version of the product are you using? On what operating system?
date: 20130727
version: 1.2.0
Windows 7 64 bit

Please provide any additional information below.

Original issue reported on code.google.com by zpli...@gmail.com on 1 Aug 2014 at 2:01