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

learn more… | top users | synonyms

4
votes
2answers
3k views

How to create reports in ArcGIS using Python?

Does anyone have experience in creating reports from your ArcGIS data (geodatabase, map exports) using a python reporting engine? In my current project, we are using Jasper Reports in the following ...
1
vote
2answers
35 views

How to install 3rd party python libraries for QGIS on Windows?

How can I use 3rd party libraries on QGIS plugins on Windows? I've developed a plugin that uses rasterio and numpy for a customer, but he's having problems installing rasterio and numpy. Actually ...
1
vote
0answers
15 views

Processing plugin Python error on startup of QGIS 2.8.1

I've been running QGIS with no issues for several versions now, but after I upgraded to 2.8.1 Wien I had trouble running two plugins: qgis2leaf (which I believe depends on Processing) and Processing. ...
0
votes
0answers
17 views

install python packages for qgis? [duplicate]

I need the twisted framework (Python) for a qgis plugin on Windows 7. I installed it with the pip installer. When I want to start the plugin it doesn't find twisted. When I start a python interpreter ...
2
votes
1answer
23 views

How to create a virtual field in QGIS by Python Console?

Is there any example about how to create virtual field and subsequently add attribute to non-virtual field without wiping out the virtual field? Both are required to be done by Python Console. Thanks ...
0
votes
0answers
22 views

How to remove “ERROR 1” messages from a standalone QGIS script?

I am running a standalone script for QGIS which creates a high resolution grid and clips shapefiles onto it. Works perfect if the cell width and height have a high values (in my case, >200m for both). ...
0
votes
0answers
25 views

how to compile a python script (proxy.cgi) in ubuntu?

I want to know please how to compile a python script ubuntu 14.10, I have a file proxy.cgi I want to compile in order to access to the geoserver. when I type localhost/cgi-bin/proxy.cgi, it displays ...
6
votes
3answers
564 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 ...
8
votes
1answer
386 views

Running ArcGIS 10.0 Under Virtualenv

I am working on a Python package that has a mixture of command line tools and ArcToolbox tools. For Python development it is really useful to use VirtualEnv, especially when working with installers. ...
1
vote
0answers
27 views

Change layer datasource in qgis project with python

I have different qgis project with some layer and their datasource like ../my_path/my_file.shp. I need to insert this shp file to a remote db. For do it i use shapefile from PGeo module and it's work ...
1
vote
1answer
35 views

Trying to use Tkinter to open dialog box in ArcMap

The following script works great from the command line but crashes from the pythonaddin: import Tkinter import tkFileDialog root = Tkinter.Tk() root.withdraw() pathtest = ...
1
vote
1answer
17 views

Generate PNG/JPG maps from multiple ASCI/GeoTIFF in Python/GDAL

I need to generate maps (saved in PNG, JPG or PDF) from raster files (for each file - one map) which meets following criteria; * each map has exactly the same color pallette, so that it will be easy ...
2
votes
2answers
318 views

create polygon adjacency matrix using python

I am trying to create an adjacency matrix from a set of polygons. That is, I have a bunch of polygons and I want to identify which polygons have a common edge or "touch" each other. Once I find this ...
1
vote
0answers
30 views

Are there any conditions that could break the creation of an arcpy.Polygon object?

I have a script that generates a mesh network from vertex and centroid inputs, and it works for almost all my points. But for some records that get created in the feature class via the script, their ...
0
votes
1answer
26 views

How to change output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script found in this post? import_path = r"..." # Path of .mxd ...
3
votes
1answer
3k views

Exporting .jpg files from data driven pages in Arcmap

I have generated about 90 maps through data driven pages(ArcGIS 10.0). I now want to export them as .jpg files in either landscape or portrait format. I tried python but it is not working, it worked ...
5
votes
3answers
416 views

Best practice in writing automated tests for QGIS plugins

I'm looking for some best practice advice on writing automatic tests for QGIS plugins written in Python. I have written tests for Python scripts in the past using PyUnit (the unittest module), but ...
3
votes
2answers
236 views

