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

learn more… | top users | synonyms

3
votes
2answers
768 views

How do I remove hyphen from field column

I want to use the Python field calculator to remove the hyphen from a field column. For example, I would like to parse out the hyphen from an entry like "123-45-6789" and read "123456789".
4
votes
1answer
876 views

How to write values from arcpy statistical output to table?

The attached script is my stalled attempt to perform the following workflow: Create a table and create fields Loop through a folder of point shapefiles and perform average nearest neighbor analysis ...
1
vote
1answer
496 views

ImportError: cannot import name QgsVectorFieldSymbolLayer

I am using QGIS 1.7.4., downloaded April 2012, but receive an import error loading the class QgsVectorFieldSymbolLayer. As i understand this class has been added in the Python bindings on 2011-11-15. ...
0
votes
1answer
174 views

How to code Data Driven Process using ArcPy?

I need to come up with a Python code to automate a map creation process but I am a little bit of lack of python knowledge. Any help would be much appreciated. My problem is that I have a 20 mxd file ...
2
votes
2answers
304 views

Is code completion available in QGIS Python Console?

I wanted to know if the autofill functionality is available in the python console for QGIS as the one available in ArcGIS Desktop's Python Console or am I supposed to hardcode it.
2
votes
1answer
80 views

remember QGIS instance

