Quite a few problems with Spanish official shapefiles

33 views
Skip to first unread message

Jesus Cea

unread,
Jul 14, 2011, 6:52:56 AM7/14/11
to geospati...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, trying to use Spanish official shapefiles, with last versiᅵn (trunk)
of shapefile.py.

I see some problems:

1. The shapes are only X,Y coordinates. Spanish BTN files contains Z
coordinate also. Why not expose X, Y, Z and M?.

2. Shapes doesn't work:

"""
jcea@ubuntu:/tmp/z/BTN25_5763$ python
Python 2.7.2 (default, Jul 14 2011, 00:30:51)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shapefile a=shapefile.Reader("BCN0626L_SENDA.dbf")
>>> a.shapes()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/shapefile.py", line 230,
in shapes
shapes.append(self.__shape())
File "/usr/local/lib/python2.7/site-packages/shapefile.py", line 172,
in __shape
record.points = [_Array('d', unpack("<2d", f.read(16))) for p in
range(nPoints)]
MemoryError
"""

Nevertheles "a.shape(i)" works well.

3. Some documentation about ShapeType meaning would be very useful.

If you need a demo shapefile to test, let me know. I can send it by
private email.

- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jc...@jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
jabber / xmpp:jc...@jabber.org _/_/ _/_/ _/_/_/_/_/
. _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBTh7KiJlgi5GaxT1NAQK3YQP/V7T2u/PvamnDwT2iJBQ1bHUArGIkPhxR
/ijCnuQuRKkp6LA+qTsmky4jgWEtWTUKBl0vLV+mkA8H7kMtvTNLhg8DY1CoxR9e
XiJzK//4exNMAHHjNJPq3XXeRqtidPJ4yIJxgQ0luxnn3Jq6zM0tfrkecuC2Hv02
J1pJ6PU3ONI=
=YjuT
-----END PGP SIGNATURE-----

Geospatial Python

unread,
Aug 15, 2011, 3:05:27 PM8/15/11
to Geospatial Python
Jesus,

Please send me examples. You can email them to jlawhead <at>
geospatialpython <dotcom>

The Z and M values are exposed if the shapetype is properly set. The
shapetype specifies if the shapefile records have Z and M values. It
will be easy to tell if there is a problem with the shapefile or in
the code. Either way I'd like it to handle corrupt shapefiles as
gracefully as possible.

Sorry for the slow reply. I've been kind of busy this month.

- Joel

On Jul 14, 5:52 am, Jesus Cea <j...@jcea.es> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi, trying to use Spanish official shapefiles, with last versi n (trunk)
> j...@jcea.es -http://www.jcea.es/    _/_/    _/_/  _/_/    _/_/  _/_/
> jabber / xmpp:j...@jabber.org         _/_/    _/_/          _/_/_/_/_/
> .                              _/_/  _/_/    _/_/          _/_/  _/_/
> "Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
> "My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
> "El amor es poner tu felicidad en la felicidad de otro" - Leibniz
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
Reply all
Reply to author
Forward
0 new messages