Mapscript - Perl - Query - shapeObj
Aaron Craig
mercutio at POBOX.COM
Tue Jan 18 09:09:09 PST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thank you. That's it. I was opening the layer in the wrong spot.
Sean Gillies wrote:
|
| Aaron,
|
| Here is the canonical query example (in Python) for version 4.4:
|
| layer.query() # queryByRect or *Shape or *Attributes
|
| results = layer.getResults()
|
| if results:
|
| # open layer in preparation of reading shapes
| layer.open()
|
| for i in range(results.numresults):
| r = results.getResult(i)
| feature = layer.getFeature(r.shapeindex, r.tileindex)
|
| # Iterate over feature attributes
| for j in range(layer.numitems):
|
| att_name = layer.getItem(j)
| att_val = feature.getValue(j)
|
| print att_name, att_val
|
| # Close when done
| layer.close()
|
- --
Aaron Craig
mercutio at pobox.com
===========================================================
Get Firefox!
http://www.spreadfirefox.com/?q=affiliates&id=0&t=1
===========================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB7UK1oyEQRcU83p4RApk3AJ9WUiDJxONul9xHXE6p8XLyFLGZVQCeJkbK
E2w7RE94z+SUSSx1IHMY9lg=
=wIte
-----END PGP SIGNATURE-----
More information about the MapServer-users
mailing list