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

learn more… | top users | synonyms

1
vote
0answers
11 views

In qgis using python, how can I get multiple pixels from a raster based on a vector point file

I just started working with qgis, and for the life of me I cannot figure out how to solve this problem: I have several points of interest, these are stored in a shape file (just simple points). I ...
0
votes
0answers
34 views

Alternative way to find intersection between two polygon feature classes

I have been working on making a script to find intersection between two polygon ArcGIS feature classes. I can successfully do this in arcpy instances using spatial join or using search cursors on the ...
1
vote
0answers
16 views

Using tool validation to create parameter based on fields of another parameters input?

I'm assuming I'm missing something and this is a pretty easy thing to do but I'm stumped... I'm working on a script that currently takes and input excel file and uses a "hard coded" field name that I ...
0
votes
1answer
30 views

Loop stops before expected without error message

I try to run a script that clips all the feature class of a geodatabase by the successive features of a clip layer (named pochoir). Thank to support here and here, the test of the intersection is ...
0
votes
1answer
38 views

VB to Python for Labeling in ArcGIS 10.2.1

I am really new to Python and do not understand VB. I need to convert this VB script to Python. I think it may take me a few weeks to figure out but if someone helps me I would be grateful. The code ...
0
votes
0answers
22 views

gdalwarp hdf problem

I am working with some hdf files. The following command works on my Mac. command = gdalwarp -of GTIFF -tr 1000 1000 -tps -s_srs "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs " -t_srs ...
0
votes
0answers
11 views

How to get linestringe from kml into shp or postgis [duplicate]

Im looking into extracting linestrings from a kml file into a shp file or postgis db. Each linestring would be a feature/row. How would I go about it usinge ogr2ogr or python? I'd like to get ...
1
vote
0answers
14 views

Python problem during CADInput installation

I was trying to install CADInput (version 0.60) on 2.4 Chugiak and 2.6 Brighton as well. In both cases I got an eror message during installation. For me the following extract of that message might ...
1
vote
1answer
34 views

copy only selected with CopyFeature_management

I am trying to test if each feature of a feature class list intersect each feature of a shapefile (clip layer). I'm working with arcpy in ArcGIS 10.0 The arcgis desktop help says that if the feature ...
2
votes
1answer
58 views

How to query values from a list in Python?

I have a list like this... list = ['1','2','3','4'] how can I use arcpy.Select_analysis to select features that have the attributes in the list. qry = '"SECDIVNO" IN ' + str(tuple(list)) ...
2
votes
4answers
74 views

Summarising all fields in attribute table using ArcPy? [on hold]

I was hoping to run a script that will iterate through all fields in an attribute table, SUM each field and produce the result in a table. The script below will essentially do what I want with one ...
1
vote
0answers
16 views

Set default values for value table in Python Toolbox tool

I created a Python Toolbox tool to reorder fields and create a new feature class with the reordered fields. The tool works nicely and I am able to use a value table to let the user arrange the fields ...
0
votes
0answers
33 views

Duplicate FID for points

I ran the script below to export feature vertices to points. The code works but after 10,000 points the same FID appears for 5 to 10 points. This continues for the rest of the dataset. There are ...
2
votes
2answers
69 views

Calling QGIS from MacOS python

I would like to import qgis.core and utils from my own copy of python. I do have PYQT4 installed there. I'd be happy to add to my PYTHONPATH or sys.path.append in my code, where do the qgis modules ...
0
votes
0answers
22 views

Create polygon with predefined size

I need to create a polygon (square) with a predefined size to place it anywhere in a map. The size is given in centimeter (size in cm * scale = size in real). Is that possible with postgis/qgis?
3
votes
2answers
123 views

Accessing geometry with SearchCursor in ArcPy

I'm trying to write a script that clips all feature classes in fcList by the successive rows of a clip feature. I'm using arcpy with ArcGIS 10.0 The problem is that I need to verify whether the ...
1
vote
0answers
24 views

Arcpy addin editable textbox on tool bar

I would like to add an editable toolbox on an arcpy addin toolbar. This would be used to change values of a threshold but I don't think this is currently available. (What I would really like is a ...
1
vote
2answers
71 views

