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

learn more… | top users | synonyms

0
votes
2answers
74 views

Renaming filenames to a standard filename format using Python

I am working within an ESRI ArcGIS environment. I have a folder full of .xyz files that are named to a specific old file format such as 2014516_MS_005.xyz I want to be able to loop through the whole ...
2
votes
3answers
136 views

Why script works on my computer but not on another?

The script below works perfectly fine in my computer. But when running the script on another computer, I receive an error: Error: Algorithm not found The computer has similar specifications to ...
1
vote
1answer
34 views

smallest, lossless, GDAL ready image format

I would like to know what the smallest file format is I can use with GDAL that fulfills the following criteria: lossless compression (relatively) easy to read/write with GDAL Python bindings least ...
2
votes
2answers
20 views

How to make a list of ESRI GRID rasters in Python

Tipically, ESRI GRIDS are not defined by a file extension like for the .tif files, but they are stored in a info folder plus an extra folder corresponding to the name of the raster. Arcpy allows to ...
0
votes
1answer
36 views

Concatenate Multiple String Fields and Convert to Date field using ArcGIS Field Calculator?

I'm Working in Model builder using the calculate value tool. I have three columns - SignatureDay, SignatureMonth, SignatureYear - All three are string data types and all consist of just numbers for ...
0
votes
0answers
44 views

Download offline satelite to be used for python app [on hold]

I need to download a high resolution map close as i can get that is publicly available as a satellite image to be used offline from the internet about to be used in my python app. This map will be ...
1
vote
0answers
18 views

How to reach the geometry (polygon, polyline) of a dxf in python-ogr module

