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

learn more… | top users | synonyms

0
votes
0answers
12 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
6 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
24 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
44 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
23 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
29 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
48 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
19 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
28 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
84 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 ...
0
votes
0answers
21 views

How to call the Qt UI of a script? [on hold]

I'm pretty new in the python world, and I'm working with the python console inside QGIS (Master version on a Debian machine). I have written some scripts, all of them are in the same directory (e.g. ...
0
votes
1answer
36 views

Changing colours in a simple shapefile

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
22 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
23 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
42 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
20 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
18 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
18 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
26 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
12 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 ...
2
votes
1answer
25 views

Error: Algorithm not found (QGIS)

I wrote the following code using QGIS'API. import os from qgis.core import * import qgis.utils prefix_path = os.environ['QGIS_PREFIX_PATH'] QgsApplication.setPrefixPath(prefix_path, True) ...
2
votes
1answer
30 views

How to add a message bar to custom canvas?

There is a simple code to add message bar to main window in QGIS: iface.messageBar().pushMessage("Hello","World") My question is how to add bar to my custom canvas canvas = QgsMapCanvas() in ...
1
vote
0answers
18 views

import qgis.core problem with QgsFeature and QgsGeometry ImportError: DLL load failed: The specified procedure could not be found

I've tried several previous answers to similar questions - no luck. I've tried everything, nothing seems to work. This is the error I'm getting Traceback (most recent call last): File ...
0
votes
0answers
13 views

Pythonw has stopped working when running arcpy.SubsetFeatures_ga

I'm currently trying to subset a shapefile into training and validation files. When I run the following line of code, python crashes. I'm using ArcGIS 10.1. arcpy.SubsetFeatures_ga(current_shapefile, ...
0
votes
1answer
16 views

Semi Automated Classification plugin (QGIS) error when trying to create ROI

When I try to create a new ROI through Semi-Automated Classification plugin (SCP) for QGIS, I keep getting a message saying: "It appears that SciPy is not correctly installed. Please, see this page ...
2
votes
1answer
19 views

problem deleting shapefiles because still in use by arcpy cursor [duplicate]

I have a function outputTblContents which contains def outputTblContents ( path ): rows = arcpy.SearchCursor(path, fields="alpha; beta") for row in rows: print("{0} => ...
0
votes
0answers
20 views

Extracting pixels latitude into new raster [on hold]

when extracting pixels latitude into new raster the boundary not matched, what shal in do? # -*- coding: utf-8 -*- #!/usr/bin/env python print("Started\n") import gdal import numpy as np ...
2
votes
1answer
32 views

PyQGIS standalone script does not work. Error “QGraphicsScene::addItem: item has already been added to this scene”

I try to test a PyQGIS standalone script which should just show one Shapefile. Sounds pretty simple but does not work. Here is my script: from PyQt4 import * from PyQt4 import * from PyQt4.QtCore ...
1
vote
1answer
46 views

“Browse” button returns python error in QGIS

I use the latest version of QGIS (2.8.2) in MAC and have se the default Python version 2.7. Moreover, I have installed all the required python modules and GDAL. It was working before, but now, when I ...
0
votes
2answers
56 views

Remove first seven characters from field string using Field Calculator

I wrote an expression/codeblock that removes the words "Nearby:" from the field value string if it has it. Codeblock: import string def splitme(s): if s[:7] == "Nearby:": aList = ...
0
votes
1answer
25 views

Generating elevation 'database' from NED IMG data

I'm starting to work with the NED 1/3 and 1/9 arc-second data. I've been using gdal in Python and QGIS to do some basic conversions of the raw .IMG data from USGS. My goal is to get elevation data of ...
0
votes
2answers
47 views

Calculate field in modelbuilder

If vb code is also possible I could give that a try aswell.
1
vote
1answer
38 views

Adding Vertical Reference in Python to ArcGIS feature dataset

I am creating a python script to generate a terrain. In the process I am creating two feature datasets. However, in order to successfully create this FD, i need both horizontal and vertical datums. I ...
0
votes
1answer
38 views

Can't get the where clause in Select layer by attribute working!

I am trying to develop a script that searches for a particular ID in a user selected field. To this end I have used the select layer by attributes tool to search for a derived number in a field ...
0
votes
0answers
22 views

Is it possible to save a dxf in memory

Following on from my question here, when I run the ExportToCAD tool arcpy.ExportCAD_conversion(listOfLayers, formatRelease, location + fileFormat, "Ignore_Filenames_in_Tables", ...
1
vote
1answer
53 views

How to differentiate between land and sea in python?

I'm going to plot some positions of ships, and thus see which areas (out at sea) where there is no vessels, however, if I do this in an ordinary geographical area defined by a square, all the land ...
1
vote
0answers
46 views

Using gdal_merge to merge a large amount of files (in pairs)

I'm new to python and how it can be applied to gis. I have a large amount of MODIS files to go through and I've already extracted, reprojected and converted to GTiff the bands that I need from each ...
1
vote
1answer
37 views

Setting PYTHONPATH for compiled QGIS version on Linux

I'm trying to set the PYTHONPATH in order to be able to load the qgis classes in a python console (not the QGIS Python one). I followed some resources I've found (PYQGIS Cookbook, and others) but I ...
1
vote
1answer
68 views

How to register “events” for linear referencing in pyqgis?

Is there an easy solution for recording events for a line crossing borders of zones in a polygon layer? I need to implement this in python using QGIS, thus pyqgis. The image attached illustrates what ...
1
vote
1answer
58 views

How to select polygon features that intersect a line feature using pyqgis?

Is there an easy way to select all features in a polygon layer that intersect (overlap) a line feature? I need to implement this in python using QGIS, thus pyqgis. This code illustrates what I am ...
0
votes
1answer
34 views

Get Data for ArcPad extension and python

Is it possible to call the 'Get Data for ArcPad' extension using python? If so would someone be willing to share their code?
3
votes
3answers
66 views

How do I compare two features to test if they are identical?

What is the most efficient method for determining if two features (points, lines, or polygons) are geometrically identical? I'm not concerned about a square figure that contains eight vertices (four ...
1
vote
2answers
32 views

Adding new field and populating with shapefile name

I have a set of shapefiles that need a new field adding to them called "Policy_Ref". I then need to update this field with the shapefile name. However when I do, it uses the full title, including the ...
1
vote
1answer
32 views

What tool would be best for getting the max value out of Identical ID rows?

As the title may imply I want to keep the maximum value in field2 for several identical IDs in field1, the others are deleted for example this table: Field1 Field2 14772 1 14772 4 14766 3 ...
6
votes
0answers
181 views
+50

Python toolbox works in ArcToolbox and in Python console, but not in ArcCatalog

I have a set of Python tools in a Python toolbox (.pyt). They are broken into multiple files and modules and have been functioning correctly, but now I'm seeing inconsistent behavior on multiple ...
1
vote
0answers
13 views

Accessing elements Linestring and points from a DGN file and displaying both layers on QgsMapCanvas

I am using PyQGIS APIs to develop a standalone application which currently display's map data layers on QgsMapCanvas from .shp, .tif, .dgn files. I am able to do it for .shp and .tif but not for .dgn ...
0
votes
0answers
16 views

Re-name using first letters of feature class name [closed]

I have several feature classes and I want to rename them using the first letters of every word in their name (Proposed_Road_Network -> PRN) with python but I do not know how as I have very limited ...
0
votes
0answers
24 views

Implementation of script for bus waiting stops

I've tried to add waiting time in bus stops in several ways (elevation fields, sub-segments, etc), but nothing worked. I'm now trying to use this script I've found in Internet: if (SourceID of ...
2
votes
3answers
113 views

Using .len() in IF THEN statement in ArcMap field calculator

I have a string field with values of varying lengths (1-4). I need each value to have a length of 5 characters by adding zeros to the value until the length equals 5. For example: 123 needs to ...
3
votes
1answer
45 views

add text value to attributes

this is a novice question I have an attribute field that's missing a piece of information, i'd like to amend the attribute field like below: This is the current attribute field: "V:\Building & ...