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

learn more… | top users | synonyms

2
votes
1answer
44 views

How to add documentation for QGIS Processing algorithms?

In the Processing modeler, many of the algorithm help tabs say: Sorry, no help is available for this algorithm. In the QGIS sourcecode, the processing algorithms seem to reside in: ...
2
votes
2answers
108 views

Select the most recent date from a table using Python/arcpy

Given a dataset with a date field, how would I select the row with the most recent date using Python or ArcPy?
3
votes
0answers
14 views

Action: Move pointfeature to other layer - Point becomes Multipoint

I'm trying to write an action that moves a pointfeature from one layer to another. It works fine until i try to save the layer with the new feature on. He says he can't save a MULTIPOINT to a ...
0
votes
1answer
52 views

How to make polygons clickable in Leaflet.js / folium

I'm trying to create a clickable leaflet.js map using folium and Python. After a previous query - answered here Geopandas/folium map not displaying - I've added the polygons. But I'm getting a ...
0
votes
0answers
55 views

How to create shape file and show in map using Python?

I have calculated distance between longitude and latitude by import .csv using python. Now I want to show this points or distance between points in map. So how can i do it by using only python? and ...
0
votes
0answers
47 views

GeoTiff using GDAL

How can I project a tiff using the position of the four corners where the picture have to be placed ? The tiff file has no georeference or projection information I have got a grid with values of ...
0
votes
2answers
47 views

Understanding EOL while scanning string literal from Reclassify in ArcPy?

I'm trying to reclassify a raster using a Python script. I know I can just use the tool in ArcMap, but I want to start understanding the code behind it. Can anyone tell me why this doesn't work ...
4
votes
1answer
161 views

Understanding the Use of Spatial Indexes

I'm having trouble understanding the use of spatial indexes with RTree. Example: I have 300 buffered points, and I need to know each buffer's intersection area with a polygon shapefile. The polygon ...
0
votes
0answers
39 views

Is there a faster alternative to arcpy spatial join?

I am wondering if there is a more efficient method than using arcpy spatial join in python. I am currently using intersect and closest methods (including a near distance field) so would need ...
1
vote
1answer
54 views

why does arcpy function work in ArcMap python window but not from stand-alone script?

So I think I'm running into a data/schema lock issue, but I have no idea how to tell, or how to fix it for that matter. Here's the setup: I have this chain of gp functions: #extract elevations to ...
1
vote
2answers
130 views

How to create a series of points along multiple polylines at once in ArcMap 10

I have a series of polylines that represent linear vegetation (shelterbelts, etc). I need to convert these to a series of points equally spaced in order to add them to a different shapefile that ...
1
vote
1answer
31 views

Why does the python editor “Idle” reference two Python installations?

I have installed python 2.6 with ArcGIS 10.0 but also Python 2.7 for use with gdal. I have a problem at the moment with the editor "IDLE". When I right-click on a .py script, the idle editor ...
3
votes
2answers
63 views

PyQGIS: Speed up for adding features and attribute arrays?

Context: I'm writing a dynamic import tool for QGIS (2.2 to 2.5) with python. Datatype: Binary Datasets with environmental simulations from HPC which might contain millions of features and terabytes ...
1
vote
1answer
85 views

How can we merge the two selected features in a vector layer

I have taken one feature and find which are the neighbouring features to the feature which i have taken and then i have combine all those neighbouring features with my feature to make one feature. i ...
2
votes
0answers
51 views

How to add column to attribute table using field calculator with $length function?

I used the following code to add a separate column to the attribute table with the length of features. from PyQt4.QtCore import QVariant from qgis.core import QgsField, QgsExpression, QgsFeature ...
2
votes
1answer
122 views

How to load a WMS layer using PyQGIS?

Although there are some posts on this matter, there is no answer in anyone of them. This is why I am asking it again. One post I found was Raster layer invalid I read information from the following ...
0
votes
0answers
16 views

What's a python script to get count of attributes in feature class? [duplicate]

I would like to count the number of attributes in my feature class with python.
2
votes
1answer
44 views

How can I extract the data showed in Version Changes before reconcile/post process?

