Tagged Questions

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

learn more… | top users | synonyms

2
votes
1answer
83 views

How to create a Qgis python script to manipulate fields with some parameters?

I'm just beginning with QGIS. I have a shape file with 10 fields field1, ..., field10, and many thousands of data. I will like to automatize the next sequence (in a python script or a model): load ...
1
vote
0answers
45 views

Link QGIS to Anaconda Python Distribution: Spyder, iPython Notebook, pip, scikit-learn

I have Anaconda as my primary Python distro, and want to route Python related QGIS scripts through it. With Anaconda, I have Spyder, can easily install packages with pip, and can launch a iPython ...
2
votes
0answers
51 views

Matplotlib error when installing Molusce or lifemapper in QGIS Brighton

I am installing plugins via the QGIS desktop internal interface, and have had twice now messages associated with matplotlib. The first error was for something called lifemapper and now for MOLUSCE. ...
0
votes
1answer
48 views

Transform lat long to state plane coordinates

I am trying to convert a set of lat long to state plane coordinates using python and pyproj. The location is Tennessee and this gave me information about the central meridian, lat origin and the proj ...
2
votes
1answer
79 views

Convert GeoPDF with GDAL

I'm attempting to convert a USGS US Topo GeoPDF in Windows. I'm using GDAL 1.11.1. My initial attempts were with this Python script, which automates the process by feeding a command to the Windows ...
1
vote
0answers
16 views

How do I make arcpy exclude frozen / off layers while importing a DWG file?

I'm attempting to update existing GIS feature classes (SDE) using master AutoCAD files but end up importing ALL features present in the AutoCAD drawing regardless of the visibility settings (frozen / ...
1
vote
1answer
71 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 ...
3
votes
1answer
39 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
2answers
65 views

Python Add-in- Message Box to display area of selected polygons

I am looking to create a Python AddIn which calculates the area of selected polygons. I would like to be able to select the features, click a button on the toolbar, and a Message box displays the sum ...
2
votes
1answer
39 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
95 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
31 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
48 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
39 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
38 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
131 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 ...
1
vote
1answer
48 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
90 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
28 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
1answer
42 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
73 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
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 ...
2
votes
1answer
94 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
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
1answer
39 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
100 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
47 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 ...
1
vote
1answer
31 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
57 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
34 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
46 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
50 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
57 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
26 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
44 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
32 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
67 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
71 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
133 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
63 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
75 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
35 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
53 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
53 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
43 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") ...