Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

2
votes
2answers
466 views

Using osgeo modules in ArcGIS10.1 and QGIS 1.8 python shells

This is related to an old question of mine - Issues with osgeo - qgis.core and arcpy modules Now in new versions of all the software QGIS Lisboa (1.8), ArcGIS 10.1 and pyScripter 2.5.3. They all use ...
1
vote
0answers
58 views

How to clip Raster using multiple polygons and Python? [duplicate]

Possible Duplicate: clipping a raster by multiple datasets or polygons I have polygon layer and DEM and I want to write a program using python to cut the raster into multi-raster based on ...
5
votes
2answers
1k views

Why does this simple Python OGR code create an empty polygon?

Please excuse my ignorance...I am new to Python OGR. I am trying to create a simple square polygon and fail...this produces an empty polygon. Where did I go wrong? from osgeo import ogr driver = ...
2
votes
1answer
1k views

GRASS Geoprocessing in Python Script

I´m trying to get some GRASS geoprocessig tools running in a python script outside GRASS. I´m able to import grass.script, but I´m not able to get the tools running yet. Does anybody know what I´m ...
2
votes
1answer
131 views

How to get a list of all projections that are currently available in QGIS via the PyQGIS-API

i'm building a QGIS-Plugin and i want the user to choose a CRS out of a combobox in which the coordinates he would enter into some textfields are represented, so these can be converted into another ...
2
votes
1answer
357 views

Can you script publishing a GP service?

I have a geoprocessing service in ArcGIS for Server 10.1. I would like to share this service with a number of external organisations that also have ArcGIS Server 10.1. i.e I dont want them hitting ...
-4
votes
1answer
1k views

How to script a csv to file geodatabase tool?

I have many separate field data files in CSV format and I wish to automatically convert these CSV files into a geodatabase to be able to load them into a schema I created for them in my new ArcSDE ...
3
votes
1answer
962 views

Import functions in python Add-In logic script

I am running into an error. I have a set of functions which I want to import in the python Add-In script at the time of execution, but when I built Add-In with "import stats" line then tools are ...
1
vote
0answers
34 views

Script for populating field in ArcGIS 10 with consecutive numbers (where start numbers is decided by me) [duplicate]

Possible Duplicate: How to add automate values to attribute field? I need a script (for Arc GIS 10) by which I can populate a field against some selected polygons features. For instance, i ...
0
votes
0answers
189 views

using mapnik xml file to render tiles in python

Is it possible to use an xml file in python? without using the bindings for python for mapnik. basically i'm using django/geodjango, postgis and well i decided i'd try and design the map on tilemill ...
4
votes
3answers
1k views

Python OGR: convert a point geometry into polygon

I'm writing a routine for creating the convex hull envelop around shapefiles of islands. I could read the data, extract polygons vertices into a geometry and then compute the convex hull. Now I need ...
1
vote
2answers
205 views

What is the best quick way to populate a field (in ArcGIS 10)? (for rare language/font e.g. Guzrati numerals)

I have polygons generated from shapefile (esri) format I have a tiff image of plot/parcel map(this tiff has plot id scribed in somewhat consecutive in manner) of that polygon feature. I would ...
4
votes
2answers
537 views

Randomly select a record to update using arcpy.da.UpdateCursor

This question is related to my question here. What I would like to do is use a cursor with a where clause to select a number of records. For each row, the values in two fields, TYPE_A and TYPE_B ...
2
votes
1answer
70 views

Python code for locking elements in Layout view

Is it possible to lock elements in layout view in Python? I know it is possible in the production cartography extension from ESRI but all I need is the funcionality to lock elements. I am wondering if ...
0
votes
1answer
77 views

How to use a property of a different interface for a created ArcObject

I have created an arc based three points (from point, through point, and to point). To create the arc I used this code: import arcpy, comtypes.client import comtypes.client.CreateObject as ...
3
votes
1answer
191 views

Beginning Arcpy: Asking for a quick review of my script

I cobbled this code together from ESRI documentation and stackexchange answers. I tried to use SearchCursor(points, fields=fieldname) but I get this error: TypeError: SearchCursor() got an ...
5
votes
2answers
1k views

How to implement bivariate Ripley's K function in ArcGIS 10?

The attached image shows a forest gap with red pine represented as circles and white pine represented as crosses. I am interested in determining if there is a positive or negative association between ...
9
votes
3answers
3k views