Removing leading zeroes (0) when labelling in ArcGIS Desktop?

I am trying to do a simple labelling exercise however bit confused how to on how to remove unwanted '0' values. I have field with road number displayed like: 0000647, 000652, 0000000236 I would like ...
-5
votes
0answers
27 views

“UserAnswer” Invalid Syntax [on hold]

i having been making this for for just personal use, but when i run the program it seems to always come up with "Invalid Syntax" for the "UserAnswer" on everyone of them, please help... import ...
-5
votes
0answers
30 views

How do i create a simple square polygon from Python through arcpy? [duplicate]

I do not need a google search result because I checked. I need to see a code. This has been super difficult for me. Please help.
-1
votes
0answers
42 views

Error creating polygons with ArcPy [closed]

Based on the example from this page, running the code below results in an error message. Can someone take a look and tell me what I am doing wrong? import arcpy # A list of features and coordinate ...
2
votes
3answers
75 views

Converting personal geodatabase .mdb file to .gdb

Is it possible to convert an MS Access personal geodatabase file to a SDE enterprise geodatabase file format? What kind of python scripting would it entail? I need to convert it in such way to ...
0
votes
1answer
50 views

Python Script to Identify and Flip Lines Digitized in the Wrong Direction

I have a river dataset that was digitized both in the direction of flow and opposite the direction of flow. I need to find an automated method to determine which lines were digitized from downstream ...
1
vote
0answers
20 views

How to convert a raster file (*.tif) into a composite geodataset by using Python in ArcGIS 10.2.1

I created geotiff rasters (approximately 6000 rasters) in .tif format by using Matlab Mapping Toolbox. When I examined the properties of the data, I realised that it is 64 bit double type. I need to ...
1
vote
1answer
37 views

How to save changes in Feature-Geometry with GDAL/OGR and Python? (Segmentation fault)

I have a problem with my code: driver = ogr.GetDriverByName('ESRI Shapefile') dataSource = driver.Open('merge.shp', 0) if dataSource is None: print 'Could not open file' sys.exit(1) layer = ...
1
vote
1answer
25 views

What is a OGRGeometryShadow and why can't I use it in Intersects()-method?

I'm trying to script something with Python and GDAL/OGR and Shapely. What I have: two LineString geometries: "geom1" and "geom2" I made an Intersection: "intersection = geom1.Intersection(geom2)" ...
2
votes
1answer
33 views

How to create layer group in geoserver with gsconfig?

How can I create layer groups using python gsconfig ?
0
votes
0answers
28 views

Has anyone been able to programmatically generate and post web map definitions to ArcGIS Online and create web maps?

I'm using Python to build an ArcGIS Online web map definition JSON string, and then trying to post the configuration to ArcGIS Online to create a web map. I am using an admin account to generate the ...
0
votes
0answers
14 views

Help with Parameters in Qgis Python lidartools:lasclip

I am trying to use the python console to batch quite a few processes from lastools. I'm having trouble with the arguments to lasclip. clipped_las = processing.runalg('lidartools:lasclip', True, ...
0
votes
1answer
16 views

Python OGR Geometry changes Floating Points

I'm creating a Polygon in OGR and adding coordinates to it in Python. It is a must that my coordinates aren't allowed to change when adding, however they do and I don't understand why. Here is my ...
0
votes
0answers
19 views

How to create a 8Bit unsigned geotiff with gdal?

I'm trying to create a 8 bit geotiff with this code. Is there a way to use unsigned 8 bit? I only found the GDT_UInt16? import numpy as np from osgeo import ogr, osr, gdal from osgeo.gdalconst ...
0
votes
1answer
30 views

Python buffer in a line using GDAL

I am trying to make a buffer from a line using gdal. I use the example in the gdal Cookbook import ogr, os def createBuffer(inputfn, outputBufferfn, bufferDist): inputds = ogr.Open(inputfn) ...
0
votes
1answer
19 views

With QGIS Plugins/PluginBuilder, how to prevent 2nd instance of Plugin from starting

I am using QGIS 2.6.0, with PluginBuilder 2.0.3 [checking the version, I just noticed that the 2.1.0 update is available] I am writing a plugin; it installs and runs. While running, I am able to ...
0
votes
5answers
52 views

