Tagged Questions

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

learn more… | top users | synonyms

1
vote
0answers
22 views

Error message retrieval in grass.read_command

I am writing a script in python and would like to get the error messages of the function grass.read_command for seeing why it is not working. I found a webpage ...
2
votes
0answers
41 views

Validating whether PDF file Uploaded as part of Geoprocessing Service of ArcGIS for Server?

I'm developing a Python Script that will be a Geoprocessing Service in ArcGIS Server. The Script has a Button for Users to OPTIONALLY Upload a PDF. If the PDF is Uploaded it gets inserted into the ...
2
votes
2answers
68 views

Delete Files in a folder and disregard an existing folder

I did a lot of geoprocessing steps and now I like to delete all files including result, result, _join, _interand reclass in their name. I can do this with the following import glob import os for fl ...
2
votes
0answers
71 views

Setting up pycharm and pyqgis

I wanted to set up PyCharm the way this blog post explains: Setting up PyCharm for PyQGIS and Qt. I did everything as instructed but when it comes to adding project interpreters I got this error ...
1
vote
1answer
109 views

GDAL Merge Py on ubuntu many tif tiles into one

Trying to batch mosaic 1000 Gtiff rasters (all in one folder) into 1 tif file via gdal merge on linux ubuntu. Having trouble with the linux command to bring in all files in a folder into the output ...
1
vote
0answers
40 views

Clip Management won't work outside of ArcMap/Catalog

Okay so I have a short script that works great when copied into the python window in ArcMap or ArcCatalog, but refuses to work in an IDE for whatever reason. The error that is thrown is: Start Time: ...
1
vote
0answers
38 views

PyQGIS add WMS layer with CQL_FILTER

Dear PyQgis developers! I'd like to add a wms layer through my QGIS plugin with custom CQL_FILTER parameters. My problem is, that the CQL_FILTER parameters are not passed to the GeoServer (I can see ...
2
votes
1answer
79 views

PostgreSQL PL/Python Function for “IF” condition

I am using OSM data to run pgr_dijkstra() for weighted-path calculation. But after importing OSM data using osm2pgsql I populated some additional columns into my ways table. So now it has gid serial, ...
2
votes
1answer
78 views

Georeferencing a raster using GDAL and Python

I want to georeference a raster using python and GDAL. My current approach is to call gdal_translate and gdalwarp using os.system and an ugly list of ground control points. I'd really like a way to do ...
0
votes
2answers
116 views

How to replace “NULL” value with Zero in geodatabase table

I am having some difficulties to change "NULL" values to zero in geodatabase. I have tried the following python code in ArcGIS 10.1 ("Field Calculator") to change it but did not work. Pre-Logic ...
2
votes
2answers
68 views

ArcGIS Field Calculator passes European-formatted floats as tuples

I have the problem that the ArcGIS Field Calculator doesn't read a float number when it is included in Python by referring to the field that contains it, in this way: def giveResult(floatValue): if ...
0
votes
2answers
82 views

How to calculate cumulative decreasing sum in ArcGIS-10.2

I need to calculate the cumulative decreasing sum as a field in a rasters attribute table. The cumulative decreasing sum is the accumulation of the last values to the first, so it is basically the ...
2
votes
2answers
92 views

Is there function to know raster's size (KB) with python?

I am doing a script with python. There I have many raster in canvas (qgis) which I would like to know size in MB. I am searching function in python that give me this result. Anyone can help me? Thank ...
0
votes
0answers
17 views

DeleteFeature work very slowly with a MemoLayer

I have a python custom geoproccess wich use osgeo.ogr with a 'Memory' datasource. It work pretty fast except in one point where I need to delete feature known by id in a list. duplicated.sort() #list ...
0
votes
1answer
29 views

How do I define 'KrigingModelOrdinary'