Get all vertices of a polygon using OGR and Python

I'm having a little trouble with the Python OGR API. What I am trying to do is get all the coordinates of each vertex of the outer ring of a polygon. This is what I have so far: import osgeo.ogr ...
4
votes
1answer
418 views

Arcgis: Programmatically export to geotiff in different scales

I am totally new to ArcGis so please bear with me using the wrong terminology. I would like to programatically export geotiff files in different scales (e.g. 1:25000, 1:50000 etc) using arcgis10. ...
0
votes
1answer
211 views

ArcGIS 10.0 Running Python function CADToGeodatabase() crashes ArcMap/ArcCatalog

My code: import arcpy, csv from arcpy import env dgnfile = str(arcpy.GetParameterAsText(0)) outFeatureClass = str(arcpy.GetParameterAsText(1)) #the fc in my fgdb template to be ...
0
votes
0answers
12 views

Arc 10.0 Running Python function CADToGeodatabase() crashes ArcMap/Catalog contd [duplicate]

Possible Duplicate: ArcGIS 10.0 Running Python function CADToGeodatabase() crashes ArcMap/ArcCatalog Sorry, no room to put all this in the coments window - tried putting this in Answer but ...
5
votes
2answers
594 views

Correct usage of a counter using arcpy.da.UpdateCursor

In the Python code inside a Calculate Value tool in my model, I have the following: getNum("%Selected Features%") def getNum(ftr): lst = [4, 11, 15] #values for SQL expression x = 20 fields ...
0
votes
0answers
649 views

Python package for Google Maps API v3?

I am looking for a Python package that can generate the JavaScript to display Google Maps API v3. I would like to integrate such package into a django website. I know pymaps exists but it's for ...
1
vote
1answer
778 views

How do I copy all feature attributes to a feature in a new layer?

I'm trying to create a new layer in QGIS based on an existing layer. The new features should have all the attributes of the corresponding features in the original layer. I've been trying to use ...
3
votes
2answers
653 views

Can python read the value of a cell in a spreadsheet? [closed]

Can python read the value of a cell in a spreadsheet? The simplest example would be a script that ran a buffer tool on a given shapefile. For the distance parameter, instead of just using a number ...
2
votes
1answer
442 views

Setting parameters in Arcmap for dynamic python script

I have a simple python script that works when run from PythonWin, but when I try to make it dynamic to run inside ArcMap I keep receiving: : ERROR 999999: Error executing function. Failed to execute ...
1
vote
1answer
158 views

cannot print listRasters

I'm trying to run this very simple script to check a problem in another more comlpex one. import arcpy arcpy.env.workspace= 'C:\\Users\\Umberto\\Desktop\\Prove_Script\\Karakoram\\temporary_01' rst= ...
2
votes
2answers
687 views

Updating polygon geometry: deleting inner rings with python

I've searched, but can't find clear explanations how can I simply delete inner rings from existing polygons with python or extract outter rings and overwrite the geometry. Seems GDAL/OGR should be the ...
4
votes
3answers
403 views

Is there anything faster than a cursor in ArcGIS to calculate records?

What is the most efficient (fastest) way to calculate records in a layer in ArcGIS? Is there anything faster than the Cursor in ArcGIS?
4
votes
1answer
867 views

How to import DGN geometry into a file geodatabase?

Specifically, I have an empty File GeoDatabase template consisting of several Group Layers, each containing several Feature Classes. In fact each FC has several subtypes exposed by including a .lyr ...
2
votes
2answers
530 views

The name contains invalid characters

I'm having a problem with the following script. When listing parameters that are optional I've used the "" before, so I can't figure out why this isn't working. import arcpy import os ...
4
votes
1answer
156 views

convert a dbf into a raster image using python? work around for arcpy

ArcGIS' arcpy does not have a function to add a table to a layout. I was thinking that maybe taking that table (e.g. a dbf), there may be some python script command to turn it into a raster (e.g. do ...
1
vote
1answer
276 views

How to add multiple rasters to a layer file?

I'm trying to make a .lyr file to bring into ArcMap with arcpy.mapping. I can bring a single raster into a .lyr with the script below. I'm unsure how to proceed to get multiple rasters from the same ...
2
votes
2answers
331 views

arcpy.mapping.AddLayer invisible layer