Aligning Raster Over the Polygon

I have a raster image which have to be aligned over the polygon. Both the raster and polygon have the same coordinate system. The figure shows the raster image which has to be fitted over the RED ...
1
vote
0answers
28 views

Generate random points in polygon. Algorithm question

i created a Random Point Generator in python using the algorithm described here by @whuber. The algorithm is implemented using Shapely, PostGIS and psycopg2. To boost performance pythons ...
1
vote
1answer
57 views

Computing intersections for each geometry in a table

I have a table with many Linestrings and for each of these Linestrings I need to figure out which other Linestrings, from the same table, intersect with it. If I recall correctly this gives me a ...
0
votes
2answers
13 views

Error with layer.pendingAllAttributesList

While coding to obtain individual layers' attributes (field) list, I am stymied by the code. I can identify a specific layer: MyLayer = QgsMapLayerRegistry.instance().mapLayersByName("TestPoint") ...
0
votes
0answers
21 views

Python script to get count of features that meet a certain criteria [duplicate]

I am in search of a Python script for use in the ArcGIS Field Calculator to return the number of features that meet a certain criteria. Here's where I am getting stuck: def ...
0
votes
3answers
40 views

Empty shapefile after project tool in a for loop

I am running a for loop to process a years worth of data. The entire script runs fine for the first run through, but when it runs again (when date is 1/2/2013), I get the following error: 'NoneType ...
-1
votes
1answer
49 views

Is there a way to execute tools based on the names of feature classes or raster names?

I would like to execute Zonal statistics as a table on two different raster layers that share a common element in their name. For example: one layer is called x_1980, and another layer is called ...
1
vote
2answers
58 views

QGIS Python Script - Routing along Waypoints [closed]

I used Anita Graser's script point_layer_to_route.py which worked like a charm until I updated to 2.6. With QGIS 2.6 I always get objects without any features. Can anybody tell me if he/she had the ...
1
vote
0answers
46 views

Splitting Line.shp at Point.shp with Python/ogr

I'm trying to modify some ESRI Shapefiles using Python with gdal/ogr module. What I want to do is quite simple, but I didn't find any solution by now. I have two shapefiles: (1) Lines.shp and (2) ...
0
votes
0answers
86 views

Python script to get feature count in a feature class that fall in a specific range

I need to write a Python script to be used in the ArcGIS Field Calculator that will return a feature count for values between a range defined by the values in two other columns. Here is a graphic ...
1
vote
1answer
32 views

Using GDAL's GetProjection information to make a coordinate conversion in pyproj

I'm opening a geoTIFF file in Python using gdal. Upon reading with the GetProjection() method, I find the following information ...
1
vote
0answers
46 views

With QGIS, why use QT Designer tools for creating Slots/Signals/ etc, if plugin coding can do it alone

I am curious why there is facility within QT Designer to create signals and slots as, to my surprise, I did not need to do this. All of the necessary coding was accomplished completely within the ...
-1
votes
2answers
40 views

How do I import geos from shapely? [closed]

I clearly have geos installed under shapely, since I downloaded "Shapely-1.4.4.tar.gz". Also, the result can be seen in my directory in the correct path: ...
0
votes
1answer
60 views

How to label line features using python code?

I used the following code to label the line features(roads) in a layer.It works in the console, but not by python code(application) It works for the points too. What did I do wrong? Any help would be ...
1
vote
0answers
12 views

Python Band.SetNoDataValue(), sets all bands at once

Can someone tell me what I am doing wrong? I want to set bands 1 and three to 255, and band 2 to 0. The code below only should only set band 2, but gdalinfo shows that all bands get set to 0. Ubuntu ...
0
votes
1answer
41 views

How to add mdb geodatabase layer (feature class) to QGIS project using python?

I want to add a feature class of a personal geodatabase mdb to my qgs project by code (a plugin I am working on). I am using a command similar to that used for adding shapefiles, but this is not ...
0
votes
1answer
36 views

GPX to shapefile tool error message

I downloaded the GPX to shapefile tool and when I use it I get the following error message: 1 No module named re Failed to execute (gpx2shp).