how to load the QGIS openlayers_plugin in standalone python script (not the QGIS embedded python console)

if I try to load the openlayers plugin in a standalone application it always fails with False, although paths are set, and plugin shows available. (tested on Ubuntu 14.04, QGIS 2.4, python-2.7) ...
0
votes
1answer
35 views

Extracting from attribute tables by arcpy

I'm having some trouble connecting ideas on how to solve a problem. What I have is a shapefile from which I have to extract from one field, which contains 3 types of attributes (BS, RS, BRN). For each ...
0
votes
1answer
38 views

Python geoprocessing tool for ArcGIS online

I am looking to create a geoprocessing tool using python in arcGIS 10.2 that will be used in the ArcGIS online web app builder. This will be my first tool for a web application and I would like some ...
0
votes
1answer
34 views

Arcpy - Updating fields using time.localtime()

My objective is to change the values under field "DATE_IMPOR" which are currently set at to the current time using time.localtime function. I'm having some problems getting there, above all one line ...
8
votes
2answers
2k views

Converting File Geodatabase Table to Access 2007 ACCDB table programmatically?

Does anyone know of a method to convert a File Geodatabase Table into an Access 2007 Table programmatically. I have been trying using the PYODBC library and a series of insert statements but am ...
2
votes
1answer
77 views
+100

Implement r.cross / ArcGIS Combine with GDAL

I am using GDAL to process a lot of rasters. I then need to combine all the arrays to create a single output raster that represents all the unique combinations of values. I.E the same thing as ...
1
vote
0answers
30 views

Import shapefiles into PostGIS using Python with psycopg2

I want to import shapefiles to PostGIS using Python with arcpy & psycopg2 to connect to PostGIS. I don't want to use the existing shapefile loader nor ogr, just write my own import tool. My steps ...
0
votes
1answer
36 views

Intermediate files disappear in ArcGIS 10.1

I am working with ArcGIS 10.1 creating some slope and aspect files. I do this: DEM_park = ExtractByMask(mosaic_name, park_area) and it creates the DEM_park file in a default gdb with a default ...
2
votes
1answer
2k 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 ...
0
votes
0answers
20 views

Calculate the time between two processes [on hold]

I need to calculate the time between 2 processes. I found a few things but they don't work: time.locationtime(time.time()), time.time() I can make start time which is ok. I can make end time which ...
0
votes
0answers
10 views

How to customize and add additional features in GeoNode

I need some advice on how to start customizing my GeoNode installation. I tried reading up on GeoNode documentations on how to do it but it always boils down to customizing or adding to the Django ...
2
votes
4answers
102 views

How to get values of last row in table with ArcPy/SearchCursor?

I would like to base my query on the last row of a table? I know the basic syntax/functionality for my search cursor, how do I query only the last row; Below is an example of my search criteria, ...
8
votes
3answers
840 views

Are there any training resources in SQL and Python as applied to GIS database management? [duplicate]

I've taken ESRI database courses, which have been helpful to my work. But I also need training in SQL and Python as applied to GIS database management. Any suggestions?
1
vote
2answers
28 views

Identify Census blocks inside urban areas (using pyshp or similar)

I am trying to find the Census blocks that are inside specific urban areas or urban clusters. The Census Bureau provides a list of urban areas/urban clusters with the following information: | ...
0
votes
2answers
48 views

Writing out comma separated values inside a single cell in a spreadsheet using python [on hold]

Please excuse the long subject header. I have gotten pretty good at writing data out to csv files but i seem to have stumbled into this block. Anytime a ',' (comma) is used to join values, it shifts ...
1
vote
1answer
36 views

QGIS processing script: Move points by specified distance and add segment

