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

learn more… | top users | synonyms

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: ...
2
votes
1answer
27 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 ...
0
votes
0answers
24 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
2answers
43 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 ...
0
votes
0answers
23 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
2answers
31 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 ...
0
votes
0answers
28 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
2answers
75 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 ...
3
votes
1answer
27 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 ...
1
vote
0answers
43 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
1answer
24 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 ...
1
vote
1answer
43 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 ...
0
votes
1answer
46 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 ...
3
votes
4answers
144 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 ...
2
votes
2answers
69 views

Using Python to shorten polylines of varying lengths by 44% of their original length (or by a value contained in a field)

I have a feature class containing tens of thousands of polylines of varying lengths that were constructed from only a start and end point (of note, they are all at different angles, and many lines ...
-2
votes
0answers
41 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
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
0answers
12 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 ...
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 = ...
2
votes
1answer
47 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 ...
3
votes
1answer
57 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 ...
0
votes
0answers
26 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. ...
1
vote
0answers
36 views

How can a script tool share (dynamic) variables among different modules?

I'm running a python script from the toolbox window (as a script tool). I have a second python (tkinter) module that I use as an input interface. Now, I know that the script tool can call the ...
0
votes
1answer
65 views

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
47 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 ...
0
votes
2answers
55 views

Is it possible to publish a map service from an SD File purely over REST (no arcpy)?

I want to automate the publishing of map services, but without using the arcpy library. Is it possible to publish a map service from an .SD File purely over REST (no arcpy)?
2
votes
4answers
95 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 ...
2
votes
2answers
45 views

Adding layer into ArcMap via Python - .pyt versus .py

In the final step of a script I've built, I'm trying to add a layer into an empty blank map document. This is my block of python code below that adds the layer. Everything works fine if its run from ...
0
votes
2answers
38 views

How to add data to a newly created folder using arcpy?

I'm writing a script to create a new folder and then copy a feature class to a shapefile and add the shapefile in the new folder. The folder gets created but the script is failing on the feature class ...
2
votes
2answers
55 views

Memory and Processing Efficient Approach to Read a Timeseries in Python

I am trying to store a timeseries of high resolution raster images containing NDVI values into a dictionary for calculations. I am curious as to which approach may the most efficient when loading ...
0
votes
1answer
62 views

How to obtain the maximum/minimum longitude and latitude for a polygon?

I have the MSA/CMSA shape file which contains 274 metropolitan areas. How do I have to obtain the maximum/minimum longitude and latitude for an area? So, it's like drawing a box right outside and ...
2
votes
2answers
70 views

ArcGIS - Extract by Attibutes in Model Builder

I have a model which at one point uses the Extract by Attributes tool to produce a new raster with just the areas containing the maximum values of the first. I would think that the SQL expression ...
1
vote
1answer
26 views

PGRouting Layer plugin error in QGIS 2.2

I am trying to do some basic computations using the PGRouting plugin for QGIS, but I am getting this error all time: An error has occured while executing Python code: Traceback (most recent call ...
-1
votes
4answers
108 views

Issue with UpdateCursor and if/else statement

I have been working on this code for awhile and I can't make it work the way I need it to. The code is suppose to move a feature according to a set distance from types in a designated field. As the ...
1
vote
1answer
35 views

Split Large GeoTIFF to smaller regions with python and gdal

I have quite a large GeoTIFF-file (compressed 50MB but unpacked 6GB) and want to split it into several smaller regional files. Therefor I am using python. As I am a new gdal user I do not really have ...
1
vote
2answers
49 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 ...
0
votes
0answers
35 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
1answer
32 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 = ...
0
votes
0answers
54 views

How to convert .shp file to zip file with mapnik?

I am creating android application for campus indoor map. I research so much think.I decide use osmdroid. I write here what I have done 1) I draw indoor map with JOSM. 2) I convert file.osm file to ...
0
votes
0answers
17 views

Does a road connect one grid cell to an adjacent grid cell?

So here is the problem I am working on. I have an OpenStreetMap roadmap which I overlaid with a 2-D cartesian grid. So for a given grid square, I want to find out if a road segment continues from the ...
1
vote
0answers
21 views

PyScripter crashes at “import processing”

I set up PyScripter latest version, 2.7) to work with QGIS (2.2, OSGeo4W install) following http://chelahmy.blogspot.ca/2011/02/setting-up-pyscripter-for-quantum-gis.html. It generally works well. I'm ...
1
vote
1answer
76 views

Null value error with Python in field calculator

I'm trying to calculate the angle between two line segments in ArcMap 10.0. I have a point shapefile, so I'm using the xy coordinates of 3 successive points to calculate the angle. I'm trying to use ...
1
vote
2answers
53 views

Counting Characters using Field Calculator - Arcmap

I am trying to use field calculator to populate a column based on the the number of characters in another column. I am using the Python Parser. I am not sure if the .count() function is appropriate in ...
0
votes
2answers
44 views

Whats a Python Script/Method to use to get the number of fields with data in an attribute table?

I am doing some data migration and need the number of records with actual data, sans null and blank fields, without switching back and forth with select by attribute. Ideally I would like to run a ...
1
vote
0answers
39 views

using arcpy to query sde database in python

I have three variables: view_name, column_name, and column_content. column_name contains id, name, address, etc. column_content contains 123, John, 200 King st, etc. user specifies the column_name ...
2
votes
2answers
34 views

Update raster value to reflect total number of points within cell- python

I have what should be a fairly simple task, but I can't seem to figure out how to do it. I have to do it in python/arcpy/gdal/whatever because I'm trying to automate this process for a hundred or so ...
1
vote
1answer
27 views

MakeXYEventLayer_management not creating final file?

I'm using python to generate x and y coordinates for the start and end of lines in Arc. I have successfully done this part but when I try and generate the nodes I have no idea where the output file ...
0
votes
1answer
27 views

CalculateField_management - updating fields with X and Y coordinates for start and end of line

I've searched all the help documents and can't see where my script is going wrong. I've tried adding the fields as FLOAT, replacing "PYTHON_9_3" with just "PYTHON" but it just doesn't work. The ...
3
votes
1answer
41 views

How to obtain the width and height of an image using arcpy

This Stack Overflow question shows how to obtain the pixel dimensions of an image using Python. Is it possible to find an image's height and width using arcpy and ArcGIS? arcpy.Describe would seem ...