I'm having a bit of a problem with a script on a particular machine. ========================================================== import arcpy,sys class AddLayer(object): ''' classdocs ...
2
votes
2answers
164 views

How to sort a field according to value range?

I have to check an attribute table field (MY ID NO) of polygon feature against a tiff image of parcel map where fields are written as 12-58,65,87,2565-89999,58648. Example: Parcel map tiff(image) ...
4
votes
1answer
788 views

Python console vs Toolbox script in ArcGIS

My question is similar to this post: Adding Layer in current session using ARCPY . My script works in ArcMap python console but not as a script in toolbox.I am running ArcGIS 10.0 SP4. The script is ...
2
votes
4answers
557 views

Error When Trying to Run Slope Analysis Script

I have written a script which is supposed to loop through all the rasters in a folder and perform a slope analysis on each raster and save the results in another folder. I keep getting the following ...
3
votes
1answer
186 views

How to use the QgsDiagramRendererV2?

I'm writing a plugin for QGIS in python in the QGIS API doc, I can see the QgsDiagramRendererV2 class, under the qgs.core section http://www.qgis.org/api/classQgsDiagramRendererV2.html What I'm ...
1
vote
0answers
175 views

Table record counts change when using python tool

I have a python tool which investigates mxd files and clips/projects and exports all visible datasets. Recently I've found that the record counts (even on non-clipped data) is different. It's ok if I ...
6
votes
1answer
718 views

How to call GRASS modules in pyQGIS?

I wish to use a Grass module (v.to.db) in QGis, without the grass toolbox. I tried with the Python console, but to no avail : Using Sextante plugin but obviously it didn't know all the grass ...
2
votes
1answer
482 views

Python: Run script when opening an MXD in ArcGIS 10

This post is related to Run a Python Script when opening an MXD? I would like a python script to run every time a .mxd is opened. However, the link above uses VBA to do it, which ESRI suggests ...
-3
votes
1answer
266 views

How to calculate altitude with given lat,long position?

I'm new to GIS. I want to calculate the elevation of any point on earth giving lat, Long (for example like google elevation Api, or the earth tools: http://www.earthtools.org/webservices.htm # ...
4
votes
3answers
2k views

Why does arcpy.ImportToolbox() not work in ArcGIS 10 (SP5) when calling custom model for topology?

I have an arcpy/python script using ArcGIS10 and using a custom toolbox and model. The toolbox has an alias of defaultTopo and my model within the toolbox is called AddRuleToTopologyModel. This model ...
4
votes
1answer
1k views

How to create polyline of varying distance from origin point using azimuth?

I am looking for a Python script that does the following: Uses a point (from a point shapefile) as the origin. Creates about 3 km line from point Based on an azimuth provided in the original point ...
6
votes
1answer
533 views

pyproj, proj4 doesn't return same coordinates after inverse conversion

I'm trying to interpolate between coordinates, as a step in that process I convert latlong to UTM so I can work in metric. I don't get the expected latlong when converting back, reproduced below: ...
6
votes
2answers
266 views

Python scripting- compute statistics

I'm new to Python but I've heard is a good way to automate tasks. I have thousands of point shapefiles and need to extract the maximum value of each one and put them in a new table. I'll appreciate ...
4
votes
1answer
61 views

How to deliver an additional Python Library with own Plugin?

For my own plugin I need a special library (pyexiv2) to write a comment into a jpg file (PIL does not do that). When I want to share my plugin in one of the repositories in the future, what would be a ...
2
votes
1answer
209 views

ArcGIS Desktop's registry value under “software” key[CLOSE] [duplicate]

Possible Duplicate: How can I programmatically get the path of “Python.exe” used by ArcMap I am trying to get some information from registry about ArcGIS. I am using ArcGIS Desktop 10.0 and ...
10
votes
1answer
1k views

Is it possible to take automatically a “screenshot” of my selected feature in QGIS using Python?

I am implementing a tool which allows the user to create a profile of a feature (in my case urban parcels). Is it possible to automatically take a screenshot of this feature (displayed in a QGIS ...
0
votes
2answers
711 views

Python module “shapely.wkb” missing

I am trying to follow a tutorial from here http://qgistips.spatialthoughts.com/2012/12/find-neighbor-polygons-in-layer-in-qgis.html#more I have downloaded the relevant python script and edited it as ...