I try to move points (they come as WGS84, but I'm not sure if it works with unprojected CRS) by a specified distance and connect original and new point with a line segment with the below script, but ...
2
votes
2answers
333 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 ...
3
votes
1answer
250 views

How to clip a Oracle query layer directly in a Python script?

I have a query layer directly running from ORACLE database in a MXD. I want to clip this layer with a layer being created in another MXD in a Python based tool. My question is to do this clip ...
2
votes
1answer
71 views

Convert coordinates to differnt Spatial Reference System in Python

I am trying to convert co-ordinates (-33.75, 150) from epsg:3857 to epsg:28356 in Python. Using both of the examples in post How to convert projected coordinates to lat/lon using Python?, I get the ...
1
vote
1answer
20 views

Unable to execute a python script that was exported from ModelBuilder

I have a model that copies a single F.C form SDE geodatabase to a scratch geodatabase then copies it back with a new name to the same SDE geodatabase again. And this works perfectly form the model. ...
2
votes
2answers
283 views

Weird File Path Returning from Print Statement Causing ERROR 000732

I have created a python script in ArcGIS 10.1. My first parameter type is a 'Feature Layer' set to as a multivalue input. I was running my script quite well off of data from one of my drives (my ...
0
votes
2answers
222 views

What causes ERROR 000732 from MosaicToNewRaster?

I'm trying to run the MosaicToNewRaster tool as part of a python script. This is my code: input_rasters = arcpy.GetParameterAsText(5), arcpy.GetParameterAsText(6), arcpy.GetParameterAsText(7), ...
2
votes
1answer
146 views

Accessing CRS info with pyqgis in a standalone application

I'm currently having trouble accessing and defining CRS information in a standalone application. I've read the API documentation and have tried it in the python console in QGIS 2.2.0. The python ...
7
votes
3answers
4k views

How to convert projected coordinates to lat/lon using Python?

I assume this is a basic question but I can't seem to find or recognize the solution. This site returns Point: X: -11705274.6374 Y: 4826473.6922 when you searching with the first key value of 000090 ...
1
vote
1answer
26 views

How to convert from .shp to .csv using python and either gdal_translate of ogr2ogr

I am trying to convert .shp files to csv using either gdal_translate or ogr2ogr and python but its not work. if i run the following from qgis its not giving an error but at the same time its not ...
15
votes
4answers
8k views

How to add attribute field to existing Shapefile via Python without ArcGIS?

I have a Python script that adds an attribute field to a Shapefile if doesn't exist. This is easy to do with ArcGIS (graphically or via Python), but I'm looking for something that doesn't depend on ...
1
vote
0answers
18 views

Action on group of features from layer in QGIS?

I need to implement a rename action on a selected group of features in a certain order. The idea is that I would rename one feature and then select the features that are 'next in line' and execute a ...
1
vote
1answer
57 views

why does my script not save a layer when it encounters a “ \” character in the string

i have some code that takes a field and finds every unique value in that field. it then creates a layer for each unique value. The code is working ok , but it is failing when there are \ characters ...
0
votes
0answers
57 views

Not matching schema problems when appending a list of CSV's into an existing FGDB table

So far I have the following code for creating the FGDB table and defining fields which works just fine. But when I try to append a list of csv's to this table I always get a matching schema error. Do ...
0
votes
1answer
32 views

Combining and extracting attributes from 2 columns to populate a third (Concatenate)

I am working with a FEMA flood zone shapefile which contains a FIELD_ZONE field and a SUBTY field. I created a third field called ZONE_TYPE that needs to be populated by combining or extracting ...
1
vote
1answer
33 views

Odd Error in Metadata Script

So I developed a script that traverses through a root directory, and any subdirectories and catalogs layers files. Then exports these layer files' FGDC metadata and outputs them to a folder. The code ...
1
vote
0answers
17 views

How to control QGIS from within Anaconda's Spyder (Continuum Analytics Python distribution) in Windows

I would like to control QGIS from within Anaconda's Spyder, in particular use the QGIS core modules. My config: Windows 7 Anaconda 64x for Python 2.7 Spyder 2.3 Postgresql 9.4 PostGIS 2.1 QGIS 2.8 ...
2
votes
1answer
133 views

Python Error while installing Cartogram

I am quite new to GIS and qGIS especially. I would like to install cfarmers cartogram plugin. From what I understand, this has to be done manually - so I 've followed the instructions from ...