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

learn more… | top users | synonyms

4
votes
1answer
686 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, majority ...
3
votes
3answers
1k views

Add date to feature class name?

I still working on my big project, big at least for me, but I am currently stuck on this: I have a lots of .shp, that I want to move to a gdb. While creating a feature class, I want to add date ...
7
votes
1answer
2k 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 ...
18
votes
12answers
21k views

Python GDAL package missing header file when installing via pip

I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too. I'm trying to install gdal from pip pip install gdal inside a ...
9
votes
4answers
4k 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
3k 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 ...
9
votes
1answer
953 views

Arcmap Select by Attribute with Python

I would like the following to select (highlight) the "project" layer that intersects the grid, and then pull a record from the selected "Grid". I do not need to save the layer. Note: Running the ...
5
votes
0answers
215 views

How to rotate polygon to find best fit in Mapnik? [closed]

I have a quite simple problem but somehow I just fail to solve it. There is a polygon and a range xsize and ysize. The x and y size determines the mapnik generated image. The polygon should now be ...
3
votes
1answer
886 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 ...
5
votes
1answer
917 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 ...
1
vote
2answers
824 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
494 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 = ...
0
votes
0answers
186 views

Export Data Driven Pages extents to Kmz

Is it possible to export the extents of DDP to KMZ using arcpy - Map to KML (Conversion)? Alternatively can we export each extent of a single DDP extent to a new mxd and then run arcpy.MapToKML_3d on ...
1
vote
1answer
81 views

Is there a way to access ps.map in python?

i am wondering whether its possible using python interface to load layers and edit them in Print/Cartographic Composer without displaying, and finally export to PDF? something that can be done via ...
-2
votes
1answer
471 views

Converting python plugins into dll file for QGIS application? [closed]

How to convert the python plugins into dll files for QGIS application?
1
vote
0answers
26 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 ...
6
votes
2answers
607 views

Using rpy2 in ArcGIS

I have a 3rd party python geoprocessing script that requires rpy2, and thus also r. What is the best way to get these working together? Using R with ArcGIS Desktop says the most useful option for ...
12
votes
1answer
390 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 ...
3
votes
2answers
454 views

Invoke PostGIS functions outside of the database? Need to force 3D in GeoDjango

I'm looking to ensure that all geometries saved to the database are three-dimensional. It's easy enough to do with a call to the database, select ST_Force_3D( ST_GeomFromText( blah blah ) ) ...but ...
4
votes
2answers
334 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 ...
11
votes
2answers
3k views

Methods for optimizing multcore processing in ArcGIS

I am interested in learning methods to utilize the full extent of multicore processing power available on a desktop computer. Arc states that background geoprocessing allows the user to utilize ...
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 ...
4
votes
1answer
350 views

Batch Sum Fields Script using ArcPy?

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 ...
3
votes
1answer
936 views

qgis.core import error

I would want to use the Qgis api for custom desktop application. When I imported the qgis.core module, I get the following error >>> import qgis.core Traceback (most recent call last): ...
1
vote
2answers
176 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
2answers
3k views

Problem loading vector layer (pyQGIS)

I've installed the qgis on ubuntu 12.04 following the instructions on http://hub.qgis.org/projects/quantum-gis/wiki/Download. I am trying to test the Python API and try to do the follwoing from ...
14
votes
3answers
772 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 ...
4
votes
1answer
2k 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) ...
3
votes
3answers
2k 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 ...
0
votes
2answers
250 views

Is there any method to create monthly LST images?

Is there a method to create monthly LST images from combining MOD11A2(8days) product? The MOD11C3 product which is delivered monthly has larger spatial resolution than MOD11A2. Im trying to create a ...
3
votes
1answer
244 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
3answers
1k 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": ...
2
votes
1answer
298 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)?
7
votes
1answer
3k views

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

I want to create a button and add it to the QGIS toolbar or alternatively create my own toolbar and add the button here. A plugin should be started when the user clicks the button.
2
votes
2answers
1k 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> ...
1
vote
0answers
225 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 ...
2
votes
0answers
672 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
1answer
624 views

Trouble Tabulate Area

I am using Kansas Cropland raster data from NASS with tabulate area to find out acreage of different crop types. The python I used works fine for 2006-2009 (56 meter cell size), except 2010 & ...
5
votes
2answers
2k 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 ...
5
votes
3answers
4k views

How can I specify the CRS of a raster layer in pyqgis?

I manipulating netcdf raster data from the QGIS python console. The metadata of my netcdf file does not provide the Reference system. However I know it is 'EPSG:4326' I am writing a python script to ...
1
vote
1answer
2k 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
-3
votes
1answer
2k 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
1k 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 ...
2
votes
1answer
823 views

How to include mapnik lib in python 2.7

I am using python 2.7 now in want mapnik to be included in python. I have use exe file to include other library file like GDAL, and other. But for Mapnik can any one suggest me any exe like that so it ...
2
votes
1answer
1k 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 ...
0
votes
0answers
66 views

How can I create form with controls using QGIS(python)? [duplicate]

Possible Duplicate: How do I build a custom form for entering attributes in QGIS Help me, please create a form with controls using QGIS plugin. Thanks!
2
votes
3answers
4k views

Find polygon centroid with Python

I'm using ArcGIS 9.3 to find centroid of some polygon features. I'd like to do this in Python, but so far I can only find solutions with VBA. Can anyone provide some leads here?
4
votes
2answers
692 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 ...
1
vote
0answers
709 views

Variable stored as NoneType in Python with updateCursor

SOLVED: although the field was not nullable (no null values), a glitch created one in the heading field, so the variable was stored as a null value and thus the NoneType. I am using updateCursor to ...
3
votes
1answer
125 views

Generating global view Image of where Lat-Long location is?

I would like to automatically generate an image which highlights a location from a global view. Here is an example of what I would like to achieve: I am debating using python utilities such as ...