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

learn more… | top users | synonyms

3
votes
1answer
141 views

How to find the distance to the nearest coastline from a land-based latitude/longitude point?

I'm completely new to GIS and unsure what I need to solve this problem: In the image above turquoise is actually land. Sea is white. I tried using the NASA Distance to the Nearest Coast data dump ...
1
vote
1answer
224 views

How to Properly Loop Through a List With a Cursor?

My team is working on a python script that does various updating tasks to our streets file. A part we are getting stuck on is trying to update a field. Currently we have a field FEDROUTE that is ...
1
vote
1answer
63 views

Is there a way to access the GeoProcessing tools in QGIS, in code

Is there a way to access the GeoProcessing tools in QGIS, in code? I want to find the Difference between two layers and make a new shapefile with the result.It can be manually done by selecting ...
0
votes
1answer
113 views

Python Field Calculator ArcGIS 10.1 expression question

I have gotten stuck on another seemingly simple arcgis field calculator python expression. I obtained a great answer to a another similar question a few years ago: Python Field Calculator ArcGIS 10 ...
2
votes
2answers
83 views

convert a shapefile into graph with nodes and edges

Is there a way to convert a shapefile into graph with nodes and edges(except networkx). I'm using qgis and I want to convert a road vector layer into a graph, so that I can use it to apply shortest ...
1
vote
1answer
38 views

assigning census block demographics to postal data (zip/zip+4)

Using Python and R, what would be the best strategy to tie Census Block-level data to zip/zip + 4? I understand we're not matching polygon boundaries (zip codes are not geographies), but somehow ...
1
vote
1answer
49 views

ArcGIS Geoprocessing “None Type” Second time

I am trying to publish an ArcGIS geoprocessing service in 10.2 I have a script setup that will run multiple times through Pycharm, but when I run it in ArcGIS it will run once and return this error: ...
2
votes
1answer
83 views

Does not show shortest path in networkx (in QGIS)

I used the following commands (in qgis console) to get the shortest path with astar algorithm. But the result shows 'NetworkXNoPath' every time. Why was that? Please help me to find a solution to this ...
1
vote
0answers
28 views

Is is possible to run the QGIS python module server side?

I'm pretty new to programming but I want to use the QGIS python module on a server. Basically I am trying to create a JPEG map programatically on a server. I already have a python script to create ...
2
votes
1answer
116 views

QGIS says “osgeo [python-gdal]” isn't installed on Mac

I know similar questions have been asked (like this one) -- but I'm encountering a unique problem. I installed GDAL complete 1.11 from KyngChaos, but when I open QGIS, I get the following error ...
1
vote
1answer
52 views

Locating 0-points multipart polygons using arcpy

