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

learn more… | top users | synonyms

1
vote
0answers
45 views

How to define a custom function that returns value of a field in an unsaved form

Filter expression builder in QGIS 2.8 allows us to define custom functions using python. I'm intrested would it be possible to define a function which returns a value of a field in an unsaved form ...
0
votes
0answers
16 views

Attribute Table Column to Python List (QGIS 2.0)

I have a column of strings in my attribute table and I want to create a list out of this column. How can I do this? my attribute column of interest (CompanyNam) looks like this: Eva Ela REW Scot ...
0
votes
1answer
55 views

How to quantify the coverage area?

I have a task where I shall quantify AIS coverage in a predefined geographical area. The AIS is a system where automated positional data is sent from ships to base stations. I have AIS data with ...
1
vote
1answer
31 views

Python ogr filter attribute SQL

I have a shapefile with 4 attribute fields (MC_ID, MC_info, C_ID, C_info). I want to change some MC_ID values selecting the features by C_info. For example: I want to set MC_ID = 2 for C_info = g19, ...
0
votes
0answers
37 views

unable to use matplotlib in qgis using python

I have tried to draw graph using matplotlib i used this library in my qgis application but i got the error ImportError: No module named backend_qt4agg i used following code in my qgis python ...
0
votes
2answers
57 views

Using python string wild cards within the field calculator ArcGIS 10.3.1

I have two fields. One field has an ID. The other field has a list of ID's. Using the Field Calculator I with to calculate 1 or 0 if either field contain the same ID number. I was successful at ...
0
votes
0answers
30 views

Determining Centroidal Longest Flow Path using Python (and not HEC-GeoHMS)?

I've been using the Centroidal Longest Flowpath from the HEC-GeoHMS Basin Characteristics Toolbox. The explanation from the HEC-GeoHMS manual is that the centroidal longest flowpath is computed by ...
3
votes
1answer
59 views

Reading Synthetic Aperture Radar raster images using python

Is it possible to read and modify Synthetic Aperture Radar raster images using python? gdal is not able to understand their Type which is Binary (application/octet-stream). One can find sample radar ...
0
votes
2answers
61 views

Capitalizing 5th word in Python string? [closed]

I understand how to capitalize first word using !CITY_NAME!.capitalize(). However, if I have a string in a record and I want to capitalize the fifth word, what is the code for that? Ex: 3 Boundary ...
2
votes
2answers
54 views

Reserved Ampersand Character in Label Expression of ArcGIS for Desktop?

I have this code which works... def FindLabel ([NUMBERNAME], [NUMBER], [BLOCK], [SURNUM]): lineone = "A:"+ [NUMBER] absName = "<CLR red='255'><FNT size = '14'>" + [NUMBERNAME] ...
1
vote
3answers
82 views

Autopopulating text field with string and number combination

I have an attribute table with a text field which indicates a unique identifier for each row. The identifier includes a combination of text and numbers, sequentially increasing, as follows: ...
3
votes
2answers
125 views

SyntaxError from Python Label Expression in ArcMap?

I am trying to use a find label expression that changes the font of one field, [NUMBERNAME]. I am using the Python parser of ArcGIS 10.3.1 for Desktop. All fields have a data type of text. This is ...
1
vote
1answer
59 views

Efficiently Calculating Farthest Point from Origin

I'm trying to find a clever/efficient way to calculate the the farthest point from an origin, given a list of lat,lng points. For example, if trying to find the closest point from an origin I could ...
3
votes
1answer
64 views

Execute ogr2ogr from python

I tried to execute ogr2ogr from python with this shell command: ogr2ogr.exe --config PG_LIST_ALL_TABLES YES -f "PostgreSQL" -append PG:"host=hostnamet user=username password=password dbname=dbname" ...
2
votes
0answers
54 views

Gdal Python Problem : Black strips in geotiff

I am trying to use GDAL (2.0.0) Python API in Blender, but I am having some difficulties. I am trying to save geotiffs for : - a 2D numpy array storing 32bits floats - a 3 channels rgb numpy array ...
1
vote
1answer
29 views

XML Document points to the wrong location after using arcpy.BatchProject()

I'm trying to reproject a number of shapefiles representing contours from NAD_83_Albers to NAD_83_UTM_Zone_9N using arcpy.BatchProject(), but I have to use python/regex to preserve a particular file ...
1
vote
1answer
32 views

