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

learn more… | top users | synonyms

0
votes
0answers
14 views

How to read AMSR-2 Data into GeoTIFF raster with Python/GDAL

I found an HDF5 file with Brightness Temperature and Latitude/Longitude data from this site: gcom-w1.jaxa.jp/auth.html. I then use GDAL to read the data into specific arrays (ex. lat_array,lon_array, ...
1
vote
0answers
11 views

Trouble importing qgis.core python module

I am having issues loading the qgis Python modules in the osgeo4w shell. Ultimately I want to work with the modules in pyscripter. I tried the solution mentioned in Problem with import qgis.core when ...
2
votes
0answers
17 views

Intersecting lines get crossings

I have a set of lines representing bus lines. Some of the lines are overlapping and take the same roads. I am able to extract the nodes. However I am interested in extracting only crossings like ...
-1
votes
3answers
45 views

Sum fields from ListFields - RuntimeError: A column was specified that does not exist?

Does anyone have a suggestion on how to otherwise solve the problem ... The need to automatically generate all the columns from the table, the calculation of the sum, the results are updated in the ...
0
votes
0answers
35 views

Using if loop to concatenate rows Python [on hold]

I have a python script which brings in a JSON web-service I would like to concatenate rows. I have tried using the script before, but my table ends up truncated, with my SRList containing only 1 item ...
0
votes
1answer
30 views

Select the first 5 rows of a selection after reverse sorting using an attribute field in ArcGIS 10.2 with Python

I have a feature class containing 380 polygons representing sedimentary basins and another polygon feature class representing oil discoveries within said basins. My plan is to: Iterate through all ...
1
vote
1answer
15 views

How to access multiple active layers?

qgis.utils.iface.activeLayer() accesses the current active layer, but what is there are multiple layers that are currently selected? How can I access both of these layers?
0
votes
0answers
11 views

How to create custom input widget using Plugin builder?

I am trying to develop a plugin that takes in user input for the time, using the QGIS plugin builder. However, I want to specify the different times the user is allowed to select from when the plugin ...
1
vote
0answers
11 views

python-mapscript on OSX Yosemite

I am keen to try out the mapserver export plugin from QGIS 2.6 This needs python-mapscript which comes from the mapserver package. This can be downloaded from ...
0
votes
3answers
27 views

Extract raster values gdal looping rasters

I have this code, most of them getting from this forum. I need to loop over a folder and sub-folders, or just to run a list (putting previously all the raster inside, I don't mind one way or the ...
1
vote
1answer
25 views

Memory issues with zonal statistics

I have got a memory issue due to the use of the zonal statistics command into a loop. It seems that after using the ZS command QGIS stores some information in the RAM (cache memory?). It is not ...
2
votes
1answer
30 views

How to trigger a Python script from an ArcGIS Desktop “save” operation?

Similar to the question Run a Python Script when opening an MXD, I'm looking for a way to run a Python script that is triggered when the "Save" command/button is pressed. I've read the Creating a ...
-1
votes
2answers
26 views

How can I find a town which remotes from a hospital more than a hour? [on hold]

I want to show the town or village which is very far from a hospital so needs telemedicine. Please let me know how to find the town or village or if you know where the place is please let me know.
0
votes
0answers
24 views

How do you project a single pointGeometry object with arcpy?

In an attempt to create a python add-in for ArcMap that will pass x and y coordinates to another application via a mouse click on the map, I have written the following code. I need the output ...
0
votes
1answer
28 views

Python Toolbox Parameter List Update/Refresh?

I am using a python toolbox in ArcGIS 10.2.2 and want a drop down list of all the versions for the person reconciling to choose from. (And I do not want to include dbo.DEFAULT and DS.Draft). But this ...
0
votes
2answers
39 views

Use Python in Field Calculator to increment up value

Please see screenshot for field calculator Python logic. I have no idea what I'm doing that's any different from this GISSE answer. The error I receive is ERROR 000989: Python Syntax Error (invalid ...
-1
votes
1answer
56 views

Understanding Python / ArcPy code? [on hold]

I am looking for a walk through of the Python code below to explain how it works in ArcGIS. #import modules import arcpy, os #set env arcpy.env.overwriteOutput = 1 ws = ...
2
votes
1answer
54 views

Is it possible to find the feature class name from a python label expression in ArcGIS?

Does anyone know how to find the path to a feature class within a label expression using ArcGIS? I don’t need to simply display the path. My overall goal is to create a python function to display ...
1
vote
2answers
38 views

How to programmatically close a QMessagebox without clicking ok or X? [on hold]

So part of my script in PyQGIS is this: QMessageBox.warning(None,"Warning","bla bla bla") The box apperas just fine but i want it to close after a few seconds so i am looking for something like ...
2
votes
1answer
31 views

How to find the distance of a point from the begning of a StringLine with shapely?

I have a route (represented by StringLine) and a location (Point) and I need to find the progress of the location in the route. The progress is the distance in meters from the begning of the route. ...
0
votes
1answer
27 views

Open MXD from network path [on hold]

MXD located in below path. I could able to open MXD from Windows explorer from dev box. I am running the script in development box and accessing mxd from the server isFile always fails. ...
1
vote
2answers
49 views

How to create folders from shapefile attributes using ArcPy/Python?

I am wondering if anyone has solved this or can help me on my code. I have a Parcel shapefile, and I would like to create folders based on the attribute data (per row) from a field in the shapefile; ...
0
votes
0answers
28 views

How to reload a raster file from the python shell

I do this in the QGIS python shell: # get the raster file (and data) of the active layer canvas = qgis.utils.iface.mapCanvas() rLayer = canvas.currentLayer() rLayerPath = ...
0
votes
1answer
25 views

GRASS Gis v 6.4.4. KeyError: 'version' when start

When I try to start the GRASS it gives me the following error GRASS 6.4.4 (Hellas):~ > ERROR: MAPSET Hellas - permission denied Traceback (most recent call last): File ...
1
vote
1answer
23 views

QGIS get the X and Y of a raster file by click

I have a raster file (Geotiff) and try to write a plugin that can change the value of one cell in a raster (== array cell). I know how to get a QGIS point but how can I get the array index from on ...
-4
votes
0answers
45 views

Write a Python script in a single file that implements Haversine's formula [on hold]

A function named haversine which takes all five inputs needed to compute the function and returns the distance between the points on the spherical earth-like surface. It does this by computing the 2r ...
0
votes
1answer
26 views

UnboundLocalError: local variable referenced before assignment wthin model builder iterator in ArcGIS

Within an iterator in Model Builder in ArcGIS I am trying to calculate a field value based on the inline variable substitution. In the picture I have renamed the tools with the corresponding inline ...
0
votes
1answer
26 views

How to get layers created in a custom toolbox python script to add to the mxd

I'm trying to create a simple search tool so that my colleagues can easily query a database. My first version is like this. mxd = arcpy.mapping.MapDocument("CURRENT") df = ...
2
votes
1answer
32 views

Arcpy if statement to act on layers at the top level of hierarchy

I am about to save copies of all of the layers in my mxd. I only want to save the top level group layers though. I have some group layers within group layers - I dont want to save them individually. ...
0
votes
0answers
5 views

how to write a netcdf4 in the right manner [duplicate]

What is the standard way to write a netcdf4? I'm using this guide http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html but when I dump the output file with ncdump, I get the error: ...
1
vote
1answer
30 views

Updating Multiple Fields in Feature Class from a Table

I have a Point Feature Class with 2 million records with 35 fields. I have another csv file (contain 25 fields) which have around 4000 records to update certain records of the Point Feature Class . ...
0
votes
0answers
23 views

standard way to write a netcdf4

What is the standard way to write a netcdf4? I'm using this guide http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html but when I dump the output file with ncdump, I get the error: ...
5
votes
2answers
180 views

How to run a python script on the server, returning the results to the client

Here's the end result I'm trying for: the user clicks on a feature on an ArcGIS Server JS map a Python script is triggered on the server the Python script uses an attribute from the feature (eg its ...
1
vote
1answer
36 views

QGIS Modeler flexibility and errors?

I'm trying to build a simple multi-step selection (by attribute) with the QGIS Modeler. I created a simple sample layer to avoid data-driven errors. Now I want to query the layer and select features ...
2
votes
1answer
19 views

Odd behavior in a QGIS plugin: my function is triggered twice

I have a plugin with a function (triggered by a button) that selects a specific layer by name, then shows its attribute table. When I close the plugin and open it again, the attribute table pops up ...
1
vote
1answer
29 views

How to select from selection with PyQGIS?

The expression box has a handy "select from selection" button. Is there a way to emulate this with python? I have the basic expressions down, but can't find a way to do this.
2
votes
3answers
28 views

QGIS python plugin appends values every time it's started

I've written a small python plugin (using plugin builder as base) to simplify the expression process for a given layer (just a few comboboxes that are used to create a query). The combo box populating ...
2
votes
1answer
48 views

Why processing.runalg(“gdalogr:rasterize”…) is not creating out files when running in the QGIS 2.6.0 console?

I want to use the QGIS python scripting functions to turn to rasterize a point vector using many different dimensions. Right now my code looks like this: import processing RasterPixelSize = ...
-4
votes
0answers
41 views

error while trying to build QGIS-2.6.1: qgis, qgis_app, qgis_gui fails for the reason qwt class couldn't found and QtUiTools.lib linking ignored [closed]

While trying to build qgis-2.6.1 from source on windows 7 32 bit with mvc++ 2008 I got the overall result ========== Rebuild All: 281 succeeded, 3 failed, 0 skipped ========== from this I am able to ...
3
votes
1answer
55 views

More efficient way to get the start and the end points of a line (arcpy)?

I am collecting start and end points for a large polyline feature class in a file geodatabase. I am using arcpy, ArcGIS 10.3, Python 2.7.3 64-bit and a 10.3 compressed file geodatabase with just one ...
1
vote
2answers
95 views
+50

How to set NULL value by arcpy.da.InsertCursor on date column?

How to set NULL value by arcpy.da.InsertCursor on date column? I try insert "NULL", None, '', 0 dictIN= [{'field1':"test1",'date1':'01-02-2015','date2':''},\ ...
0
votes
1answer
27 views

Collect last word from varied length string for filtering, auto labeling and column population? [closed]

I have been looking and reading for a few days about how to collect the last word from a varied length string. I have found lots of postings about how to collect/split the last word, but none of the ...
0
votes
1answer
18 views

Shapely (geos) crashes during unary_union

When attempting to union multiple polygons with Shapely 1.5.6 in Python 2.7.9, using GEOS 3.4.2, I get the following error in the underlying C++ code: Assertion failed: (!"should never be reached"), ...
1
vote
2answers
34 views

Inline variable substitution in Model Builder using python code

I have an inline variable substiution which I would like to import into my Python script. Is that possible? I am trying to make a parameter within my path. My path currently is ...
1
vote
0answers
30 views

If Else Statement Existence of a File With User Input [closed]

I am trying to design a block of code that checks if a user inputted directory exists, prints if it does, and if it does not. import os foldername = raw_input ("Please enter the name of your ...
1
vote
1answer
44 views

How to get a layer by name in PyQGIS?

I have a plugin which finds buffer for list of cities, provided the distance. The state and city names are taken from the attribute table and gets filtered accordingly. What I want is My plugin should ...
0
votes
0answers
20 views

Suppress values from multiband rasters

I have a raster stack with 84 bands . It is a time series raster. It so appears that the cloud is causing error in my processing and hence i need to suppress or replace them by a NaN to eliminate them ...
0
votes
1answer
29 views

ImportError: libqgis_core.so.2.9.0: cannot open shared object file: No such file or directory

I installed qgis in debian linux and I want to run a standalone app in python. So I import qgis.core and qgis.gui in this app. But it gives me an error: ImportError: libqgis_core.so.2.9.0: cannot ...
0
votes
0answers
50 views

gdal ReadAsArray returning NoneType

I'm trying to read in several rasters as array using gdal in a python script, but I keep getting NoneType returned and can't figure out why. The process is this: 1. Use gdalbuildvrt ...
2
votes
2answers
53 views

How to get cell value along Flow Direction

I have: a flow direction raster where I took off (assigned NoData value) the cells that overlayed the river network (from flow accumulation). a perfectly overlapping raster where I asigned a ...