By Running this piece of code: import arcpy arcpy.env.workspace = "C:\working\GEODATABASES\\tests.gdb" fcList = arcpy.ListFeatureClasses() for fc in fcList: with arcpy.da.SearchCursor(fc, ...
0
votes
0answers
35 views

QGIS r.cost / r.drain and errors

I'm trying to find the optimal route of several archaeological sites with Qgis 2.2. I've a DEM and r.walk or r.viewshed executed successfully, but r.cost always fails creating the output, however ...
2
votes
1answer
92 views

QGIS Python Scripting - Syntax definition

After playing around with the Model Builder and looking at the python scripts of what I make, I noticed some syntax which I can't find the definition anywhere. Here is a snippet of the python script ...
0
votes
1answer
34 views

PyQGIS: How to send signal to call unsetMapTool()

I've created a map tool to add some functionality to adding point features in QGIS 2.0. I'd like to unset this map tool if editing has manually been terminated by user. I've attempted as shown below, ...
0
votes
1answer
25 views

Add attributes to an output shapefile schema (via meta)

I am trying to copy the schema of an existing shapefile and add to it in an output shapefile. Somehow I am not getting anywhere with this...though the docs seem very clear (and the download page : ...
2
votes
2answers
53 views

GetCount raises exception

I opted to use gp.GetCount in my script. This raises an exception, though the process completes "successfully" while returning zero features (which is untrue). I'm wondering how this could be. Using ...
1
vote
0answers
31 views

How to get QGIS to play with pandas (Windows)?

has anybody been successful getting pandas to work with QGIS's Python installation, on Windows? I've used the OSGeo4W installer to install QGIS2.2, which comes with Python 2.7 and Numpy 1.5.1. Any ...
0
votes
0answers
40 views

Error: Algorithm not found

I wrote the following code to start using QGIS APIs. in a very short script seen below, the "Error: Algorithm not found" is thrown and "print processing.alglist()" is showing none. Any idea why this ...
0
votes
3answers
108 views

Using ArcPy and Python to export Table View as PDF format?

I am using ArcPy to select from a layer and display the result on map as a table view. Now I want to export the table view as a PDF format. Anybody know about it? If it is beyond ArcPy to export ...
0
votes
0answers
55 views

PyQgis: How can I “append” features to a Vector Layer instead of “stacking” them?

As I read data from a text file and add points to a QgsVectorLayer (as well as related attributes), each new record gets 'stacked' on top of the previous one in the Attribute Table (and within the ...
1
vote
2answers
50 views

Issues Reading a table from Geodatabase

I have scripted a process to read a CSV file into a file geodatabase. Then, I want to read this imported file and work on it by adding new fields and calculating values. However, while using the ...
0
votes
1answer
74 views

Automating Intersect between two polygon layers

I have a spreadsheet that has county-level occurrences of around 1000 species within the US in the column headings (Species State County). Thus, for some counties there may be multiple species. I ...
1
vote
1answer
60 views

Iterating over selected features in QGIS Processing

I used to be able to iterate over selected features using the following script in v2.0. import processing features = processing.getfeatures(layer) for feature in features: #Do whatever you need ...
2
votes
0answers
52 views

How to detect turns of a route?

I'm doing a Python simulation of a vehicle, driving along a specified path. I generate dummy GPS readings, that fetch the current position of the vehicle, with some randomized error added. After a ...
0
votes
1answer
42 views

Blank Shapefile output?

When executing the following command string in the active browser, Qgis projects the triangle polygon and associated attribute table correctly. Upon reopening the shapefile in a new browser, the ...
1
vote
1answer
49 views

How do you determine when user is clicking the end point of an edit sketch using ArcObjects?

I am using vb.net working on ArcObjects. One requirement is to pop up a toolbox once the user click the end point (double click the point under editing status). So I want to know how can I know when ...
0
votes
1answer
54 views

Programmatically set layer properties Python Init function

Is it possible to set the layer properties Python Init function field programmatically? I've been looking through the qgis 2.2 api but can't seem to find anything on it. Hint, suggestions and ...
2
votes
2answers
106 views

Calculate Slope Between Pixels Through Time: A Time Series Trend Analysis

I have a 9 year weekly time series (~500 raster grids of equal cell size and extent). I'm interested in obtaining the regression line slope between pixels (Imagine stacking all 500 grids on top of ...
2
votes
1answer
126 views

How to surround a Polygon object with a corridor of specified width?

I'd like to build a corridor surrounding a polygon, so that the corridor's outer bounds all have the same distance to the inner bounds. Like this: I've made this lousy graphic in Paint, since I ...
1
vote
0answers
45 views

Highlight paths between two points

I'm new to qgis and very sorry if this is a simple question to ask. IS there a way to highlight the available paths (roads) between two selected points in a road map(in qgis) ? I want to find the ...
0
votes
0answers
37 views

QGIS Python API: SAGA difference algorithm does not split parts

I am using the QGIS Python API in an external script (platform: ubuntu). Everything works as expected. But when I am using the SAGA difference algorithm within the script, there is an issue. The ...
1
vote
1answer
51 views

Import error when utilizing QGIS's Python Init function

Based on the answer to Referencing Qt UIs external to plugin with python. I'm trying to utilize the "Layer Properties / Fields / Python Init function" to execute a file (test_file.py) that is located ...
2
votes
0answers
39 views

How to add nodes into graph

I'm new to qgis and in here I want to find a path between two selected points on the map(Roads-vector layer). The points are selected by the user, using mouse clicks. So here I used the astar ...
2
votes
1answer
50 views

FME - Use Python Caller to Set Search Envelope in Another Workspace

I have an FME workspace which has a number of different workspaceRunner transformers. The first workspaceRunner launches a workspace which buffers a pipeline and outputs the bounding coordinates to a ...
1
vote
0answers
48 views

QGIS API changes from 2.0 to 2.2

I have the same program running on two different machine, one with Qgis 2.0 and the other Qgis 2.2. The machine running 2.2 doesn't seem to render the map canvas. I thought it was how I has creating ...
0
votes
0answers
20 views

'QgsGraph' object does not support indexing

Traceback (most recent call last): File "/home/kasun/.qgis2/python/plugins/floogin/floogin.py", line 246, in findRoutes path=self.astar.astarSearch(graph, start, end) File ...
0
votes
0answers
44 views

Draw polygon shape via Qbutton

Ideally; a Ui Qbutton is needed that will activate map canvas editing to add a polygon via the classic mouse click rubber band method. Upon a concluding right click with the active tool, editing ...
0
votes
1answer
54 views

In arcgis10.2, can I access arcobjects using python? [duplicate]

I am using python in Arcgis 10.2, but it seems Python cannot meet all my developing demands, from the forum, others recommend to use python to access arc objects,but what they mentioned is the old ...
0
votes
1answer
107 views

AttributeError: 'int' object has no attribute 'save'

I am trying to use a conditional statement to generate a raster with binary values from a raster with probability values (floating point raster). This is easily done within ArcMap by batching the ...
3
votes
1answer
62 views

Python MemoryError when running ArcGIS Python Toolbox tool

I have a Python Toolbox (.pyt) containing a single tool. Part of that tool is the following function, which creates a dictionary from an attribute table, where the keys are the rows' OBJECTIDs and the ...
3
votes
2answers
143 views

How do I know if I am running 64-bit background geoprocessing on ArcMap 10.2?

I'm running ArcMap 10.2 and just set up 'ArcGIS for Desktop Background Geoprocessing (64 bit)' and now I have both the ArcGIS10.2 folder and ArcGISx6410.2 folder inside my python folder. I have ...
1
vote
1answer
38 views

Reinitialize ArcGIS10.0 Python installation

I am developing a Python script for a Toolbox that required a few libraries which I installed manually into C:\Python26\ArcGIS10.0\ and it worked just fine. To make the distribution easier, I dived ...
1
vote
1answer
38 views

How to covert gridded (gnomonically projected by distance) data to lat/long data

I have a grid of data that is in a gnomonic projection, centered on a lat/long point (WGS-84). The grid has a 1km spacing. Given this I can easily obtain the x,y coordinates/distances from centre ...
3
votes
2answers
49 views

FME - Conditionally make parameters visible

I have an FME workspace in which the user sets several parameters before running. The first parameter is a multiple choice where the user selects which layers they would like to process. Depending on ...
0
votes
2answers
34 views

FME - Filter Parameter choices to only projected coordinate systems

I have an FME workspace in which the user sets several parameters before running. One of the parameters is a Coordinate System. I would like the user to choose only Projected Coordinate Systems as ...
0
votes
2answers
38 views

Can't get dataProvider object outside of QGIS python Interpreter

Within PyCharm import qgis.core as qgis vector_lyr = qgis.QgsVectorLayer("Point", "distance nodes", "memory") pr = vector_lyr.dataProvider() print pr prints None Within Python Interpreter in QGIS ...
0
votes
1answer
57 views

Howto create complex polygon with pyshp

using the pyshp library (https://code.google.com/p/pyshp/) I am trying to create a "complex" polgon with one hole inside the main-poly plus one island-poly. It should look like this: I used the ...
0
votes
1answer
75 views

Iterative raster calculation script using NumPy arrays breaks after ~10 rasters, returns: “TypeError: Cannot create raster for numpy array.”

Here is my code: #Generate Cumulative Thresholds #5/15/14 import os import glob import arcpy import numpy as np #Enable overwriting output data arcpy.env.overwriteOutput = True ...
1
vote
1answer
43 views

Calculating average of 3 fields where nulls are present

I have created a new field to calculate the average of 3 other fields in a table where nulls are present. Using python as the parser(with no code block) I used this: (!Slope_PCT! or 0 + !Flood_PCT! ...
0
votes
1answer
74 views

How to create a grid after merging shapefiles?

Follow up question to QGIS Model Builder Script - Possible to merge layers in a folder? I think I'm missing something very obvious here but can't seem to find it. After merging shapfiles in a folder, ...