Using label expression to label highway with last group of numbers in field

I'm using Tiger road files and I want to label the highways with their shield number. Tiger has an inconsistent naming convention for road features; I am specifically concerned with the highways. I ...
0
votes
0answers
41 views

ArcGIS calculate average value

I would like to get the average value of specific attributes. I have a table with columns like: ID, P1, E1, Age1, P2, E2, Age2, P3, E3, AverageAgeP, AverageAgeE Sometimes there is a value for P, ...
1
vote
1answer
37 views

How to convert/export a large number of attribute's information shapefiles to txt/csv format using a python script

I'm using the 2.8.1 Wien QGIS version. I have a large number (more than 5000) of shapefiles that I want to convert to a csv or txt files to extract, to tables, the atributte information. The ...
3
votes
1answer
25 views

Problems with Reclassify and RemapRange in ArcPy?

I'm having a bit of trouble with a script that uses ArcPy. I keep getting the following error: ExecuteError: ERROR 000622: Failed to execute (Reclassify). Parameters are not valid. ERROR 000628: ...
0
votes
0answers
25 views

NetCDF4 Files: Missing Projection & Varying Dimensions (Multiple Files)

All, I hope you can shed some light on issues I've been having regarding NCEP Reanalysis-I netCDF-4 file format: First issue, Projection information is not stored on the downloads I obtained from ...
1
vote
0answers
56 views

way in R or Python to add image/video in map plot marker click popup/infowindow

I have many different (lat,long data) points of world associated with unique place names and corresponding each point specific image or video data. Now I want to create an html file where if user ...
1
vote
2answers
57 views

32-days composite using LST 8-days Data

I want to make a 32-days composite from 8-days LST data by taking its average value, but I am facing a problem in checking QC-day, the other thing is, due to data gaps (missing DN values) we cannot ...
2
votes
1answer
68 views

QGIS Plugins & Tools that replicate Select ArcPy Tools

I developed a complex python application for road generation from GPS Devices that uses a few Arcpy Tools. I want to try and replicate this Applications functionality using a freeware like PyQGIS ...
0
votes
1answer
53 views

Using If Statements in ArcGIS Calculate Field?

I've never used Python scripting before and can't seem to figure out how to use an If statement in the Field Calculator tool. I have a field called 'MAX_GRIDCODE' which returns the highest force a ...
0
votes
0answers
19 views

Skipping the string serialization in json.loads(OGRGeometry::ExportToJson())

I have a for loop that exports a bunch of OGRGeometry objects to a python array in what will eventually become a GeoJSON feature collection. Something like this: features = [] for feature in ...
1
vote
2answers
66 views

QgisInterface.addVectorLayer Error

I am Esri-trained, trying to move into QGIS using Python. Simply trying to add a vector layer in Qgis returns the below error: TypeError: QgisInterface.addVectorLayer(QString, QString, QString): ...
2
votes
1answer
61 views

different way to build qgis python standalone application

There seems to be 2 different ways to start a Python QGIS standalone script. The official tutorial is using : from qgis.core import * # supply path to where is your qgis installed ...
0
votes
1answer
59 views

Create a Loop for Arcpy

I am looking for help to write a loop a arcpy.CalculateField_maagement process where the User is asked with the 'raw_input', prior to the tool running "Do you need to change a field value(yes/no):", ...
1
vote
1answer
36 views

How to restrict panning in QGIS to a given extent

I'm going to build a QGIS standalone application. According to the requirements full extent equals to the extent of a predefined rectangle (say bounding box of a parcel). The application should start ...
0
votes
0answers
57 views

GRASS 7 (python:14221): Gtk-CRITICA Linux Mint

