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

learn more… | top users | synonyms

4
votes
1answer
69 views

How do you set the position of a plugin window when you start the plugin?

I'd like to set the position of a plugin's window or dialog relative to the map canvas frame. For example, if I start a plugin, I want it to appear somewhere in the left upper corner of the map ...
0
votes
1answer
39 views

How to add new columns with attributes in existing Qgis layer?

How to add new columns with attributes in existing Qgis layer? Doing the "same thing" here described
0
votes
1answer
39 views

What is a simple python code to practice with in arcgis? [closed]

I am trying to familiarize myself with python code. Could someone give me a simple code with an explanation of what it does so I can practice? Or a few codes with explanations if you have the time
1
vote
2answers
48 views

Creating shapefile from selection - remove from map

I am iterating over a shapefile and creating a new shape from each row. I will be creating several thousand individual shapes and do not want to inundate my TOC with that many layers (I bet ArcMap ...
4
votes
1answer
39 views

Can QGIS map canvas update while python script is running?

I want to automate a periodic refresh of the QGIS map canvas with updated shapefiles. A Python plugin or console script does not allow the map to update until the script terminates. Is there a way to ...
5
votes
2answers
226 views

Is there a way to calculate closest distances to a point without using Near Analysis?

I frequently get asked to calculate distances from a specific point (A drilling well in the middle of the sea for example) to a number of Environmental layers (Protected Areas, Pipelines, Other wells ...
2
votes
1answer
62 views

Python console not working at all

My python console won't work at all. I can't open it. My QGIS version is 2.4. OS is win7 64. I've reinstalled QGIS a few times but I always get the same result. Strange. Something went wrong with the ...
4
votes
1answer
48 views

How to extract certain values from a table using the SearchCursor Tool

I am trying to write a python script to extract certain values from a table: the table I am referring to is a big collection of nitrate values for different water depths, which are deposited in the ...
2
votes
1answer
26 views

Open a .osm.pbf file with fiona in python

I would like to open a .osm.pbf using fiona in Python. I can't find much documentation on this. How can I does one do this? I have done it using ogr2ogr.
1
vote
2answers
79 views

Concatenating fields with label expressions using Python

I am trying to combine three numeric fields together for a feature's label. I only want to label the feature if it is over 0. The labeled numbers need to be separated a dash ("-"). This is what I ...
3
votes
0answers
35 views

ArcPy: Initialize zero valued grid Raster and iteratively increment

I'm jumping right into ArcPy to help out a friend who needs to automate some ArcGIS work. The problem at hand can be reduced to the following pseudocode: accumulationRaster = SomeZeroedRaster for ...
2
votes
1answer
32 views

Is it possible to remove parameter values from the Python Window when running a script in ArcGIS?

When I run a python script in ArcGIS Desktop 10.1 the values from the parameters will be written to the Python Window (marked with red in the picture below). Does anybody know if it is possible to ...
1
vote
2answers
52 views

Arithmetic on rasters with variable names in Map Algebra/Spatial Analyst?

I'm a Python (and StackExchange) novice trying to figure out how to perform calculations on temporary rasters with variable names. My attempt at a minimum working example is below, but I would ...
-1
votes
1answer
37 views

Displaying Shapefiles using Python? [closed]

I have some shapefiles, which I want to display in Python. Is there any code for that?
3
votes
2answers
55 views

GDAL (Python) Aggregate Raster Into Lower Resolution

I have a (continent-scale) raster with 30m resolution in an Albers equal area projection. Each 30m cell has a value 1-34. I would like to aggregate information from this raster into a 1km grid such ...
2
votes
1answer
32 views

Use point shape file to spatial query multi polygon shape files with python?

I have an address point layer and would like to spatially query this layer using various polygon shape files to intersect this information so that each address contains the attributes from these ...
4
votes
0answers
38 views

Rules of Nodata value?

What are the arithmetic rules that govern Nodata values? Regardless of how these null values are defined? I am using ArcMap Raster Calculator. I am thinking specifically of operations like 1*Nodata ...
2
votes
1answer
53 views

arcpy.AsShape function returning RecordSet not Geometry

I have the following code: feature_geometry = arcpy.AsShape(json_string, esri_json=True) print feature_geometry print type(feature_geometry) >>><geoprocessing record set object object at ...
4
votes
3answers
63 views

Install gdal in CentOS without Root

I have been struggling to get python setup to do some image processing, so I really need the http://www.gdal.org/ GDAL libraries installed on CentOS 6.5. I want to install the package in a local ...
2
votes
1answer
69 views

Naming directories in python?

Why is it that when I label my directories this way: arcpy.env.overwriteOutput = True arcpy.env.workspace = "C:\\Users\\Documents\\ArcGIS\\Testing" arcpy.env.scratchWorkspace = ...
1
vote
1answer
64 views

Pyproj: converting WGS84 to Robinson

I have a WGS84 coordinate pair (37.7749295, -122.4194155). I have an image that is a Robinson Map Projection of the world. I'm trying to write a python script to locate my WGS84 coordinate on my ...
1
vote
1answer
29 views

Convert WKT (or geojson) geometry to numpy array of coordinates

I am looking for the fastest way to convert WKT or geojson geometry from string to numpy array of coordinates. Is it possible to do it strictly in Python and without creating geometry object such ...
2
votes
0answers
40 views

Filtering MSSQL layers in QGIS doesnt work

In my QGIS Plugin I am filtering layers with this Python code: FeatureIterator = layer.getFeatures( QgsFeatureRequest().setFilterExpression ("Fieldname='SomeValue'") ) for feature in FeatureIterator ...
4
votes
1answer
60 views

QGIS Processing Progress

I have been developing a python plugin that uses Processing algorithm for raster calculations. I want to support the gui with progress bar. How can i connect Processing job to progress bar? I found ...
2
votes
1answer
25 views

Get min-max values of a raster and populate two parameters with the values in tool validation script

I am customizing the script tool behaviour of a custom script and would like to get the min-max values from a raster self.params[0] and populate the next two parameters, self.params[1] and ...
2
votes
1answer
33 views

Convert polyline to presence absence raster in arcpy

I have a polyline that I am converting to a raster in arcpy. This is occuring within a loop and at each iteration I change the processing environment to a different area of interest. In this case it ...
2
votes
2answers
40 views

Merge classes using Reclassify in python

When I run the Reclassify tool from arcmap 10.1 and assign a 1 to each of the crop types it combines them into one class. However, when I try to recreate this in python it does not merge the crop ...
1
vote
1answer
37 views

Unable to use kartograph.py

This is probably a very simple fix. I was able to download and install the Kartograph.py library. When I call it from the command line I am getting: kartograph is not an external command Usually ...
3
votes
2answers
50 views

Using ModelBuilder, how to define directory while using a Python script?

I have a model (shown below) in which at the very end of it I run a Python script ('SumFieldInsertNew'). One issue I'm having is that I'm creating this model for an end-user that will have little to ...
1
vote
1answer
46 views

Programmatically export a Qgis project

I have a QGis project that I programmatically modify using the Python xml.etree library. Now, I would like to know if it is possible to add few lines to my script in order to export the modified ...
1
vote
1answer
32 views

trouble with code block execution in python script

I am trying to calculate values for a field in a python script, but keep getting an error that I don't understand: ExecuteError: ERROR 000539: Error running expression: Fron000000F1 Traceback (most ...
1
vote
1answer
104 views

Installing pandas with Esri's python?

Trying to get pandas to import, but I'm getting what looks like an error caused by a failed dependency of the version of my Esri-provided numpy's compile, based on this stackoverflow posting. Here's ...
4
votes
1answer
110 views

Can ArcGIS ModelBuilder be exported to Python and run in QGIS?

Is it possible to construct a geoalgorithm on the ArcMap modelbuilder, export this entire algorithm to python syntax (without having ANY knowledge of python) and then import this algorithm to QGIS and ...
3
votes
1answer
147 views

How to use outdated arcscripts

I need to use the Vector ruggedness measure (VRM) tool available from http://arcscripts.esri.com/details.asp?dbid=15423. However, I am using the latest version of Arcgis and these tools are made for ...
3
votes
1answer
58 views

No get more option in QGIS

I have recently installed QGIS and trying to work with it but I don't see this option "Get More" at all. As suggested by some previous source, I also checked whether I am behind a proxy but that isn't ...
0
votes
1answer
27 views

Expression to display Image in MapTips?

In ArcMap, is it possible to display an image by using a path in the attribute table to show an image in MapTips? Any Python or vbScript expression are welcome as long as it is MapTips which shows ...
1
vote
1answer
24 views

Adding some background information to a layer

I have 2 Python Qgis plugins. The first plugin is creating a QgsVectorLayer via the ogr dataprovider. The second plugin is offering some services on the features in the layer. I need to pass some ...
1
vote
0answers
23 views

pyQGIS 2.0: Sending signal when identify button is pressed via gui

I have a question regarding the qgis identify tool for version 2.0. I would like to know if it's possible to send a signal when the actionIdentify is triggered by the user via the gui. I'm trying to ...
4
votes
1answer
80 views

Find max and min values from a table based on two fields

I have a geodatabase table with the following fields: County_Name, State_Name, Date_Time, Customers Example Alameda, CA, 8/1/2014 12AM, 6 Alameda, CA, 8/1/2014 1AM, 1 Alameda, CA, 8/1/2014 2AM, ...
6
votes
1answer
85 views

How to get layer list of layers that are published?

I'm stuck. I've been using geoserver with python extension gsconfig library for a while now. Almost everything works as it should be. While there are little things like publish raster images are ...
2
votes
1answer
53 views

Problem with Python codeblock recognizing a field

'<'First Post Alert> I've been through multiple iterations / gyrations, and while there may be multiple problems here (and I'll appreciate feedback on all of them), the recurring issue is that the ...
1
vote
2answers
35 views

Is there any efficient way to create a raster with pixel value representing a unique id calculated based on pixel lat/lon?

I have 10m raster for each state in US. Current pixel value represents something. I want to have 'same' raster but pixel size representing a unique id calculated based on pixel lat and lon. I am ...
2
votes
0answers
53 views

QGIS API - Print Composer Template produces empty map?

I have a print composer template which I'm trying to populate with different subset queries from a CSV-derived vector layer using the Python API. However, all the output PDFs contain everything except ...
4
votes
0answers
53 views

Preparing Huff model with data to use in QGIS? [closed]

I'm trying to find out about the notion of potential of acessibility using the methods of Huff. I´m using QGIS, with point data (with the variables that I would like to use) and polygons for Europe ...
2
votes
1answer
40 views

Conditional Statements in QGIS raster calculator?

What is the equivalent statement of the following expression in the QGIS raster calculator? Con(((Abs("DEM" - "FSMin") > 120) | (Abs("DEM" - "FSMax") > 120)), 1, 0) I have no problem ...
2
votes
1answer
44 views

How can i add script with math functions to model builder?

I am very new to model builder + python. (Sorry for my english too) I am trying to make a model. Don't know if it matters to upload it. If you want i can. I want to calculate variance from a ...
2
votes
0answers
24 views

Memory layer or QgsVectorFileWriter Error?

Currently this excerpt of code will not save to file (as it is supposed to). The memory layer is visable and editable. Yet even when manually saving the layer, any priorly added features ...
1
vote
0answers
10 views

Proper updating of new memory layer geometry?

Current workflow for a toolbar button: -create memory layer -save memory layer to shapefile Then the user uses the built-in QGIS tools to add geometry and finally saves changes via the auto prompt ...
6
votes
2answers
247 views

Versions of Python & QGIS for new user to both to install?

I have used GIS (very basic functions), but now want to be able to customize to my needs. My initial research leads me to believe that Python + QGIS is the way to go. I understand that there are ...
3
votes
2answers
90 views

Calculate Field Syntax: If statement over many fields

Apologies if this has already being asked but I couldn't find a page pointing to this problem. I'm struggling with the python syntax in the Calculate Field so that, in the table above: if b, c, d, ...