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

learn more… | top users | synonyms

1
vote
1answer
676 views

How to get a signal when the geometry to a line in QGIS is changed

I am working on a plugin in QGIS and want to get a signal when the geometry to a feature(in this case a polyline) in my layer is changed. For example if I use the node tool to drag one of the nodes. ...
1
vote
0answers
38 views

qgis.core error [duplicate]

Possible Duplicate: qgis.core import error I am new in quantum gis and python, I installed quantum gis 1.8 from osgeo4w installer, after I installed python 2.7 and started python shell and ...
9
votes
2answers
1k views

Creating a multispectral image from scratch

I want to make a multispectral image from cero to do some tests on it. Something really simple like 5 completely uniform bands with salt and pepper noise on them or a square of different values at the ...
3
votes
2answers
4k views

arcpy.Delete_management not deleting a geodatabase folder

This script runs fine the first time but fails when run the second time. The issue seems to be that the KMLToLayer_conversion statement creates a file geodatabase (no surprise) that subsequently ...
3
votes
0answers
77 views

Adding points to represent non-chosen locations

I am looking for a way to set up a discrete choice model in ArcGIS for foraging behavior of individuals, in a grid of 15 locations. To do that I need a point for every possible choice they could have ...
1
vote
1answer
642 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
2answers
1k views

How to batch convert Shapefiles to GMLs?

I know how to do this within Quantum GIS but I have 30+ shapefiles that need to be converted to GML. Is there a Python script sample or plugin for Quantum GIS that I can use to convert my shapefiles ...
1
vote
1answer
896 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 ...
1
vote
3answers
3k views

Replacing NULL values in geodatabase table?

How do you update NULL values within a geodatabase table using the ArcGIS Field Calculator (service pack 4) without changing other values to NULL? I've tried the suggestions on this previous ...
3
votes
2answers
2k views

How to perform volume calculation in QGIS

EDIT 07/12/12 Ok, meanwhile I came to another problem I want to discuss. I just tried around with the volume calculation with some layers and came to a point where I receive the following error. ...
7
votes
2answers
3k 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 -- ...
2
votes
3answers
1k views

Editing file geodatabase without using tools from Esri?

I am looking for a tool (Python library etc.) that would allow me to edit a file geodatabase without Esri software? It is possible?
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 ...
4
votes
1answer
1k views

How to save a newly created shapefile in PostGIS?

I am creating shapefile using shapefile.py and my database has records more that 65k which is the limit of the shapefile. How can I create shapefiles then? Is it possible that somehow I am able to ...
3
votes
1answer
517 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, ...
3
votes
3answers
911 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 ...
6
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 ...
14
votes
11answers
14k 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 ...
8
votes
4answers
3k 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 ...
2
votes
1answer
271 views

Does ArcMap/ArcPy support creation of textElements using Python?

From what I can tell python at ArcGIS Desktop 10.0 cannot create new textElements nor GraphicElements. Yet, 10.1 seems to support the ability to at least create a clone, of a existing GraphicElements, ...
9
votes
1answer
844 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
194 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
784 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 ...
4
votes
1answer
357 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 ...
5
votes
1answer
820 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
662 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
440 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 = ...
3
votes
1answer
430 views

Update Arcpy version?

This is probably the answer to my previous question. The version of arcpy that I am using does not include GetNAClassNames naClasses = arcpy.na.GetNAClassNames(serviceAreaLayer) ...
0
votes
0answers
168 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
77 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 ...
0
votes
1answer
402 views

How to convert the python plugins into dll file for QGIS application?

How to convert the python plugins into dll files for QGis application? Thanks in advance.
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 ...
5
votes
2answers
537 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
366 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
405 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 ...
3
votes
2answers
302 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 ...
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 ...
3
votes
1answer
331 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 ...
3
votes
1answer
879 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): ...
15
votes
6answers
6k 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
160 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
2k 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
695 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) ...
2
votes
3answers
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 ...
0
votes
2answers
210 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 ...
2
votes
1answer
1k 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 ...
3
votes
1answer
230 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
958 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": ...