I want to make a script in python to extract the data about version changes before make the reconcile/post process. Is that possible? I trying to avoid use C# or VB script.
4
votes
2answers
107 views

Selecting points on one side of the road

I am a newby in python scripting in GIS. I have 2 shapefile: first one with roads and second one with points that contains address number and street name. I want to select these points from right ...
2
votes
2answers
55 views

Find coordinates of given raster value

I would like to get the coordinates of a raster cell with a given value. I suppose many cells can take the same value, in which case several coordinates should be returned. In my first problem I'm ...
2
votes
1answer
45 views

Python Geospatial Development Error

I'm working through some examples in the Python Geospatial Development book by Erik Westra. On page 439, about setting up a tile map server, he gives the following code for calculating a bounding ...
2
votes
1answer
73 views

How to convert an esri world file .jgw into xy corner coordinates?

I'm trying to convert a .jgw (esri worldfile) into xy corner coordinates for a series of JPEG images im outputting using arcpy.mapping.ExportToJPEG(mxd, "E:\\TEMP\\" + str(x) + ".jpg", df, ...
2
votes
1answer
44 views

GDAL Warp to clip a .tif: Works fine standalone, won't work in Python

I am trying to use the subprocess module to call gdal warp and clip a .tif using a shapefile. When I try the command in GDAL it works fine, but when I attempt to call it into a Python script it will ...
3
votes
1answer
54 views

How to get Listfields from Autocad DWG?

I trying to get LisfFields from AutoCad DWG, to arcpy Add-In, i have tried mxd = arcpy.mapping.MapDocument("CURRENT") Layers = arcpy.mapping.ListLayers(mxd) for Layers in Layers: ...
2
votes
3answers
76 views

Insert layer file to MXDs with multiple data frames using ArcPy?

I have 4 mxd's and I want to insert layer file to each mxd with position in the TOC. Each mxd has 3 and more data frame. I don't know why it does't work. I'm trying this code: import arcpy,os,sys ...
2
votes
0answers
30 views

Diminishing performance of gdal_polygonize in a python subprocess for GRASS to PostgreSQL