How and where do I define the KrigingModelOrdinary Here is the code: rasterKrig = "run{}_Krig_{}".format(counter, field) outKrig = arcpy.sa.Kriging(Stations2010o3Data__2_, field, ...
1
vote
0answers
22 views

Adding features in the layer with reference to another layer

I have built a tool for creating line in the exact center of two selected lines through this code: import math def mainCl(): ftr_geom = [] select = iface.activeLayer().selectedFeatures() ...
2
votes
1answer
114 views

'QgsVectorDataProvider' object has no attribute 'select'

I want to create a tool layer in QGIS 2.4 that will select any vector features that intersect with that point. In my script I tried the following function: def selectFeature(self, point, button): ...
1
vote
1answer
60 views

Calculate azimuth of vector for QGIS 2.0 Python plugin

I calculate the azimuth of a vector and update a field in my QGIS 2.0 Python 2.7 plugin. This works currently, but it takes much longer than i'd like to. I believe it is because i'm querying the data ...
7
votes
2answers
176 views

Calculate Date Field - today's date from datetime.date.today

I'm working on part of tool that will use arcpy.CalculateField_management to add the current date to the attribut table. I've wandered far and wide on the interwebs and can't seem to find the ...
1
vote
4answers
165 views

Arcpy: what tools are most suited for this job?

I'll try to be as much detailed as possible but please let me know if anything is missing: I'm trying to get the number of lines in layerA that intersect with each line in LayerB and stores that ...
2
votes
2answers
94 views

Reclassify rasters using GDAL and Python

Using @SS_Rebelious very useful answer, I am trying to reclassify rasters using GDAL and Python. I have a grayscale raster (with values ranging from 0 to 255) and I want to reclassify it to a binary ...
1
vote
1answer
18 views

Feature Layers for Subsets

I need to create a subset of data based off their distance from particular points in ArcMap. Is it possible to create Feature layers that have a defined buffer, that only show data within that buffer? ...
4
votes
1answer
72 views

Installing scipy.spatial with ArcPy gives DLL load failed error on import?

I am running python 2.7.6 from an ArcGIS installation. I have tried to install scipy from the Python Exchange Packages here, using the scipy-0.14.0.win32-py2.7.exe executable. I get no error importing ...
1
vote
0answers
45 views

Esri Python Toolbox(pyt) corruption in ArcToolbox.dat

Symptoms: Open ArcCatalog and all tools within Python Toolbox(pyt) have a red-x error next to them claiming that "Arcpy module has no attribute Parameter" Close ArcCatalog Delete ArcToolbox.dat file ...
2
votes
1answer
224 views

Plotting elevation maps and shaded relief images from latitude, longitude, and elevation pairs

I have a set of latitude, longitude, and elevation pairs (roughly a grid of such values, though it is not uniform), and I'd like to be able to plot an elevation map and perhaps also a shaded relief ...
2
votes
1answer
40 views

How to use grass.script in MacOS

I have installed Python and Grass6.4 using Macports. When I tried to use "import grass.script" in python environment, it gives "no module found" error. I'd spend much time to fixed it but could not ...
0
votes
0answers
23 views

Can I invoke MapWindow GIS software from python,.net or any other scripts language

I am interested in working with MapWindow GIS. Is it possible to invoke MapWindow GIS from scripting (like external python).
2
votes
2answers
85 views

Returning value from other field, using FieldCalculator

I am very new to Python and need what I believe is a very basic script in order for my field to represent another fields' input, if the field's value is 0. I tried to search for this, but gave up ...
1
vote
1answer
46 views

How to get coordinates of line

I am working on Qgis python console. I want to draw a line in the center of two parallel lines..For this purpose firstly i have to store the coordinates of those two lines in a variable so i can apply ...
0
votes
0answers
19 views

PyQGIS: Coordinates to TextBrowser

I'm doing tutorial: http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html#tie-qgspoint-output-to-the-gui Right now I at the "Tie QgsPoint Output to the GUI". I did everything similar to ...
3
votes
1answer
136 views

Shapely/ Python looping through a number of polygons

I am trying to loop through a set of polygons in shapely so using python) to determine whether they overlap or not. I do not want to do it manually as later i want to generalise the procedure and do ...
4
votes
1answer
76 views

Is there a public API that can be accessed with Python and will geocode Points of Interests?

I recently downloaded tagged hospital data from OpenStreetMaps.org using the API. Some of the data have a 'node' tag which are attributed with a lat/long while other data are tagged as 'way' format ...
3
votes
2answers
85 views

Extract values from raster based on points and pixels adjacent to the point

