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

learn more… | top users | synonyms

0
votes
0answers
19 views

How to select Qgis features through Python Plugin

Hi I am very new to Python so this may be a bit basic. I am trying to find a way to select and zoom to the features in a QGIS layer. I have created a plug in and built a custom form. I have 3 ...
2
votes
0answers
66 views

Python problem visualization .tif image

I am trying to read a hyperspectral image in Uint16 .tif format and visualize it. I use GDAL in Python to read the data and everything works perfectly when I use matplotlib to show one band of the ...
0
votes
2answers
38 views

Output of RasterToPolygon not supported as shapefile

I made a python code for arcGis 9.3 which do the following step : 1) Convert all the raster (.tif) in a folder to polygon shapefile in another folder 2) Intersect all the converted ...
1
vote
1answer
64 views

empty file geodatabase error (nowhere feature class)using arcpy [closed]

i want to import a python(2.7) script to arcmap 10.1 my script has 2 inputs variables one for workspace and another raster dataset and i want o convert input raster as feature class polygon . i want ...
0
votes
1answer
25 views

gdalwarp from within python script misbehaving

I'm trying to run gdalwarp from within a python script start = "gdalwarp -overwrite -ts 22 20 -r average -srcnodata 99 " input_file = filename[12:] output_file = "temp1.tif" print ...
2
votes
2answers
45 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 ...
-1
votes
0answers
34 views

Removing the same character from the middle of a string in Field Calculator [migrated]

This is the String I have in one column; CO060020N0650W0. I need it to say 2N65W. The second character is '5', sometimes it's '7'. I want to remove just that character from field calculator. How ...
3
votes
2answers
43 views

Add row and column name to square grid feature in ArcGIS

I have a square grid feature class of 250 x 250 tiles. This will serve as a tile index for a a project. They currently have no identifying attributes other than a unique ID. I need to add a field ...
0
votes
1answer
27 views

How do I use ogr2ogr with python GDAL? [duplicate]

I've just installed GDAL, but I don't know how to import/use ogr2ogr. I've tried: from osgeo import gdal from osgeo import ogr and searched both for ogr2ogr, but it wasn't there.
0
votes
1answer
32 views

Problem with SetValue method in ArcGIS 9.3

I am trying to make a python script for ArcGIS 9.3. I have a problem with the SetValue method. I try to use it in a very simple code but it still doesn't work : No error is return but my field is not ...
0
votes
1answer
44 views

Weighted Overlay - passing parameter as text error?

For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such... arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route ...
0
votes
1answer
26 views

Changing band for greyscale in plugin

I am trying to make a qgis plugin to change which band in a multiband data set (netCDF where the band represents time steps) is used for a grey scale rendering. The file works fine with manual ...
-1
votes
1answer
42 views

define error for python script to import arcmap [closed]

i want to create a simple python script for create one file geodatabase but show me define error # Import arcpy module Import arcpy import sys import os from arcpy import env from arcpy.sa ...
1
vote
2answers
107 views

Why my python script of r.watershed has no output?

I type those code in pyscripter, import os import sys #set up GRASS environment variables sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python')) import grass.script as g import ...
0
votes
1answer
76 views

How to generate jVectorMap for United Kingdom (UK)?

I have shapefile for UK , i need to convert this to the jVectorMap Here is my script python ^ converter.py ^ ./shapefile/map.shp ^ ./output/jquery-uk.js ^ --width 400 ^ --where "ISO = ...
2
votes
1answer
50 views

Conditional SQL Query

I've been running a code that searches a desired field in a feature class and performs an specified SQL query based on whether the field is string or double. The variables are just temporary fillers ...
1
vote
2answers
131 views

Create an X,Y latitude and longitude grid from an raster

I have a satellite image (LandSat 5), I want create a raster with X,Y coordinates, this is possible in Model Builder of ArcGis 10.0? or other option. I know that the option $$YMAP ($$XMAP) not work ...
0
votes
0answers
25 views

No data appears when using gdal_calc.py but source had data values

I'm in the process of calculating topographic exposure using a mix of GDAL, grass, R and python in Windows. I need to process a very large tiff file using the following calculation: ...
0
votes
0answers
24 views