I have written a python script to polygonize GRASS rasters into a PostgreSQL database using the gdal utility gdal_polygonize: sub.call('gdal_polygonize.py -8 gdb/quercus/{0}/cellhd/{1} -f ...
0
votes
1answer
60 views

Using Field Calculator to fill out a list of unit numbers

I am adding address points for individual units in trailer/RV parks and I would like to be able to use the Field Calculator to assign the unit numbers. Is it possible to tell the Field Calculator a ...
0
votes
1answer
40 views

Installing libspatialindex on Windows 8

I need to use Rtrees to make some code I'm running faster. However, in order to use Rtree, I need to install libspatialindex. When I've installed packages in the past I've been able to either download ...
0
votes
1answer
53 views

PyQGIS setSubsetOfFields function in QGIS 2.4

I found the function setSubsetOfFields to filter fields in a layer in the PyGIS cookbook: ...
1
vote
1answer
36 views

GRASS scripting for producing multi-band raster

I am trying to loop the r.sun function within a Python script. Anyway, I seem not to understand how I can stack the raster maps each loop would produce into a single multi-band raster (preferably in ...
2
votes
1answer
88 views

Calculating area of polygon inside region?

I am new to geographic information systems and i need to calculate the area of a a polygon ( a circle to be precise) that falls inside the boundaries of a region, say a state or a country. For ...
-1
votes
2answers
77 views

Non Matching Rows between 2 txt files [closed]

I need to compare 2 CSV files so that I can get the missing rows from each CSV. All column attributes in each row should match while comparison. So I have 2 txt files and I would like to compare one ...
0
votes
1answer
139 views

CSV Format change [closed]

Breakline Input File, Breakline Output file I get a breakline file from a CAD guy in below mentioned format. So I am calling this as a “Input” file. I am calling this as a “Output” file. I would ...
0
votes
1answer
66 views

Multiple Subsetting

Input File, XY min,max file I have a XYZ .csv file for a large portion of an area. I have another txt file which contains Box numbers, Xmin, Ymin, Xmax, Ymax. I would like to export a CSV file for ...
3
votes
3answers
90 views

Drawing some points in QGIS 2.4 using Python

I'm new to PyQGIS so here goes: Give a new QGIS project, how can we draw some Points on the map? I tried the following but nothing showed up. Should they be placed in a Vector layer before they can ...
0
votes
0answers
29 views

Convert DateTime field to Just Date in Label Expression

I have a DateTime field (ex: CreatedDate) and would like to only show the date with the label. How would I setup the label expression to do this using python?
2
votes
1answer
42 views

Referencing fields in code block of Field Calculator in ArcGIS for Desktop?

I'm trying to use values from a field to fill a new field with a truncated version. The 'str.rindex' function is working out well, but I can't seem to figure out how I'm supposed to reference the ...
0
votes
1answer
56 views

Programmatically Select a CRS in QGIS 2.4 using Python

When you run the following Python code in the Python Console of QGIS 2.4, uri = "file:///C:/data.csv?type=csv&xField=lng&yField=lat&spatialIndex=no&subsetIndex=no&watchFile=no" ...
3
votes
0answers
61 views

arcpy.mapping.ExportToTIFF fails to render layer?

Has anyone else had this problem? I have an mxd file with two layers in it, one of which is fairly 'heavy' (i.e. takes a minute or so to draw). All layers are visible by default. I have the ...
2
votes
0answers
70 views

Python script for dark object subtraction on Landsat 8 Imagery

Does anyone know of any python scripts that will allow me to conduct such a process? I am limited to open source software and have minor experience in Python.
1
vote
2answers
49 views

How to change field defined as REQUIRED to NON_REQUIRED in ArcGIS Geodatabase

I have created some feature classes in a geodatabase and also some fields using this sample code: arcpy.AddField_management("schools", "ref_ID", "LONG", 9, "", "", "refcode", "NULLABLE", "REQUIRED") ...
2
votes
3answers
82 views

Removing small polygons gaps in a Shapely polygon

I know this issue has been addressed before with different software, but I am looking for an approach with Shapely. I have a polygon with a very small gap on the interior of the shape: Here is a ...
1
vote
1answer
61 views

Running GRASS functions in QGIS 2.4 from python console

I am using qgis 2.4 and i am looking for the "easiest" way to execute e.g. the r.in.gdal function from the python console in qgis. Specifically for r.in.gdal, I could not found this function in ...
1
vote
2answers
44 views

How to take cosine squared of raster using python

I have an equation y = cos^2(x) where x is a raster. How can I write this equation in python?
2
votes
2answers
71 views

How can I select features based on another feature attributes?

Here is my case: I have a layer of features (buildings from a city) that is populated with polygons. This polygons have attributes : street name and postal code In the project I have another layer of ...
1
vote
1answer
47 views

QGIS Deployment in Citrix XenApp - How to Remove Pyramids from the image “properties”

I'm working on deploying QGIS 2.4 into a XenApp 6.5 desktop environment. We've tested QGIS to see if it will run in our environment on a test server and have found that building Pyramids with ...
1
vote
1answer
84 views

Use PyQGIS to import CSV and draw points using different color

A CSV file contains columns latitude, longitude and color. uri = "file:///C:/data/balls.csv?type=csv&xField=longitude&yField=latitude&spatialIndex=no&subsetIndex=no&watchFile=no" ...
2
votes
1answer
74 views

Add OpenLayers layer from QGIS's Python console?

On QGIS 2.4.0-Chugiak the Openlayers plugin is found under Web menu rather than the Plugins menu. How can you use the Python console to add a Openlayers Google Maps layer? The following code give us ...
3
votes
2answers
89 views

What is the best way to get from wkt to shapefile in Python?

I am querying tables from a SQL-Server database and would like to convert the table into a shapefile. It has wkt geometries and wkb as columns in the table, along with other attributes that need to ...
1
vote
0answers
143 views

py2exe ImportError: No module named _err

The .exe file generated with py2exe returns the following error: c:\Users\...\dist>ShapeFileConverter.exe Traceback (most recent call last): File "ShapeFileConverter.py", line 4, in ...