I have an issue. I have a set of points (n=~2000) and I would like to extract the pixel values from multiple rasters (a single-raster solution is also ok) for location of that point as well as that of ...
1
vote
1answer
47 views

how to open shp file which created by using python-ogr in qgis?

I have done following steps, so how I open that created shp file in Qgis driver=ogr.GetDriverByName('ESRI Shapefile') out=driver.CreateDataSource('pts.shp') ...
0
votes
1answer
38 views

Arranging elements horizontally in ArcGIS tool

Is it possible to arrange multiple check boxes horizontally in a tool and changing the parameters dynamically (adding/removing) based on user selection of check boxes?
2
votes
1answer
41 views

Cut polygon shapefile with 2 parallel lines to derive new inside polygon?

Using Python scripting: How can I clip a polygon shapefile with parallel lines (polyline shapefile) to derive new inside polygon?
7
votes
0answers
176 views

Geotransformation for polar stereographic?

I'm currently working to import CANGRID climate data (provided as Surfer Grid ascii, ".grd" files) into ArcGIS. The grid is 95 rows by 125 columns in size.Metadata provides lat/lon of origin (lower ...
3
votes
1answer
58 views

Trying to generate a PDF for each feature in a feature class based on an attribute with Python.

I have a feature class of points that represent storm water inlets. I am trying to automate a process that does the following. finds all of the inlets that have a field called "Marker" populated ...
1
vote
0answers
30 views

Error writing defaultdict values to feature class rows

I originally posted building dictionary from feature class field values, how can I ensure there are no duplicate values per key. The goal is to update another field with all the values per key, which ...
0
votes
0answers
57 views

Python trainings comparison

My employer provides me with a generous annual training budget and I'd like to use it on one of the following two Python courses. As a GIScientist, I would like to attend the course which will give ...
2
votes
0answers
36 views

How to Use GetGeomtype Gdal Python

I am just wondering what I am doing wrong when trying to use the GetGeomType. I need to focus on separating layers from a pix file. Two categories are the bitmaps(which are vectors) and then the ...
1
vote
2answers
50 views

building dictionary from feature class field values, how can I ensure there are no duplicate values per key

I found this code sample that builds a dictionary from two fields; the end result is a concatenation of all values per key to a new field. It's a great tool except that it doesn't account for ...
0
votes
2answers
53 views

Select Layer by Attribute: SQL and variable problems

I've had a good look around the site and haven't been able able to find any 'select by attribute' questions regarding string variables and how to integrate them into an SQL statement. In my particular ...
0
votes
0answers
58 views

Error selecting geometry from Oracle DB

I'm trying to select a geometry column as well-known text from a feature class in an Oracle 11g/ArcSDE 10.1 geodatabase. (This is in a Python script using pypyodbc as a driver). This is my SQL: ...
2
votes
1answer
47 views

Compiling custom plugins for QGIS on Windows

I've made my first plugin using plugin builder and I want to compile it. I read that I need two commands to do it under windows: pyuic4 and pyrcc4. But when I use any of these commands I get this: ...
1
vote
0answers
45 views

How to change color ramp in graduated classification with standard deviation using pyqgis

I'm using graduated clasiffication with standard deviation to style my shapefile (see code below). But I need to use different color ramp for classes below mean (-1std, -2std etc.).I'm thinking of ...
2
votes
1answer
35 views

ERROR 001243 preventing automatic publishing of geoprocessing service

I am trying to automate the process of publishing a geoprocessing service to ArcGIS for Server 10.2.2, using a python script: import arcpy result = r"C:\data\ContourLineFunction.rlt" ...
1
vote
1answer
30 views

Speeding up length calculation in QGIS 2.0 Python plugin

In a qgis 2.0 plugin for windows, I calculate length and update a field with the values. It works, but takes a lot of time. Execution for this part only takes about ten minutes. Can anyone suggest ...
3
votes
2answers
53 views

How to calculate the a list of rasters?

I'm writing ArcPy code in ArcGIS trying to calculate a list of rasters. I get an error message that says: TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'. Here's my ...
1
vote
0answers
16 views

Print Custom Feature Form using PyQGIS

I recently asked a question and accepted the answer, as it was a good guide on accessing the print composer using python. However, I am still looking for a way to print the custom feature form. Does ...