TileStache : Unknown geometry type in geoJSON file

I'm currently trying to set up a TilSstache server on Ubuntu 12.04 to serve some GeoJSON tiles from a shapefile/JSON file (administratives boundaries) for a web mapping project using the Leaflet ...
1
vote
1answer
36 views

PostGIS Type Modifier Error

I'm trying to work an example from the "PostGIS Cookbook" and I'm getting an error I don't understand. I'm running the example using Postgres.app on a MacBook. Postgres.app is running PostgreSQL ...
0
votes
1answer
26 views

Better ways to check if GRASS r.water.outlet works out fine output

I use my python script to call GRASS module r.water.outlet from outside, and here's my script(I perform this script in pyscripter): import os import sys #set up GRASS environment variables ...
1
vote
1answer
42 views

QGIS 2.2.0.1 Valmiera, Windows 7 64 bit - copying out of GDALInfo-Window in QGIS not possible

When trying to copy information given out by GDALInfo with different kinds of raster data (DEM, normal georeferenced images etc.) through the interface of QGIS 2.2 by right-clicking and choosing copy ...
1
vote
2answers
100 views

How to extract X Y coordinates and RGB from pixels using python in QGIS?

I'm trying to white a Python plugin in QGIS (2.2) to get, for each pixel of a raster image, its X Y coordinates, as well as, its RGB (3 bands) values. At first I opened the raster file using: rlayer ...
2
votes
3answers
276 views

Adding a new field and calculating area using Python

Using Python, how do you add a new field to your shape file and calculate the area in km2?
0
votes
1answer
56 views

Layer relations via Python

Is it possible to, through Python, to create the relations that it's possible to create in Layers/Properties/Fields/Relations, and if so how? I first thought these were saved in the styles, but that ...
1
vote
0answers
63 views

Running python script outside of Arcmap's python console

My codes works fine in Arcmap's python windows. But when I try to run it in a command promt windows, It says that; ERROR 000837: The workspace is not the correct workspace type. But it works fine ...
0
votes
1answer
27 views

registering or unregistering as versioned a future dataset with python

As you know, you can store feature classes in arcsde in two ways. Firts, in the root path: sde_conn_file.sde/FeatureClass Second, in a dataset: sde_conn_file.sde/DataSet/FeatureClass How can I ...
0
votes
1answer
45 views

How to disable “Simplify geometry” via Python?

After I've loaded a layer from a table in my db I'd like to disable the 'Simplify geometry' (found in Layers/Properties/Rendering) programatically using Python. I've tried several versions of ...
1
vote
0answers
39 views

How to use GDAL on Heroku?

I have a geospatial python app that I want to use on Heroku. This is my requirements.txt file: Flask==0.10.1 Jinja2==2.7.2 MarkupSafe==0.19 Werkzeug==0.9.4 gunicorn==18.0 itsdangerous==0.23 ...
2
votes
2answers
110 views

Fiona: get each feature extent (bounds)

I was looking in Fiona to get for each feature its extent but I didn't find how. I have try to far to do something like below import fiona with fiona.open('countries/ne_10m_admin_0_countries.shp', ...
1
vote
0answers
53 views

Editing QGIS point layer: retrieve attributes of intersecting line layer

I'm creating a custom editing form using QGIS 2.0 and would like to modify the mouse event when creating a point. I've gotten a start by reading this thread: How to programatically check for a mouse ...
1
vote
2answers
54 views

Mask image based on no-data pixels in another image with different projection - GDAL or Python

I've got a land cover image which covers the whole globe, and a satellite image which covers a very small part of the globe. These two images have different projections, co-ordinate systems and pixel ...
0
votes
1answer
68 views

Unique Values in validation