this might be a basic question, but I am rather new in ogr. I wish to collect all lines from the dxf file and create their boundary. I loaded the layers (ExecuteSQL( "SELECT DISTINCT Layer FROM ...
0
votes
0answers
44 views

Create feature class/layer with data in python list

I want to programmatically add a layer to an MXD. The data for the layer is a list of tuples. From I what see, I need to create a feature class with this data (called invalidDataList) Below is what I ...
1
vote
0answers
25 views

Using processing using other output (result from another algorithm) as input

I have a problem. I am developing a standalone app in python and I need to use processing algorithms. I was able to use one algorithm without erros but I need to run other processing algorithm which ...
0
votes
0answers
23 views

True Altitude of GPS cooridnates

Given two points a=(lat1, long1) , b=(lat2, long2). I want to divide the line between a and b into points with equidistant length. (for example 100 Points) For each of these points i need to ...
2
votes
1answer
30 views

QGIS toolbars source code

I can see the source code of the core QGIS plugins from the repository in github. But is there any repository of source codes for QGIS toolbars also?
0
votes
0answers
8 views

Installing Python MapScript Bindings on Windows

I've run into an issue today getting the Python MapScript bindings to behave today. Traditionally, I just use the MapScript bindings that come with the ms4w package. They had been working, although ...
2
votes
2answers
98 views

Find the first occurrence of any letter in an alphanumeric string [on hold]

Working in arcgis desktop 10.2, I use python scripts to split some strings, found in an attribute table. Most of them were quite easy to split, but here is one that i could't manage to break. ...
1
vote
1answer
31 views

errors after installing 64 bit background geoprocessing on ArcGIS desktop 10.2.2

I installed 64 bit background geoprocessing on my ArcGIS 10.2.2 and then changed my pythonpath to "C:\Python27\ArcGISx6410.2" so that my code can benefit from the 64bit. then I had to install a 64b ...
0
votes
0answers
27 views

How to deal with contour error “Exception encountered: invalid index”

I have include vector layer using postgis database with filter(data between two dates) it work fine but after adding when I trying to make a contour from it I get error Exception encountered: ...
0
votes
0answers
31 views

python code doesn't preserve original range of values from my raster colormap template

I'm working towards an animation or movie of some distributed model output so I need to use a batch process for several hundred rasters that applies a consistent colormap and value range, however the ...
3
votes
2answers
35 views

Send signal when attributes modified - QGIS 2.6

For a QGIS 2.6 python plugin, I am trying to send a signal when an attribute value is changed (values for an existing feature are updated or added and the attribute form dialog is accepted). This ...
3
votes
1answer
38 views

Python output for batch “FeatureToRaster” in ArcPy

I am trying to batch process the conversion of shapefiles to rasters. I am stuck on how to specify the name for each output raster file. Part of the trick is that my input shapefiles are the names of ...
1
vote
1answer
21 views

Why use QgsFeatureRequest() when iterating?

I am unclear on why one should use QgsFeatureRequest() when iterating over a file’s features. Let’s say I would like to print out all IDs in my currently active dataset. Now, most examples will ...
1
vote
1answer
45 views

problem with adding 64-bit background geoprocessing to ArcGIS 10.2.2

My code written in python language using Arcpy works perfectly with small to average size datasets; however, with a big dataset, the script stops in the middle of execution which most likely is due to ...
1
vote
2answers
79 views

Insert.da.Cursor, Error - Sequence size must match size of row

So I'm working on this script which creates a table within a geodatabase. It then grabs the unique values from a list and attempts to insert them into the table using an Insert Cursor. I get the ...
2
votes
1answer
18 views

Python-OGR how update the geometry of a point

I need to change the coordinates (geometry) of some points in a shapefile. I can't find the good method. if ( zone[best_y, best_x] >= ( nb_pixel_area - toler) ) and ( zone[best_y, best_x] <= ( ...
0
votes
0answers
20 views

K-means cluster analysis with initial centers with ArcGIS

I am trying to figure out a way to make a K means cluster analysis using initial centers for the clusters, and only classifying, no iteration, for the features in a feature class. Having a feature ...
3
votes
1answer
41 views

methods for converting coordinate datum and format in python?

Related to an earlier Q&A of Missing grid shift files for cs2cs.exe? ... what are the various methods to convert coordinate datum and format in python? (Windows Vista, python 3.4) For example, ...
1
vote
1answer
22 views

Adding Origin to Geotiff using Python GDAL?

Alright, so I'm getting closer to figuring this out but I'm stuck at one (that I know of) thing... how do I use GDAL to apply a known origin of a GeoTiff to another that has been processed in ...
2
votes
0answers
34 views

Efficiently generate Voronoi layers in qgis via Python

The following python commands both appear to function when called in qgis 2.6 to generate Voronoi diagrams: processing.runalg("qgis:voronoipolygons", pointLayer, 1, None) ...
1
vote
2answers
30 views

GeoTiff to ndarray

What is the most elegant way to import a multiband GeoTiff as a ndarray using Python? The most common approach I've seen is as follows: from osgeo import gdal arys = [] ds = gdal.Open('sample.tif', ...
2
votes
1answer
73 views

Run processing toolbox outside QGIS in standalone app

I am developing a standalone app in Python, using QGIS libraries including processing algorithms. I am developing in Linux environment and I put the libraries in a folder. Also I put the processing ...
1
vote
0answers
12 views

Ogr Python API: set null values in feature

Im trying to convert OGR geodata from one driver to another, like the command line tool ogr2ogr do, but using the python API. My problem is, that the NULL values in the input data are converted as ...
1
vote
0answers
23 views

Longest Common Subsequence for trajectory matching in Python

Is there any fast implementation of the Longest Common Subsequence algorithm for trajectory matching in Python? Ideally it would work with trajectories of different length in 2d spaces.
1
vote
1answer
33 views

Error using arcpy.da.SearchCursor and MakeFeatureLayer

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...
0
votes
1answer
46 views

Add field to feature class by location

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...
2
votes
1answer
61 views

Edit attribute table for shapefiles in folders and subfolders with arcpy?

Continuously to Merge shapefiles in folders and subfolders with arcpy I try to edit attribute table for 20 shapefiles that spread in big a folder and are divided to a lot of sub folders. All ...
0
votes
0answers
24 views

mapserver python mapscript WFS RAW POST data

I installed mapserver-6.2.2 and python mapscript in a Openshift gear (Red Hat cloud). But I can't work with WFS RAW POST data. This is my configure line ./configure --prefix=$OPENSHIFT_DATA_DIR ...
0
votes
0answers
39 views

Tool to create triangle buffer using Python in ArcGIS Desktop? [on hold]

I want to make a tool to create triangle buffer by python script in ArcGIS, like circle buffer that we use it in ArcGIS Desktop? I need a tool that allows user to input the length of sides of the ...
1
vote
1answer
53 views

Tool to delete all data from a shapefile

I am looking for a tool that deletes the data in the shapefile, and then copy and pastes all the features from a layer into the blank layer. We get updates to our layer from a separate organization, ...
1
vote
1answer
52 views

What is the purpose of some functions and files in QGIS Python plugins?

I'm just trying to understand the architecture of a QGIS Plugin created with the QGIS Plugin Builder, as well as the workflow and the linkage among generated files. If possible, I'd prefer a diagram. ...
2
votes
0answers
45 views

Overwriting layers in a geodatabase maintaining its position in a feature class list

I'm working with ArcGIS 10. I work on ecological habitat mapping. I have some features classes inside a geodatabase which represent years of data on a specific area. Each has a reliability field with ...
3
votes
1answer
40 views

specifying extent in GDAL's WriteArray

Is it possible to specify the extent when creating an empty raster in GDAL? I looked everywhere, but can't seem to find anything. The portion of my script where I write the raster would look something ...
2
votes
5answers
146 views

Field Calculator expression to replace string only if it occurs

I have two fields (STREET1 & AKA_STREET_TEST1). I'm having a problem creating a simple IF THEN Python statement in the Field Calculator box. I've been searching the threads for a similar ...
1
vote
2answers
41 views

Is it possible to toggle draft mode in ArcGIS with Python?

I'm curious if it is possible to toggle on and off 'draft mode' in layout view in ArcGIS using python scripting. Does anyone have any ideas? Python is preferred, but if there is another solution in a ...
1
vote
0answers
17 views

pymodis download issues

I'm trying to download and process MODIS imagery using pymodis. I have Python 2.7.8 (Spyder), numpy 1.9.1 and gdal 1.11.1. I've also installed WXPython. I originally tried to use the ...
0
votes
1answer
54 views

Python Scripting Error (Adding a Field)

I'm using this code as a python script tool in ArcGIS 10.1: import arcpy, os arcpy.env.workspace = r'W:\S&P\s&p techs\Emily\Errors.gdb' #Looping through dissolved feature classes, adding ...
0
votes
2answers
37 views

Field calculator to copy numeric values from other fields

FieldA contains text: both numeric(123) and alpha-numeric(123a, 2-3, 3/2, '). FieldB is longstring. I want to use field calculator and codeblock on FieldB to bring from Field A only the numeric ...
1
vote
2answers
66 views

How to add 2 layers in qgis and display them at the same time

I added 2 layers in qgis using python but only one layer is shown on canvas. After clicking (anywhere on the canvas) both layers are displayed. layer = ...
2
votes
1answer
33 views

How to plot trajectory points on maps in python

When I read the paper Characterizing Urban Landscapes using Geolocated Tweets, I'm attracted by the figures illustrated in it, like this: And I want to know how to plot these figures for my own ...
1
vote
0answers
46 views

Connect to QGIS 2.6 Python Plugin function via button on custom feature form

I am trying to connect to a QGIS 2.6 Python plugin function via a custom feature form button. On my feature form, I'm attempting to do a few things : enable the updateButton only if the ...
1
vote
1answer
25 views

QGIS 2.6 : Programmatically setting key value pairs for ValueMap widget

Using QGIS 2.6 and Python 2.7 on Windows 7, I am trying to programmatically insert key value pairs into a ValueMap widget via a csv file. Issue is that some of the values are properly inserted and ...
0
votes
3answers
65 views

Batch Re-projection script syntax error

import arcpy sourceWorkspace = "C:\\Users\\tx8p90\\Desktop\\Lesson2" targetProjection = "C:\\Users\\tx8p90\\Desktop\\python excercise data\\Lesson1\\contourlines.shp" listDataSet = ...
1
vote
0answers
29 views

Difficulty with python package mgrs by Howard Butler

I am developing an app in python and I am trying to import Howard Butler's mgrs package. I am using setuptools to install the package. It does not find the setuptools library module. I have tried ...