it would be absolutely great if someone could help me with the following problem: I have a simple Python-Plugin that starts another executable in a subprocess. From within this application (which ...
1
vote
1answer
128 views

arcpy.sa.CostDistance from Python gives error about number of args but executes fine through Toolbox

I am attemping to call arcpy.sa.CostDistance to calculate the cost distance to a source point as well as generate the optional Cost Back link raster: arcpy.sa.CostDistance("input", cost, "costDist", ...
1
vote
2answers
1k views

How to add field attribute values from line features to polygon features they pass through using Python?

I have a set of polygons and I want to add a field with the name of the streets (from another feature class of streets) that are within each polygon. Using Select Features by Location, I select ...
11
votes
2answers
3k views

How to split shapefile per feature in Python using GDAL?

is it possible to split a shapefile per feature in python? (best would be a solution where i can temporarily save the resulting vector objects to the memory instead to disk). The reason: I want to ...
1
vote
1answer
4k views

How to change the symbology of the layer with python script in ArcGIS ? [duplicate]

Possible Duplicate: Change Symbology of layers from within ArcMap I need to write a script to change the symbology of the layer. I've read all the topics about symbology in ArcGIS-help and ...
1
vote
0answers
247 views

How to update polygon field with point count for multiple rows? (Temporal point-in-polygon)

I have a shapefile with several regions. It contains basic info like ID, Code, Name1, Name2, etc. It is overlaid with a shapefile of points (nearly 200k). Each point represents an event with a type ...
3
votes
2answers
698 views

How to filter out multipart polygons and then buffer?

I've written a small script trying to accomplish the task described in the question title. It basically looks like: in_fc = '...' # Some shapefile goes here # Get the fields (column names) of the ...
5
votes
1answer
390 views

How do you fix Overlapping Lines?

I have a line dataset that contains some lines where the "end points" are actually found in the middle of the line. In the image below, the nodes are shown in green and one of the end points in red. ...
7
votes
1answer
483 views

Arcpy crashes in loop geoprocessing (general behaviour)

I have several standalone scripts that create a list of shapefiles to process (or coverages in one of the scripts). Sometimes my script crashes after it processes three files, sometimes ten, ...
4
votes
1answer
1k views

How to List field name aliases in ONE shapefile/layer using ArcPy?

I want to use arcpy/python to print out a list of all the field name aliases for a specified shapefile. So far I have been able to hack a script I found to list all the field name aliases associated ...
8
votes
1answer
178 views

The role of '#' in a python 'if':

I recently exported an ArcGIS model to python and was reviewing the script and am confused by the following line: if TRU_W_DatableFeatures == '#' or not TRU_W_DatableFeatures: I can't seem to find ...
5
votes
1answer
1k views

Dissolving specific polygons inside SearchCursor with Python in Arcmap

I have a layer with catchment polygons. For those that are smaller than a certain size, I want to merge with an adjoining polygon (namely the one downstream). In the attribute table I have a GridID, ...
5
votes
1answer
382 views

Error using con in Map Algebra in Python script

I am experiencing a painful problem in the middle of a Python script I am writing. When I get to a Map Algebra function, I have tried two different options and both return a different error. At first ...
3
votes
2answers
261 views

ArcGIS Calling Wrong fme.exe When Python Script Converted To An ArcGIS Script Tool

I'm using this this bit of code to execute a FME Workbench file through a Python script ... import os os.system("fme.exe P:\\Mapping\\Scripts\\FME\\Easements_ROW_Extract_From_CAD.fmw") However, ...
1
vote
0answers
95 views

Why does the method partCount in ArcGIS always give back a value of 1?

Does anyone knows why method "partCount" in arcgis version 10.0 always gives me back value 1, even when I have object with interniorring or multipart object? partnum = 0 partcount = feat.partCount ...
2
votes
1answer
114 views

How to get empty gdb using python

I have one gdb with lots of layer (~500) and to receive empty gdb I delete all records from layers. I Use deleterows / TruncateTable but for one layers take abaut 1-3 minuts. Is better way (faster) ...
2
votes
3answers
1k views

Creating new shapefile based on its attributes with python

I have a shapefile which has an attribute year. I used to generally copy and paste these features in the dataframe and then using the definition query just show polygons which were established before ...
4
votes
1answer
396 views

How to best organize files for a large arcpy script tool?

I am writing a lengthy arcpy tool and am working with multiple python scripts, simply for organization's sake. Everything runs well when I run it from the command line, but now that I am starting to ...
3
votes
0answers
471 views

Batch Converting ASCII into Feature Classes using shapefile lists [closed]

Problem. I have 413 ASCII files totalling 4 billion points, and my system cannot handle converting them to MULTIPOINT so that I can generate Terrains. Therefore I would like to create 12+ subsets of ...
5
votes
2answers
1k views

How to create a shapefile consisting of 2 lines using Python OGR?

How would you create a shapefile consisting of 2 lines using Python OGR? First line is no problem, but how do you reuse MyLine and Feature objects to create the second line? Ultimately this will ...
2
votes
1answer
478 views

arcpy.AddMessage and codepage problems

Some times in my tools I need to output Cyrillic text via arcpy.AddMessage function. Previously in 10.0 it was very easy. I had .py file of the tool saved in UTF8 codepage. This code wrote messages ...
9
votes
2answers
702 views

Can ArcGIS and OSGeo4W share the same python install?

I don't like unnecessary duplication. Is it possible to install python only once and have both ArcGIS and OSGeo4W use it?
5
votes
1answer
1k views

Python: find a method to calculate the “inner centroid” (also known as labelPoint in arcmap) of a polygon

i am looking for a method to compute the X,Y coordinate of a inner point (also known as labelPoint in arcmap) of a (irregular) polygon. I am try to find a solution without the use of ArcGIS module ...
11
votes
1answer
316 views

How to use GDAL with PyPy?

I am trying to optimize my python code using pypy. While I am able to import most libraries and run succesfully, I am not able to import GDAL libraries. The same libraries when imported in Python 2.7 ...
5
votes
1answer
134 views

Where do I append point values with pyshp?

I would like to generate a .shp with five points using shapefile available through pyshp. However, when I loop through my list I get only the last value. This makes sense as I did not append any of ...
4
votes
1answer
224 views

How to set page size in Arcpy?

It is possible to set Page size in arcpy, i'm looking for any tricky way to set the page size, using pure python or Arcpy. Thanks in advance
3
votes
1answer
620 views

How to hide/show QGisVectorLayer from Python code?

Once created a layer, how can I hide/show it? I can enable/disable rendering of a specific layer by selecting the checkbox through QGIS, but I need to do it programmatically from python code. How can ...
3
votes
3answers
609 views

How to make Field Value constant size(length) by appending zeros towards the end?

I have been racking my brain, but I can't seem to find a solution to appending my field values in my .dbf to correspond with the values of my feature's attribute table. All I need to do is to append ...
0
votes
0answers
155 views

Can I do full SQL expressions through the “WHERE” clause in UpdateCursor?

Run as a standalone python script for a shapefile in a toolbox on ArcMap. For example: psql_url_pop = '''SELECT shapefile.NAME_# + shapefile.WIKI_URL FROM public.shapefile''' rows = ...
2
votes
1answer
374 views

How do I select * rows of multiple columns in one query using Select by Attributes within ArcMap?

I am trying to convert a psql query string into arcpy formatting for an UpdateCursor where expression parameter: '''SELECT ...
5
votes
1answer
6k views

How to access data from a selected feature in ArcGIS 10?

First to describe my problem as I see it. I've been asked to design a tool that will take a selected features attributes and copy it out to an output table, with each successive selection and ...
1
vote
0answers
444 views

How do I find the pgAdmin connection parameters?

I need to create a connection from arcmap to pgadmin using a python module because of an arcpy script, but I am unsure of how to get the pgadmin connection parameters. I think it may be some kind of ...
2
votes
1answer
1k views

How to change the datasource with python?

How do I change the datasource of all layers in a map document using arcpy and python
3
votes
1answer
2k views

Unable to change data source path for group layer file

I am having some difficulty changing the data source for a group layer. Below is the code that I am using. It processes a LYR file successfully that has a single data source but if LYR file has more ...
7
votes
3answers
2k views

GDAL and Python: How to get coordinates for all cells having a specific value?

I've got an Arc/Info Binary Grid---specifically, an ArcGIS flow accumulation raster---and I'd like to identify all cells having a specific value (or in a range of values). Ultimately, I'd like a ...
1
vote
1answer
483 views

Merging OD Cost Distance Matrix result (ArcGIS 10 Network Analyst)

I've created small python script that calculates OD matrix between certain locations, i.e. not between each origin and destination but for each origin I have a set of destinations that I want to ...
6
votes
3answers
662 views

How to extract area programmatically?

is there a possibility to extract the area covered by one geometry of a shapefile (polygon)? I tried with thepoly.area() but get "nan" as result. Ok. I think you are right and there is ...
3
votes
2answers
185 views

Where can I get public transportation route information for USA?

I'm trying to find a list of public transit route information, mainly location of bus and train stops for the US. I've looked around at some of the Google products and openstreetmap but can't find ...
3
votes
2answers
196 views

How can I create a portable script for coordinate conversions to run from USB?

I would like to be able to convert Lat long values in wgs84 to the swedish RT90, the values are in CSV files under headings X and Y. I would like to have this portable, an eg runned in a script in ...
2
votes
3answers
2k views

Does ArcGIS 10 have a Geoprocessor Programming Model by using Arcpy?

Does ArcGIS 10 have a Geoprocessor Programming Model by using Arcpy? is it possible to use ArcGIS 9.3 Geoprocessor Programming Model within ArcGIS 10?
1
vote
0answers
270 views

How does QGIS execute Python plugins?

I am trying to run a python script from within a python plugin. The script runs a CGIHTTPServer in a separate thread. It works as expected when executed from the command line and i can issue requests ...
2
votes
2answers
555 views

How to import qgis.core to python IDLE?

I try to follow the step in How to import qgis.core to python app? to import qgis.core with Python Shell. But when I type set PYTHONPATH=C:\Program Files (x86)\Quantum GIS Wroclaw\apps\qgis\bin it ...
2
votes
2answers
884 views

How do you create a button in ArcGIS and have it run code?

I'm brand new to ArcGIS and have only a year or two of programming experience. I know Java and a little C#. I have a Java app that processes geographical data. I need to have a button in ArcMap that, ...
1
vote
1answer
143 views

How to select and update from multiple tables?

I have two feature classes which have common Valve ID #s. One table has multiple service connections with a unique number. I need to select all services linked to each valve and collect the ...
3
votes
0answers
204 views

How to merge SeaWiFS and MODIS data or use other merged products?

I hope to produce a time-series for sea surface temperature (SST) and chlorophyll-a (Chl-a) for use in MaxEnt without the use of arcgis, preferring Python tools to others. I am new to satellite data ...