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

learn more… | top users | synonyms

0
votes
0answers
11 views

ogr: confusing results from `SetSpatialFilter()`

My layer is derived from a data source like this: l_131 = bounds.ExecuteSQL("select * from 'nam_l' where 'ND_5'= 131 ") feat = l_131.GetNextFeature() feat.GetFeatureCount() >>> 200 It is a ...
0
votes
1answer
15 views

Point z value Return 1.#QNAN while set before

I am makin a python code for ArcGis 9.3. The code is as following : rowsLine = gp.updatecursor(line_Feature_Class) count = 0 rowLine = rowsLine.next() rowsPoint = ...
0
votes
1answer
36 views

How to copy attribute values of fields in selected features of one layer to another Qgis programmatically?

I am trying to get the values of attributes of the selected features of a layer field by field and copy to another layer that I created in qgis with pyqgis. Is here a example for this. Every example ...
1
vote
1answer
60 views

How to get Z attribute of point using Python and ArcGIS Desktop 9.3?

I am making a python code for arcgis 9.3. In this code i create a new point with x,y and z attributes as following : rowsLine = gp.updatecursor(line_Feature_Class) rowLine = rowsLine.next() ...
1
vote
1answer
76 views

QGIS Python Labelling

i want to label a point layer with those values exceeding a set of variables attribute table as follows 'loc field'(text),'a'(float),'b'(float),'c'(float) variables as follows vara = 5, varb = 3, ...
-2
votes
1answer
185 views

How to write Process Dialog log information to text file in ArcGIS?

I have created a custom model. When this model is run, it shows a process dialog which has some log information. I want to write that log information into the text file for further analysis. Does ...
1
vote
1answer
38 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
1answer
36 views

Why does Animal Movement toolbox give SyntaxError: invalid syntax?

I found a complete toolbox (Animal Movement tbx, by Regan Sarwas) for my tasks and I tried it. I had a systematic problem with the codes for all tools (line 1), for exemple: Executing: ...
0
votes
0answers
25 views

Help with scripts for processing raster files with the raster calculator in QGIS

I am trying to process some raster files using python scripts in Qgis 2.20, and I have been having trouble finding any documentation on using raster calculator in scripts being run in the processing ...
1
vote
2answers
70 views

How can I group Points to make polygon via Python

I have an array of coordinates Point= [lat,long] ListPoint= [[38.203655,-76.113281],[38.10,-76.12],..] I wanna make a polygon that contains all these points ? There is a project developed by ...
6
votes
2answers
180 views

Using PROJ.4 library to transform from local coordinate system coordinates to global coordinate system using ground control points?

I have a point cloud whose coordinates are with respect to a local coordinate system. I also have ground control points with GPS values. Can I convert these local coordinates to a global coordinate ...
1
vote
1answer
170 views

How can I change SQL query through a layer of an action (python)?

I have three layers from three diferent database tables. When I click in other layer I want to change (with an action) the query of that three layers. How can I do that? Thank you
0
votes
1answer
63 views
+100

QGis: scripting the map rendering (multiple similar maps from one shapefile)