How do I ensure the same selection is not made on param[2] and param[3] both of which are populated from the same field using tool validation? import arcpy class ToolValidator(object): """Class ...
0
votes
0answers
15 views

Add a raster specifying the projection in pyqgis

I would like add an raster but I want to specify the projection. If I do : qgis.utils.iface.addRasterLayer(url,layerName) QGIS ask me to specify the projection. I want to this with python. How I ...
1
vote
1answer
30 views

GeoDjango Scale/Layers issue?

I've been having issues visualising data from a shapefile in GeoDjango using OpenStreetMaps. I believe it's some sort of a scale issue because of how it appears(as you can see in the screenshot of the ...
0
votes
1answer
64 views

Importing otb into Python

I have Python 2.7 (installed together with ArcGIS 10.1). Via OSGeo4W a have installed qGIS and otb application.I was able to connect qGIS and otb and it's working fine. Through OSGeo installer I ...
3
votes
2answers
135 views

What's wrong with my IDW interpolation function (Python)?

Original Question Can anyone see what's wrong with my custom IDW interpolation below? I know there are existing libraries that can do this for me, but for various reasons including educational and ...
0
votes
2answers
49 views

Can't compile python plugin in QGIS (Windows)

I'm just installed QGIS 2.2 and created a new plugin from Plugin Builder. When I try to compile the plugin using: C:\Program Files\QGIS Valmiera\bin>pyuic4 -o C:\Program Files\QGIS Valmiera\bin\ ...
4
votes
1answer
118 views

Determining Shape Area Field Name

I'm dealing with a varierty of spatial polygon files (shapefiles, file/personal gdb feature classes, sde feature classes (some with spatial views)) and depending on the file type, I get a mulittude of ...
-1
votes
1answer
39 views

Move features from one layer to another existing layer

How can I move Selected features from one layer to another existing layer? I have tried Copy (Data Management), Copy Features (Data Management), But I got the error: ExecuteError: ERROR 000258: ...
0
votes
0answers
23 views

Delayed moving average

I want to develop a plot of delayed moving average. The code for this in MATLAB is: nr_pontos = 36; coefs_filtro = ones(1, nr_pontos)/nr_pontos; data_dma = filter(coefs_filtro, 1, data); ...
0
votes
2answers
110 views

How to plot geoJSON using Python?

I have huge geojson file that I am working on: [{ "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ ...
1
vote
1answer
92 views

What do “count”, “mean”, and “sum” in QgsZonalStatistics mean?

I am working with Qgis and making some analytics of lightdata. I've used these commands: rasterfile = qgis.utils.iface.mapCanvas().currentLayer().source() vectorlayer = ...
0
votes
1answer
44 views

Selection/Deletion of all smaller polygon/s in a SHP - Python solution?

ArcMap 10.2 user, with Spatial Analyst only. No ArcServer or of sort. I have abt 500+ polygon shapefiles, each containing 2 or more polygons. All of them has a NAME column and the rest of the ...
-1
votes
1answer
51 views

A formula error in raster calculator with arcgis 10.1

help me to solve a problem at a formula to calculate the susceptibility to landslide that gives me errors when computing with "raster calculator" in arcgis 10.1, the formula is exact but errors in the ...
1
vote
1answer
47 views

Equivalent function to shapely's envelope in ogr?

I wrote a very simple python function that gives me the envelope/bounding box/...based on two coordinate pairs (ower left and upper right corner): # ... def get_bounding_box(self, ll_corner, ...
1
vote
2answers
66 views

Suggest an algorithm to measure how a node is connected to road network

I try to measure how well a node is connected to the rest of the network. If a city has a distant suburb connected with one sole road, it's connectedness is, say 1. If it's connected by 2 roads, it's ...
0
votes
0answers
79 views

Mac QGIS 2.2 error executing Python code

Newbie Using QGIS version 2.2 with Python 2.7.5 on OSx 10.9.2 Getting the following error. Any idea on how to resolve? I'm not sure if it has ramifications on the display of the Google data. An ...
0
votes
1answer
32 views

Difference between python IDLE and eclipse on accessing GRASS

I have seen these posts:GRASS and Python, Using Eclipse to develop GRASS Python programs. I used to use python IDLE to control GRASS, but I can't make python and GRASS connected, as I described in ...
0
votes
1answer
96 views

import qgis.core problem with QgsFeature and QgsGeometry

I've tried several previous answers to similar questions - no luck. I run Win7. I installed QGIS 2.2.0 using the OSGeo4W 32-bit installer. Problem 1) from qgis.core import * failed. Solution 1) ...