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

learn more… | top users | synonyms

1
vote
2answers
460 views

Using reader Feature Type Name as Writer Feature Type Name in FME

I've search and searched for a way to do this, but no method seems to work. Basically I want to use the input feature class name (feature type in FME) as the output name. This normally works, ...
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
1answer
233 views

how to loop grass command in python and put variable in output file

first day Grass programming with python scripting; first prob; simple I want to reclass the same raster several times; and save the file with the value loop variable at the end ... can not get it ...
1
vote
2answers
97 views

Getting error after trying to harvest from geoserver into pycsw

I'm using osgeo live to test the pycsw functionality. I need to harvest metadata from an existing Geoserver service (previously configure for this task). I'm quite new with CSW and I'm not sure if my ...
3
votes
1answer
40 views

How to filter QGIS layer from python?

Using QGIS 2.4 python console, I'm trying to display only a subset of a layer features. I've managed to get the features both from the layer : featuresIterator = ...
2
votes
1answer
98 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 ...
1
vote
1answer
87 views

How to fix python ImportError: DLL load failed: The specified module could not be found?

During import fiona, I am getting following error. Error is different from other user so I asked this question may be it is repeated. import fiona Traceback (most recent call last): File ...
4
votes
1answer
137 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
2answers
108 views

Error while importing CSV File using PyQGIS

Currently I am trying to import a CSV file using the python extension in QGIS and I have run into a problem that I can not seem to solve. I am trying to do a basic import of a CSV file from a python ...
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: ...
4
votes
2answers
1k views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
1
vote
1answer
77 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 ...
0
votes
3answers
59 views

FeatureClassToFeatureClass_conversion in ArcGis 10.1

I have many > 60 .dwg files I want to convert just the polyline parts of these and have put together a list of python commands using excel to get something like this: However when I try running ...
1
vote
1answer
29 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 ...
2
votes
1answer
41 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
1answer
40 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.
2
votes
2answers
97 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
13 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
35 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 ...
2
votes
1answer
437 views

How to create a QGIS action which copies features between layers?

i tried (i never tried before...) to write a simple python code like action in QGIS on my "XXX" vector layer that: open a layer "YYY" copy the selected feature on my "XXX"layer paste the selected ...
3
votes
1answer
252 views

How come “Zoom to Polygon” always puts me in the middle of Nebraska?

This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
2
votes
3answers
57 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 ...
0
votes
0answers
41 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
43 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 ...
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, ...
-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
vote
2answers
102 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 ...
4
votes
2answers
101 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 ...
-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 ...
1
vote
1answer
49 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 ...
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 ...
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
47 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 ...
1
vote
1answer
159 views

How to call ogr2ogr from command line with Python 2.7 from ArcGIS 10.2 for Desktop?

I am trying to access ogr2ogr in the command line, and this is the message I receive: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file. This is ...
1
vote
4answers
1k views

Install other python distributions [e.g. Python(x,y)] on top of ArcGIS installation ?

I'm using ArcGIS 10 and would like to use various additional libraries that are not included in the delivered version of ArcGIS (esp. numpy and matplotlib). First I tried to install them manually as ...
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?
0
votes
0answers
14 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
2answers
51 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 ...
11
votes
4answers
1k views

Efficiently finding the 1st order neighbors of 200k polygons

For every one of the 208,781 Census block groups, I'd like to retrieve the FIPS IDs of all of its 1st order neighbors. I have all the TIGER boundaries downloaded and merged into a single 1GB ...
1
vote
1answer
109 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. ...
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: ...
2
votes
4answers
48 views

Converting a large set of GRIB2 files to a spreadsheet format

I have a large set of .pgrbf.grb2 files downloaded from the Climate Prediction Center, and I need to run statistical analyses comparing them to data that was produced locally in .csv format. I'm not ...
7
votes
3answers
1k views

Create a square grid polygon shapefile with python

i have the following coordinates minx,maxx,miny,maxy = 448262.080078, 450360.750122, 6262492.020081, 6262938.950073 i wish to create a square grid of size 1 m using python. import math ...
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 ...
4
votes
1answer
94 views

Why are my calls to SAGA routines in QGIS not working cross platform?

The ability to write and run cross platform scripts for QGIS using python is OUTSTANDING! However, when I try to run the SAGA:MERGESHAPESLAYERS algorithm from a python script it works fine in windows ...
2
votes
0answers
26 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
34 views

Rank cell values across multiple grids [closed]

I have multiple grids, one for each month of a year. I would like to create a new grid for each month/year combination that the cell value is the percentile rank of that cells value in the grid stack. ...
4
votes
3answers
106 views

Is there a workaround for GRASS i.maxlik 'class' being a keyword in Python?

I am running i.maxlik in python - attempting to automate a processing chain. I use the command: grass.run_command('i.maxlik', group= group, subgroup=subgroup, class='classification', sigfile = ...
1
vote
1answer
74 views

How to calculate the area of an ellipse on the earth's surface using Python?

I have a dataset consisting of GPS coordinates. I use a clustering algorithm to generate a two dimensional Gaussian for me. The Gaussian takes the shape of an ellipse if visualized on the map. ...
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 ...