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

learn more… | top users | synonyms

11
votes
1answer
322 views

Python increasing the filesize of my .mxd

I have a geoprocessing script that runs the following.. arcpy.AddMessage("TEST...") Yes just one line of code. A blank .mxd starts at 391kb for me as I run my script and save the filesize ...
4
votes
3answers
903 views

Using threading module with Arcpy: Manager/Worker architecture

I asked this question on Stack Overflow on how to setup a manager/worker scenario. But I am getting some error when trying to use threading on my Python install with ArcGIS 10 (just the python ...
1
vote
1answer
568 views

rpy2 installation on Mac OSX

I'm desperatly trying and retrying to install rpy2 on my Mac OS 10.6 in order to run SDA4PP plugin on QGIS. My version of R is 2.14.0 and it was obviously compiled with the option --enable-R-shlib ...
1
vote
1answer
686 views

Applying layer file not formating labels in ARCGIS 10

I'm applying layer files in ARCGIS 10 using the ApplySymbologyFromLayer_management command via a python script tool. The symbology part works fine but the lables are not formatting. It is my ...
5
votes
2answers
2k views

How to return individual address components (city, state, etc.) from GeoPy geocoder?

I'm using GeoPy to geocode addresses to lat,lng. I would also like to extract the itemized address components (street, city, state, zip) for each address. GeoPy returns a string with the address -- ...
1
vote
2answers
902 views

ArcGIS problem accessing fields attribute table

I encounter a strange problem. I have a simple shape file to which I added some fields and then populated them. Now I wanna access those fields from a script to run some buffer operations. I wanna ...
5
votes
1answer
648 views

Raster processing with Python or Arc raster calculator

I have 4-band NAIP imagery that require the following processing steps: Convert to 8 bit unsigned B/W Reverse (note not inverse) the image, so that dark values appear light and light values appear ...
3
votes
1answer
415 views

Creating a Raster Filter

I am looking to create a raster filter which reclassifies single or contiguous pixels less than, for example, 30 pixels (shown in white below) into another class (shown in black). The filter, ...
7
votes
1answer
2k views

How to get GDAL to create statistics for GTiff in Python

I regularly create my own GeoTIFF rasters with GDAL in Python, e.g.: from osgeo import gdal from numpy import random data = random.uniform(0, 10, (300, 200)) driver = gdal.GetDriverByName('GTiff') ds ...
5
votes
1answer
1k views

Reset local memory in ArcMap 10

I often am unable to delete files due to a lock or need to reset the data frame coordinate system. Very often starting a new session of Arc will allow certain geoprocessing or data management tasks ...
3
votes
1answer
636 views

Looping based on a spreasheet using python (in ArcGIS 9.3)

Here's what I am trying to do: I want to move feature classes from one .gdb (OLD) to another (NEW), but only the feature classes that are present in an excel spreadsheet. read from excel spreasheet ...
7
votes
3answers
2k views

Python script - how to avoid exclusive schema lock error?

I have a script for updating some features on my database every night (just for copying and replacing some features). This features are "read-only". My problem is that I can't avoid that these ...
4
votes
1answer
2k views

If statement in ModelBuilder to check if field exists

I'm trying to create the following in ModelBuilder: Set input feature class if field1 exists execute the processes in branch1 else add field1 execute the processes in branch2 ...
4
votes
1answer
269 views

Counting and Storing Event Data Contained Within a Polygon (Using Python)

I have a fairly large project and I would like to automate some tasks using Python. Problem is, I don’t have any experience with Python for ArcGIS. And I rarely use ArcGIS until something big like ...
2
votes
1answer
1k views

Add AutoCAD .dwg annotation file to Arcmap using python (Same as +ADD Data button)

I would like to add an AutoCad .dwg file to Arcmap using python the same way that the +ADD Data button does. I can add an Annotation layer with python but only as a feature layer not as an annotation ...
1
vote
2answers
493 views

Need help getting started with QgsComposition

I am using QgsComposition for the first time, but I fail at the first step :-( mapRenderer = iface.mapCanvas().mapRenderer() line 31, in mapRenderer = iface.mapCanvas().mapRenderer() ...
2
votes
1answer
373 views

How to create new layer within a DXF file?

Using OGR in Python, I'd like to create some geometries within a DXF file, but not in the "0" layer, but in new ones. I tried with: import ogr, os, osr, sys ds = ...
14
votes
3answers
633 views

Ecological geospatial conundrum

I am looking for a different, more elegant solution to a spatial statistics problem. Raw data consists of an x-y coordinate for each individual tree (i.e. converted to a point .shp file). Although ...
13
votes
3answers
5k views

Clipping raster with vector layer using GDAL

I have installed GDAL using the Osgeo installer. How can I clip a raster layer with a vector layer programmatically? Is there any GDAL API available which can help me with this? I am using Python.
1
vote
0answers
25 views

How to rotate multiple polygons about their respective anchor points [duplicate]

Possible Duplicate: Rotate a feature in ArcGIS 10 I have a set of polygons, which are to be rotated in eight directions, about their respective fixed anchor points. I am able to do so for ...
22
votes
5answers
2k views

OpenSource Remote Sensing Tools for Classifying Roofs

with envi image processing and classification tools, you can get roofs from images with some spectral value and then you can convert it some vector data for your app. in python with OpenCV which have ...
4
votes
2answers
523 views

Select polygons contained inside a polygon and assign ID

I have a polygon feature class Base_FC, where each poly has a unique alphanumeric ID. My second polygon feature class Type_FC has the details for the various polygons which would fall inside Base_FC ...
4
votes
1answer
381 views

automating forest cover calculations with Python

I have a layer of forest cover comprising ~ 30,000 individual forest patches, and I need to calculate the amount of forest cover within a 5 km buffer of each patch. The buffers all overlap each other, ...
8
votes
4answers
2k views

Best way to find the polygons crossed by a line

I'm trying to find all the polygons crossed by a single line (a GPS track). I'm using the OGR library (from python) for computing this, but it's currently a bit 'brute-force' (and slow). For every ...
7
votes
1answer
208 views

Optimize GEOSGeometry's spatial operations by avoiding thread-safety checks

A ranking algorithm I'm developing for a Django webapp requires performing spatial operations (within, intersections, sym_difference, etc.) using a query against large number of geometry objects. ...
4
votes
1answer
262 views

geodjango slowness and debugging

I'm using geodjango + postgres to display polygons from tigerline on a map. Pretty simple stuff so far. My issue is that when I use the GPolygon object: django.contrib.gis.maps.google.GPolygon there ...
3
votes
2answers
261 views

Where to install python plugins without internet access?

I have a problem where I have no internet access. In the thread regarding a similar subject, it was mentioned that the plugin .zip file should be extracted to the ".qgis/python/plugins" in the home ...
4
votes
1answer
1k views

Move .SHP from .MXD to gdb [duplicate]

Possible Duplicate: How to move SHP to gdb with ArcView license? Let's cut it short, I have numerous mxd with layer coming from .SHP and various servers WMS that I need to move to a gdb. ...
1
vote
2answers
1k views

How to access vector coordinates in GRASS GIS from python?

Is there a way to iterate over lines and their vertices using python? I'm new to GRASS GIS, and it looks like there are ways to read raster (for numpy), but I don't see a direct way to access ...
3
votes
1answer
319 views

Batch Sum Fields Script

I have created a python script that batch summarizes all string fields within a fc table based on the concatenation of two fields. The script loops through a list of the fields, however it stops ...
15
votes
6answers
5k views

ArcMap 10.0 Python Field Calculator, Find/Replace Double Quotes

I'm trying to use the Field Calculator (ArcMap (10)) to strip out double quotes in an address field (I didn't put them in there, believe me). I've tried many incantations but am still unable to even ...
1
vote
2answers
144 views

“AttributeError: getZ” error when trying to get the elevation of DXF linestrings

I'm using Python and OGR to extract the elevation of lines within a DXF file. import ogr driver = ogr.GetDriverByName('DXF') datasource = driver.Open('test1.dxf', 0) layers=datasource.ExecuteSQL( ...
4
votes
1answer
1k views

OGR and DXF files: Is it possible to handle layer names? (only “entities”)

I'm using Python and OGR to extract the layers of a DXF file and convert them into SHP. I began with: import ogr, os, sys driver = ogr.GetDriverByName('DXF') datasource = driver.Open('test1.dxf', 0) ...
1
vote
0answers
198 views

Geographic limit to overlay analysis in geoprocessing service

Function: I've created a geoprocessing service that serves a toolbox containing a custom python tool. This python tool selects a polygon and buffers it by 1 mile. This buffer is then used to ...
5
votes
2answers
1k views

Run FME workspace using python

I'm trying to run a second workspace using python command in "Shutdown Python Script" in the first workspace using the following command. But its giving me an error. Is there anything I need to do ...
3
votes
1answer
217 views

Create Array From Selected Features Based on the Order in Which They Were Selected

I need to create an array of features from a selection based on the order in which they were selected. As in: I select feature 5,2,3,4. I need to have an array so I can apply attributes (with python) ...
1
vote
1answer
1k views

How can I create a custom form to display the attributes of the selected object?

I have already appealed to the selected objects, and found a way how to put them in a MsgBox. But I need to output was in the form
2
votes
1answer
238 views

How can i include program form (created in Designer ) to my QGIS plugin?

How can I include a form created in Designer in my QGIS plugin? And how to get controls values (textbox,label,etc)?
2
votes
1answer
769 views

Changing the name of layer using python

I am attempting to change the name of the layer. The following code changes the name of the layer but then removes the layer from the map, and I am not sure why. Note: I don't have any remove layer ...
1
vote
3answers
835 views

Update shapefile data source with wildcard using python

I am attempting to update a layer's data source in Arcmap using python for lyr in arcpy.mapping.ListLayers(mxd, "*", df): if lyr.name == "project_whl": ...
3
votes
1answer
1k views

How can I add button to the QGIS toolbox or create my own toolbox?

I want to create a button and add it to the QGIS toolbox or alternatively create my own toolbox and add the button here. A plugin should be started when the user clicks the button.
2
votes
1answer
1k views

Outputting results message from spatial statistics tool to text file using python

I'm using the following tool in ArcGIS 10 - Calculate Distance Band from Neighbor Count (Spatial Statistics). I'm using a python script to execute this tool several times on different shapefiles: ...
2
votes
2answers
837 views

Unable to create shapefile using shapefile.py

I am trying to create shapefile from csv data using shapefile.py but i am constantly getting this error, Traceback (most recent call last): File "createShp_Davis.py", line 31, in <module> ...
2
votes
0answers
465 views

Add CAD Drawing Dataset into ArcMap using Python

I am trying to add an CAD Drawing Dataset into ArcMap using Python. Question is how to add a Auto-CAD .dwg file to ArcMap using Python Normally comes in as CAD file within a Group layer with: ...
4
votes
3answers
327 views

arcgis10 filter dataset

Using ArcGIS 10 SP-4 I have a large dataset of sites that needs to be filtered down to a usable size. There is an attribute for the site_ID and another one for the site_type. There are duplicate ...
10
votes
2answers
1k views

How to compute a new attribute based on changes in another attribute?

I am attempting to classify a set of gps time-encoded point data into behaviors based on different attributes. I have created an attribute that is 0 for home and 1 for away based on location, and now ...
2
votes
1answer
704 views

Adding Layer in current session using ARCPY

I wanted to add a layer through the toolbox using arcpy. The below script works fine through the python console in ArcMap, but does not when executed through the toolbox. The layer flashes for a ...
8
votes
4answers
274 views

Subset Folder Contents ArcPy

I have about 1500 .txt files within a folder named 3410001ne => 3809962sw. I need to subset about 470 of these files to process with a Python script. Below is the section of code prior to my for ...
3
votes
1answer
693 views

Changing attribute data types using PyQGIS

OK, so I've already asked a question how to access attribute data types when developing plugin for QGIS, using PyQGIS. And one helpful member said i should use pendingFields() method on the current ...
5
votes
2answers
1k views

How to find wildcard string using Field Calculator script code?

I'm trying to find part of a text string in the CLASS_NAME field and return a text string to the Abrv_Name field using the Field Calculator in ArcGIS 10 via a Python parser. Here is what I have tried ...