I installed GRASS 7 and QGis from the https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable (Trusty 14.04) in Linux Mint 17.1 two weeks ago (sudo apt-get install postgis libgdal1h ...
-1
votes
1answer
70 views

How to extract information from world file of images into a DBF catalog file through PYTHON?

Here are thousands of pictures in JPG or TIF format with world file such as jgw and tfw. Inside each file, projection information for each pictures were contained. One example of the content for a ...
0
votes
0answers
13 views

How to set the ALLOWED_HOSTS setting in GitHub-installed GeoNode?

I installed and developed a project in GeoNode in parallel to another CMS project in Django. The CMS runs in localhost:8040 and GeoNode runs in localhost:8000. It is important to know that GeoNode was ...
1
vote
1answer
29 views

Using WK ID's when using CreateSpatialReference tool

I recently found out how to create specific spatial reference objects and add them to my arcgis python standalone script. ...
2
votes
2answers
89 views

Raster image thresholding using python

I would appreciate if someone could guide me for applying thresholding technique to input raster image using Python. I intend to extract impervious surfaces from a high resolution raster such as ...
0
votes
0answers
49 views

How to write a QGIS-plugin to be used in IntraMaps Roam 2.4.0?

I know some python, but I have never written a plugin for QGIS nor Roam before. I like to be able to turn layers on/off in Roam I have read the Roam's wiki, and I have managed to make a plugin called ...
2
votes
2answers
38 views

How to calculate field as a substring of another?

I have a text field, field1, that's populated with 14-digit identifiers, like "01234567890123". I create a new field, field2, that I want to show the first four digits of field1. I would like to do ...
2
votes
1answer
59 views

Looking to find (or build) a particular Python geoprocessing tool

So here is my situation: There is a large area (a wildlife refuge) of nearly 200,00 acres that we have loads of spatial data for, from habitat management projects from the past several years. My boss ...
2
votes
1answer
46 views

How to split name in label so only first two words appear?

The labels for my feature SSA_NAME are approximately 5 words long. I would like to shorten the labels to only 2 words. Every time I try a different code I receive either an error message or my layer ...
1
vote
0answers
101 views

Minidump on exit in QGIS (2.8.2- Wien) 64-bit version when using GDAL in plugin

I am working on a plugin for QGIS that is working fine on 32-bit versions but I am having some problems while using it on the 64-bit standalone installation package. I have tried on several machines ...
5
votes
1answer
145 views

Cutting a circular buffer via Arcpy

I am currently working with compressor stations on centerline routes. These compressor stations have a 3 mile buffer surrounding them. I wish to cut a portion of the circular buffer off. These cut ...
1
vote
1answer
97 views

Changing colours in GeoPandas?

I have a very simple map (http://www.nyc.gov/html/dcp/download/bytes/nybb_15b.zip) and I have never before worked with shapefiles in any way. Can someone tell me what I need to do in order to change ...
1
vote
1answer
38 views

Gdal ReadAsArray() different values than gdal band statistics

I am confused about why if I open a band with GDAL I get, for example, band.GetMaximun(): 1000, but if I do ReadAsArray I get myArray.max(): 1200 (the same if I do np.max(myArray)). Does someone knows ...
2
votes
0answers
36 views

QGIS QgsLayerTreeGroup signal “currentLayerChanged”?

In a pyqgis context, I use the "currentLayerChanged(QgsMapLayer *)" signal of the QgisInterface class to do something when the current layer is changed, but I need now to do the same when I select a ...
2
votes
2answers
194 views

image segmentation of RGB image by K means clustering in python

I want to segment RGB images for land cover using k means clustering in such a fashion that the different regions of the image are marked by different colors and if possible boundaries are created ...
1
vote
0answers
39 views

rasters written with gdal show up with units of meters when they should be degrees

I have some SMOS soil moisture data packaged in a netcdf format distributed by "cp34-bec". I have been able to use GDAL to extract this data as a raster layer, using a projection i think is ...
2
votes
1answer
29 views

Redirect remote shell command output to ArcMap geoprocessing tool display?

I have a Python script that runs a shell command on a remote server (using the Fabric module). When I run the tool in the debugger, I see all the output scrolling, as the command can take hours to ...
0
votes
0answers
31 views

why did my python mysql script stop working, with error on fetchone()?

This code was working a couple weeks ago, then without changing anything, it started throwing an error. Here's the code: #Query climate table sFrom = dateIncrement.strftime("%Y-%m-%d ...
1
vote
1answer
39 views

Python: how to set a different output folder

I want to transform some vectors to rasters in my folder but I have difficulties setting the output folder. The following code only allows me to output to the original database. I hope to output all ...
1
vote
0answers
46 views

PyQGIS Standalone Crashes python.exe when zooming out too far / Process finished with exit code -1073741819 (0xC0000005)

I have the following PyQGIS Standalone App which is working fine so far. One little problem is that if I zoom out to the MaxExtent(by scrolling the mousewheel) the app crashes python.exe so that the ...