ESRI seems to yank any python scripts that don't use the arcgisscripting
module. I had a nice python script for generating contiguous cartograms that
only relied on OGR on ArcScripts and it was taken down. It might have been
because I actually included gdal.dll in the ZIP file - but I think it's
because I didn't use their programming model. I actually have a version of
the code that uses arcgisscripting, but it's much slower. First, the license
checks that occur with you execute "import arcgisscripting" take longer than
the entire process using OGR. Second, arcgisscripting imposes a cursor model
on all operations to iterate through features without decent buffering.

Finally, in the world of programming, ESRI wants to restrict Python to just
a "glue" language to automate the geoprocessing methods in the ArcToolbox
(sort of like their old Avenue language). To really work with their data
models, you have to use a COM language like VB.NET. This sucks because you
can't directly work with things like their geometric network models in
Python. I know, there's IronPython, but that seems like even more layers
upon layers.

I wish ESRI would accept Python as a "real" language. I'd be more likely to
use their tools!

-Eric

-=--=---=----=----=---=--=-=--=---=----=---=--=-=-
Eric B. Wolf                    New! 720-334-7734
USGS Geographer
Center of Excellence in GIScience
PhD Student
CU-Boulder - Geography

GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt


On Mon, Feb 8, 2010 at 3:11 AM, gene <[email protected]> wrote:

> I have examined some Python scripts on the Arcscripts site and they
> seem horribly complicated. For example the script "Convert Files GPS
> (KML, GPX) to Shapefiles"  (http://arcscripts.esri.com/details.asp?
> dbid=16797) requires 117 lines of code to extract the placemarks and
> geometries of a kml file without using any standard module to read
> xml.
> I think they misrepresent python using only:
> "import arcgisscripting"
>
> I sent the following email based on a sample of keytree by Sean
> Gillies
> "when you read a kml file, why not use the standard modules?
> 1) to find Placemarks in kml files:
> from xml.etree import ElementTree
> tree = ElementTree.parse(open('your.kml', 'rb'))
> kmlns = tree.getroot().tag.split('}')[0][1:]
> placemarks = tree.findall('*/{%s}Placemark' % kmlns)
>  and you have all the placemarks
> 2) using keytree and shapely gives you the geometry
> p0 = placemarks[0]
> import keytree
> f = keytree.feature(p0)
> from shapely.geometry import asShape
> shape = asShape(f.geometry)
> shape.wkt
> exemple of results:
> 'POINT (21.9725000000000001 32.8962999999999965)'"
>

Reply via email to