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

learn more… | top users | synonyms

2
votes
1answer
38 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
62 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
37 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
47 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
56 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
25 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
59 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
29 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
46 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
33 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
71 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
0answers
52 views

rbind of list of selected point txt files [migrated]

I have lot of Point files in a folder. I would like to rbind (Vertically One after another in a single txt file) as per the list of selected point file from all the point files present in the folder. ...
-1
votes
2answers
73 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
136 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
64 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
76 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
26 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
41 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
38 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
54 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
58 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
44 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
51 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
41 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
37 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
60 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
38 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
76 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
59 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
78 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
63 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 ...
1
vote
2answers
35 views

Automating procedure to add shapefile to multiple map templates using ArcPy?

I have a project that has me create a package of about a dozen maps for a client and I do this multiple times per week. I am trying to figure out if there is a way to automate this with python. I am ...
1
vote
1answer
42 views

slow Python script pulling from an iSeries database

I've converted and updated some python scripts that exported data from an iSeries database (HTE) to Access to export the same data to a fgdb. My biggest issue is the time it's taking to export the ...
3
votes
1answer
68 views

Fast raster combine using rasterio

I'm trying to duplicate the functionality of ArcGIS's Combine function within rasterio. Given a list of (presumably categorical) rasters read with rasterio, I want to output a combined raster and a ...
1
vote
1answer
62 views

ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Layer Name or Table View: Dataset L does not exist

Hi I am trying to create a loop so that each layer is produced in its own map. This is my code: import arcpy path = "C:\Users\Et\Documents\ArcGIS\Default.gdb" mxd=arcpy.mapping.MapDocument(path ...
2
votes
1answer
65 views

QGIS select reversed geometries

I have a road network and a geometry for each road direction. One Geometry from A->B and another Geometry from B->A. This geometries are covering each other. Is there a tool available in QGIS to ...
3
votes
0answers
66 views

Select and copy attributes features in ArcMap using Python add-in tool?

I'm trying to add a tool to an add-in toolbar to select features from an existing feature class and copy attributes to another feature class,from point to point. TopoHeight_Field_Name='Comment' def ...
0
votes
0answers
21 views

Script Efficiency

I have been working on a script to read pixel values and print the values out to a text file. This is currently working but takes around two hours with a 6.6gb file. This is to replace an older script ...
2
votes
1answer
34 views

Shapely's simplify won't simplify any more

I have a multipolygon in shapely, and I want to simplify it until it has less than a certain number of points. When I use the preseve_topology=False argument to geom.simplify, I can get the number of ...
4
votes
1answer
64 views

SQL-query in arcpy - SELECT WHERE feature between two values

I need to select features between two values in python with arcpy. However, whenever I try to run the code below, it returns with error message "An invalid SQL statement was used". whereclause = ...
0
votes
0answers
35 views

Free ebooks of QGIS [duplicate]

I am new to QGIS and python. Can any one tell me, where I can find QGIS and Pyqgis ebooks for free.
1
vote
1answer
69 views

Could not open/read USGS raster file

I could not open/read the following .img file. The document below says it is a raster file. http://edc2.usgs.gov/1KM/land_sea_mask.php I tried to open it using many ways such as Q-Gis software, and ...
10
votes
3answers
230 views

How can I parallelise embarrassingly parallel GIS operations in QGIS python?

A common requirement in GIS is to apply a processing tool to a number of files or apply a process for a number of features in one file to another file. Much of these operations are embarrassingly ...
2
votes
0answers
37 views

What is the issue with geopdf format?

I'd like to add the geopdf format as output of a library that I am working on. After have looking around, I have not been able to find a (c, c++, python) library that meet my license requirements ...
2
votes
1answer
120 views

Error with da.UpdateCursor and SDE feature classes

I am making my first attempt at editing an ArcSDE feature class with python through a da.UpdateCursor. I'm essentially taking code I've written for a file geodatabase feature class and applying it to ...
2
votes
1answer
38 views

Arcpy PointGeometry does not carry forward the ID

I used this as starting point I have the following code: Test data data = numpy.array([(0, 51.1047664, -114.3722785, 1205, ...
-1
votes
1answer
47 views

Geocode as soon as PostGIS table is updated

I am trying to create a map such that as soon as I enter an address into PostGIS table, it'll automatically be geocoded (and published in geoserver). The only way I could think of doing this was using ...
1
vote
1answer
108 views

Calculating distance between latitude and longitude by using python

I have a database of 2000 points, which is in csv format of latitude and longitude. I want to find distance between these points all at once. And also showing these points in Map by using only pyQGIS. ...
1
vote
2answers
28 views

QGIS 2.4 crashes when symbolizing QgsComposerShape in Python with ScriptRunner

I'm attempting to use ScriptRunner to output a jpeg of a red rectangle using QGIS Composer to understand the QgsComposerShape. Everything works except QGIS crashes when the symbol is applied. The ...
0
votes
1answer
56 views

Needed either python or VB Script to write right indent

Question : I have a field column that is has numbers with percent. The field properties are string and 50 in length. I ran it in an expression using round([T_Acres]/207 * 100,0) + "%" in VB script . ...