I would like to ask for advice on creating a Python script that will provide the opportunity to render a plenty of similar maps (with the same extent, projection, layout, color scheme and composition, ...
1
vote
1answer
45 views

Finding closest Intersection between line strings (PostGIS)

I want to find the distance between one point (excavation sites) and a line (rivers) for the cardinal directions. What I thought would be the easiest way is to draw lines between the excavation site ...
1
vote
1answer
134 views

How to use 'remap' in reclassify tool code in ArcGIS Python Toolbox

I am making a reclassify tool in ArcGIS python toolbox (.pyt) ... I am able to use the remap datatype but am not able to parse the information present in Remap in the Reclassify function's third ...
2
votes
2answers
141 views

Issue while running grass from subprocess

I have a map based web application using geodjango. I needed to display the crime hotspots within a selected polygon area. I found that v.kernel is very good for generating heatmaps/hotspots. So in my ...
2
votes
1answer
26 views

How can I extract only band 4 from a geotiff multi bands to create geotiff or AAIgrid with this band using Python?

I have a geotiff file with many bands... I will like to create a .asc file or tiff file by converting only one band from the geotiff file. I don't find the solution by using python... With ...
3
votes
1answer
77 views

Python Postgres Multiprocessing speed increase

I'm trying to speed up my PostGIS queries using multiprocessing. My current setup is using python and psycopg2 such as below. Although this has given a speed increase, it still seems like there are ...
3
votes
1answer
143 views

Accessing arcpy functions from IronPython

I made a few python scripts to automatically optimize and publish my data.. Now i'm thinking about writing a .NET program to manage and run these scripts: the obvious way is invoking them in a ...
0
votes
0answers
21 views

Add existing QGIS plugin button to custom toolbar

Is it possible to add an existing plugin's button to a custom toolbar? I've succeeded in adding core actions such as shown below, but am wondering if it would be possible to integrate another plugin ...
0
votes
0answers
30 views

Have I created a valid Spatialite database?

I didn't manage to find the better way to populate the exisiting Spatialite database with new computed data than just creating new columns and filling them in the Python script. You can see that the ...
2
votes
2answers
44 views

How to save python ogr2ogr shapefile to memory, and stream to web client as zip

I'm trying to accomplish something similar to the site http://ogre.adc4gis.com/ I want to be able to manipulate a geojson file, and send it to the client as a shapefile, in a single zip file. I'm ...
0
votes
2answers
28 views

Get srid from a shapefile using ogr

I'm writing a script to import shp to postgis, using python, osgeo and psycopg2 ( see my previous question: Import shp to Postgis using Python and ogr ) I'd know if there is a way to get by osgeo ...
1
vote
1answer
145 views

Difficulties in dissolving stream orders

I've been trying to dissolve streams, using orders programatically and I came across this VB script. The reason is that if I use ArcGIS dissolve, it merges the confluence of the same orders. I would ...
0
votes
0answers
21 views

Mapnik: GeoTIFF flipped (mirrored vertically)

I generated a GeoTiff using the QGIS HeatMap plugin and want to render it on top of some OSM data. The problem is that the raster gets rendered upside-down in the output. Can someone point me in the ...
0
votes
1answer
68 views

Using Python for Polygon Neighbors Analysis in ArcGIS 10.1: Script producing erroneous results

I'm struggling with a python script that is supposed to calculate a field for a polygon feature class. The calculation is of the average of a field value (P_TOT_DEV) for each of a given polygon's ...
1
vote
0answers
42 views

How do I smooth edges of polygons in QGIS?

Is there a built in function or plugin I can use to achieve smooth lines for my polygons instead of the blocky ones I have now?
-2
votes
0answers
39 views

intersect zip python

I try to change the python script ExtractData to do the intersection., but until now I fails to do so. i change the funtion : clip_analysis by intersect_analysis. i change also the parameters: ...
0
votes
1answer
30 views

gdal polygonize in python error, blank polygon created

I am having trouble using the Polygonize function in python. The cookbook example for this can be found here. The relevant portion of my code is: sourceRaster = gdal.Open('myraster.tif') band = ...
1
vote
2answers
222 views

problems with py2exe, shapely and fiona

I have a short python script, called test: import fiona with fiona.open("C:\\Essai_compil", 'r') as l_Obs_shp: for shp in l_Obs_shp: print shp['geometry'] I want to compile with ...
0
votes
0answers
27 views

How to add the attributes of selected features to my new layer in pyqgis

I am trying to create a layer from the selected points coordinates. I am drawing a circle to the coordinate of selected points. I also need to add initial attributes of my selected features to my new ...
1
vote
1answer
95 views

How to get a the minimum value of a raster layer in qgis with python?

I'm very new user of QGis and I work with landsat 5 images. In this framework, I would like to make an atmospheric correction subtracting the minimum value present in each band (1 to 4). My ...
0
votes
0answers
34 views

Problem reducing the width of the attributes fields of a shapefile using python

I have a shapefile with rather long attribute widths (which is resulting in a rather large file). I am trying to trim it in python, here is my code: layer = qgis.utils.iface.activeLayer() ...
0
votes
4answers
44 views

Why QgsMapCanvas only appear after lost focus?

I created the simple frame .UI file, compiled with pyuic4, and tried the ShapeViewer.py to load the shapefile "world_borders.shp". However, the map doesn't display at the first time. I have to click ...
2
votes
2answers
89 views

Is there a function to select a region of a map for further processing with Python?

I would like to select a map's region in QGIS for further processing with python console. Ideally I would like to select the region with a mouse drag (like Gimp crop function) and then e.g. analyze ...
3
votes
1answer
25 views

Why is Mosaic or Mosaic To New Image causing a 1-pixel gap between adjacent images?

I have a series of adjacent PNG images, and I'm trying to merge/mosaic them into a single seamless image. The images have clean "cuts" between them, with no overlaps. However, when I use either the ...
2
votes
1answer
23 views

Using Python to create new point location based on various azimuth and distances

I have a feature class with thousands of points. In the same table with these point locations, I have two additional fields. One for azimuth, and one for a length (or distance) to move along that ...
3
votes
4answers
134 views

How to convert all values in all fields of table to upper case using ArcPy & Python?

Does anyone know how to use the .upper() in a stand alone python script so it can be used to change all characters in a table into UPPER case? I don't want to use the field calculator since I have ...
0
votes
1answer
42 views

Parsing field in field calculator using Python

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the ...
8
votes
2answers
4k views

Using python in ArcGIS, create a line of varying distance from an origin point

What I'm trying to do is create a line feature from a single point, using a set distance and angle. Using ArcGIS and Python (I hope). Here's the scenario: Say I have a point at these coordinates: ...
0
votes
0answers
16 views

Min value (OD Cost Matrix)

I have an attribute table with columns that I have gained from running an OD Cost Matrix. In one column named "Total Minutes" I will select the lowest value (the shortest route). Then I will create a ...
0
votes
1answer
38 views

arcpy absolute file path failing with AddLayer()

I have the following code: import arcpy.mapping as mapping mxd = mapping.MapDocument("current") print mxd.title df = mapping.ListDataFrames(mxd)[0] print df.name layer = ...
0
votes
0answers
10 views

In QGIS Process Modeller, is it possible to automatically run a function on several layers without listing all combinations?

Trying to develop a Model which includes finding any intersections between layers and then merging them all into a single layer. I have 12 layers in total, it's not really efficient to list all the ...
1
vote
0answers
32 views

Decompress a LZW-compressed GeoTIFF

I have a LZW-compressed GeoTIFF file and would like to split it into several smaller regional files and change the format to png. I tried to do the spliting with gdal_translate -srcwin. I only get a ...
3
votes
1answer
54 views

Using Python in Field Calculator to compare two fields

I'm trying to use field calculator to compare two fields in a table of tax parcel data, Land Value (LAND_VAL) and Improvement Value (IMPRVT_VAL). My goal is to determine (1) Parcels with land value ...
2
votes
1answer
44 views

Can we access the ArcMap Image Analysis tools using Python?

Esri recently added a new Image Analysis window to ArcMap - it's found under > Windows in the main toolbar: The Image Analysis window's Processing section simplifies the experience of applying ...
0
votes
0answers
88 views

Successfully extracting values from a GRIB2 file…is it possible?

Let me say first that I'm starting to work with GRIB2 files, I've read the docs, and more or less know how they are structured. My goal is to be able to parse some GRIB2 files from NOAA, more ...
1
vote
2answers
46 views

Getting time dimension from a GRIB file

I have a GRIB file from NOAA that contains several variables for a specific subregion in Norht-East Atlantic. I'm using ECMWF grip-api Python library to parse the file. While I'm able to get the ...
2
votes
4answers
94 views

Field calculator Python else statement question

The codeblock below is run on Field1 and calculates Field1 to equal Field2 if they are not equal. Else it returns Field1. My question is, does the else statement actually recalculate Field1 to equal ...
0
votes
0answers
22 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. ...