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

learn more… | top users | synonyms

1
vote
0answers
114 views

PyQGIS Dialog Plugin not resetting

I have written a PostGIS search plugin that works pretty well, except two things that I just cannot figure out a solution 1) When the dialog closes and then is reopened the previous query is still in ...
1
vote
0answers
90 views

How can I draw features on GeoTIFF in Python?

I have a set of data (coords + value) and want to turn it into a heatmap in GeoTIFF. Should I calculate pixels and set them as array, or there are shortcuts? This is what I do now: driver = ...
1
vote
0answers
23 views

Able to circumvent QgsCredentials script called from Pre-execution

I've got a stored project that, when opened is connecting to my PostgreSQL DB, and is loading several layers. All good. I'm using a script that is called from Pre-execution (Processing/Options and ...
1
vote
0answers
107 views

ArcGIS Geoprocessing Service fails on data loading

I have a Desktop Script tool that works fine when run on desktop, but does not work when the results are turned into a geoprocessing serice. Running ArcGIS 10.2 on Desktop and 10.2 on server. I have ...
1
vote
0answers
96 views

Getting “Segmentation fault: 11” with ogr in Python

This is the code I'm trying to run: In [1]: from osgeo import ogr In [2]: datasource = ogr.Open('testdata.shp') In [3]: datasource.GetLayerCount() Out[3]: 1 In [4]: layer = ...
1
vote
0answers
404 views

How to use paths with non ASCII characters for subprocess calls with ArcGIS

I know that it is possible to create calls using unicode character encoding like \xf8 for non ASCII characters but how do I do it writing a path in a script just like: 'e:\gis\python_ø\notepad.exe' ...
1
vote
0answers
114 views

Install PyQGIS in virtualenv

Is it possible to install PyQGIS in virtual environment? I want to use rendering capabilities in my own application which runs using virtualenv.
1
vote
0answers
60 views

header information is missing from image, after writing using opencv

I am doing complement of an image using open-cv python, while writing the image, open-cv is not writing the header information in the complemented image. my image data are in TIFF format. i am doing ...
1
vote
0answers
586 views

smoothing results from scipy griddata interpolatioin

I am using the griddata interpolation package in scipy, and an extrapolation function pulled from fatiando: import numpy as np import scipy from scipy.interpolate import griddata import ...
1
vote
0answers
66 views

Automate data entry into Access from ArcMap

I have an Access 2007-2010 database that I'm currently working on by manually searching for roads in a defined set of areas in ArcMap 10.1 and then filling in the area's ID in an empty column in the ...
1
vote
0answers
303 views

Watershed delineation; how to program

I've been trying to roll my own watershed delineation program, taking a flow direction grid and pour points as input. I coded up a quick search algorithm in Python which inspects the flow direction ...
1
vote
0answers
88 views

Where are dynamic hyperlinks stored?

A while back (ArcGIS 10.0 times, or maybe even 9.3) a colleague of mine created a mxd with a few hundred manholes and attached dynamic hyperlinks to them (pointing to photos of them). (I know this ...
1
vote
0answers
78 views

Write raster with its attribute table and symbology

I am classifying lots of rasters and I'd like to automate the legend creation and symbology displaying for easy manipulation. Here is the kind of raster I'm dealing with: library(raster) r <- ...
1
vote
0answers
178 views

How to utilize GPSQLExpression data type in Python Toolbox

I am trying to write my first Python Toolbox for ArcGIS (neat stuff by the way). The tool is simple enough - it connects to SQL Server and downloads data for the user. The trick here is, I want the ...
1
vote
0answers
120 views

Create custom “Export To” context menu tool using selected feature in ArcCatalog

I'm trying to create a custom "Export To" script similar to the Right-Click Export Content menu item "To Geodatabase... (multiple)". I have a 3 feature classes in a file geodatabase. I selected two of ...
1
vote
0answers
92 views

how can i export a shapefile

hi I want to select the cities that exist in Morocco and export it to a shape file and I used this code but its not working, it gives me an error: code: import arcpy from arcpy import env ...
1
vote
0answers
58 views

Arcpy PageLayout.dll Errors in Python

import os import arcpy arcpy.env.overwriteOutput=True folderPath= raw_input ("Enter directory: ") filePath= raw_input ("Enter data repository: ") f = open((os.path.join ...
1
vote
0answers
20 views

Q: cursor memory and fields therein

Theoretical Python question. Say you have an update cursor while-loop for a few selected records. While looping through the rows, at some point a nested if statement triggers an "addfield" event. The ...
1
vote
0answers
167 views

Editing of vector layer programmatically with QGIS

I'm trying to edit vector layer using Python console and have couple of questions. Why this approach doesn't work and I have to use canvas.refresh? If I will use this code not in python console but in ...
1
vote
0answers
129 views

Accessing existing instance of qgis from stand-alone python script

For my own data analysis pipeline, I am running a split screen setup with iPython notebooks on one side, generating variables from source data, pushing them to a csv file which qgis then reads/joins ...
1
vote
0answers
117 views

Is it possible to get field type information from FieldInfo object in ArcPy?

I'm looking at the FieldInfo object documentation for ArcGIS 10.2 and am not seeing access for field type (e.g. short, string, double). Is it possible to get field type information from the ...
1
vote
0answers
252 views

Locating the centroid (center of mass) of spherical polygons

I'm trying to work out how best to locate the centroid of an arbitrary shape draped over a unit sphere, with the input being ordered (clockwise or anti-cw) vertices for the shape boundary. The density ...
1
vote
0answers
64 views

Russian in fieldname changing with Python in ArcGIS

Is there any way to rename fieldname in the attribute table of a layer/shapefile in ArcGIS 10.2 containing russian letters? If yes, is it possible to do it in a script?
1
vote
0answers
66 views

How to create a startup prompt that populates definition queries on multiple feature classes

I would like to create an ArcGIS start up prompt or custom button that asks for a user's initials and then populates multiple feature class & layer definition queries. More specifically, I would ...
1
vote
0answers
67 views

Access to python addin objects/variables in python window

Following up on this question: Can a Python script be executed from a .NET AddIn and also write its standard output and geoprocessor messages to the ArcMap Python Window? Is is possible to access ...
1
vote
0answers
254 views

arcpy symbology colors changing on RefreshActiveView()

I have a problem that I'm not sure is functionality not built into arcpy or I'm just doing something wrong. I'm using arcpy.mapping.UpdateLayer() to apply symbology to a layer, but afterwards some ...
1
vote
0answers
67 views

What is the best way to handle geometries between Python functions?

What is the best way to handle geometries between different Python functions? For example: I have a function that exports a line from grass.script. The line will be a parameter of another function ...
1
vote
0answers
136 views

GDAL and Python: How to “pad the extent” or otherwise handle band.ReadRaster() for area falling slightly outside the image bounds?

In a nutshell, I'm trying to create a bare-metal tiling utility using GDAL and Python. As you can see in the graphic below, which shows the perimeter of a raster and the OSM-structured tile index, ...
1
vote
0answers
256 views

Unable to use pyQGiS in a custom application - import arcgis.core error

I'm using windows 7 and/or 8 64 bit with QGiS 2.01. I'm wanting to us the pyQGiS tools in a custom python application outside of the QGiS environment (i.e by running a python executable located in ...
1
vote
0answers
159 views

Matplotlib Basemap Resolution with PyQt makes Python Quit Unexpectedly

I'm having difficulties using Matplotlibs Basemap in combination with a PyQt4 interface. Basically I create a Pyqt4 Canvas in which I plot a Matplotlib Basemap and some markers. I call the function in ...
1
vote
0answers
104 views

Efficient computation of path profile with Numpy and GDAL

I have numpy array with SRTM elevation data and I need calculate path profiles - vectors with elevation data from one point (transmitter) to every points of my map. Here's my current solution: def ...
1
vote
0answers
103 views

AttributeError: Error in getting tool information when using TableToTable tool

I am trying to use the arcpy.TableToTable_conversion tool in my python script, but seem to be getting the following error on the line arcpy.TableToTable_conversion("FINAL_NLPG", ...
1
vote
0answers
168 views

Composite bands produces a single band image

Running this produces a single band tif and not a three band image. Has anyone seen this before or can suggest ways to trouble shoot it? Input_Rasters = path + parentdir + "/" + dir + "/" + ...
1
vote
0answers
258 views

Couldn't load PyQGIS, QGIS 2.0.1 on Ubuntu 12.04 Precise

After upgrading to QGIS 2.0.1 I still get the error: Couldn't load PyQGIS. Python support will be disabled. Traceback (most recent call last): File "", line 1, in File ...
1
vote
0answers
62 views

Obtain virtual output directory path in geoprocessing service

I am publishing a geoprocessing service and I want to be able to access the virtual output directory path configured for the service. Now I know that gp services will magically return virtual paths ...
1
vote
0answers
202 views

How to change the color of a selected feature with pyQGIS?

is it possible to change the color of a selected feature in qgis 1.8? To highlight a feature I use: vlayer.setSelectedFeatures(selectedList) box = vlayer.boundingBoxOfSelected() ...
1
vote
0answers
89 views

How to join attributes by location with command line

I would like to joint the attributes of 2 shapefiles by location but with a command line (linux). This feature is easy in QGIS but it is VERY slow. Is there a way of doing this with ogr or pyqgis ? ...
1
vote
0answers
229 views

merge_management

Here is the edited code: import arcpy import os from arcpy import env set the environment settings env.workspace = "C:\RG\Kings County\Test.gdb" fcs = arcpy.ListFeatureClasses("Sub_NVF_*") ...
1
vote
0answers
242 views

Pyshp 1.2 example from documentation fails

I must be doing something really stupid because I am trying to run an example straight from the PyShp (shapefile.py) 1.2 documentation with the only change being the input shapefile and it is failing. ...
1
vote
0answers
159 views

Modifying Raster Layer with Python Console

Forgive me if this has been asked somewhere else. I am looking for a way to edit a raster file which has already been loaded into QGIS through the python console (i.e. I would like to edit the raster ...
1
vote
0answers
111 views

Reference to Basemap instance's coordinate system

I use the matplotlib basemap toolkit (mpl_basemap.Basemap) to plot GeoTIFF images on a map background using pcolor() or pcolormesh(). For this purpose, I need to transform a meshgrid of x and y ...
1
vote
0answers
76 views

How to create a schematic view of a line feature?

DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far… I have a line feature (polyline with curves) in ArcGIS Desktop, and I want to create a linear representation (straigth line) of the ...
1
vote
0answers
44 views

Qgis 1.9 commitChanges() and Redraw a temporary layer

Using QGIS 1.9 and writing a python plugin. I have a function that connects points into polylines and draws them as a temporary, in memory layer. Membership in a polyline is determined by a field in ...
1
vote
0answers
209 views

Calculating the closest distance between two points in ArcMap 10.2

I am looking for a script to calculate the closest meter to a set of addresses. I have a feature class of meters and a feature class of addresses. I have populated the address with fields for ...
1
vote
0answers
94 views

Automated attribute update geometric network

I have a Network Dataset of a storm water system containing two feature classes of points and lines. (All data is topologically sound with pits and pipes snapped and linework captured in direction of ...
1
vote
0answers
91 views

How to rotate u and v components of wind in rotated gribs?

I have a grib message of a rotated hirlam product. The gribmessage states, that the u and v component contained are relative to the rotated grid. How can I unrotate them?
1
vote
0answers
162 views

proj/pyproj converted coordinates offset

I'm using pyproj to convert some coordinates from WGS84 to OSGB36. When mapped out the converted and unconverted don't map to the same places on a map. The OSGB36 coordinates are mapped about 100 ...
1
vote
0answers
49 views

Deleting network features in python script doesn't create net junctions

I have a script that makes a copy of a network dataset for a 3rd party app to use. One of the junction feature classes causes problems with the app. The ideal solution would be to remove it from the ...
1
vote
0answers
156 views

Can ModelBuilder be used to export different versions of the same mxd with various constraints?

I am currently trying to use modelbuilder to go through each row in an attribute table, select the streets that intersect the polygon (which is the row in the attribute table), zoom to the selected ...
1
vote
0answers
286 views

Loop though records in PostGIS (using PL/PYTHON or PGSQL)

I've seen many example of loops, but I can't get that one to work. I work for a regional transit agency and each year, we conduct several surveys. I geocode everything to the house level for internal ...