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

learn more… | top users | synonyms

0
votes
0answers
17 views

Exporting ArcSDE feature class to shapefile using OGR?

I'd like to export data from ArcSDE for SQL Server to SHP. I've tried first to run this python script in QGIS: http://trac.osgeo.org/gdal/browser/trunk/autotest/ogr/ogr_sde.py But finally I've got ...
1
vote
0answers
27 views

Why does this python OGR code for creating a layer and then adding a field not work?

Spot the difference! So this works... fp = "C:\\LiDAR\\MyLayer.shp" layer = "MyLayer" driver = ogr.GetDriverByName("ESRI Shapefile") data_source = driver.CreateDataSource(fp) srs = ...
1
vote
0answers
20 views

Python code to determine the position on a map using Geo-Tagging

What is a proper python code, which enables to scan photographs (when captured from a series of snapshots) and match it with a geo-tagged image database. Based on the extent of similarities existing ...
2
votes
3answers
105 views

Iterating using search cursor and layer selection performance?

I'm trying to use the results of a search cursor to iteratively make selections on a feature class and then create new feature classes (so you get a new feature class or shp for each unique value in a ...
0
votes
0answers
26 views

ArcPy select and merge dropping records from table?

I'm working on a python script for ArcGIS using the arcpy module. I have ArcGIS 10.1 and Python 2.7 on Windows 7 machine and using Notepad ++ and IDLE to run it. The script selects specific records ...
0
votes
0answers
16 views

CreateObject cannot open map document error when cycling through list of MXDs

I have a stand alone Python script that aims to make a list of data sources from a series of folders/sub-folders full of MXDs. However I am continually getting the: CreateObject cannot open map ...
0
votes
0answers
18 views

Gdal_Calc.py random pixel error

I'm using the gdal_calc.py in python in order to do the same thing as the Con tool in ArcGIS. I'm calling the .py using os.system: os.system('gdal_calc.py -A%s -B%s --outfile=%s ...
0
votes
1answer
37 views

Data driven page with Count

I was wondering if there is a way to add coding to Data Driven Pages with python. I would like to be able to take the "Data Driven Page with Count" and increment the count by one or in some cases ...
0
votes
1answer
63 views

Summing column values in table using arcgisscripting?

I need to create a python script that sums a column's values in a table. Thereafter, the script is supposed to get the percentage of each individual row in that column and populate this percentage ...
2
votes
1answer
17 views

OGR DeleteDataSource not working properly in Python

I have a small Python script which is supposed to delete a shapefile in case the file is empty. import sys from osgeo import ogr drv = ogr.GetDriverByName("ESRI Shapefile") ds = drv.Open(inData) if ...
2
votes
2answers
49 views

Duplicating polygons in Layer using ArcPy cursors?

I am trying to Duplicate some polygons in the same layer with the same attributes, But it will duplicated them with Null Geometry, i have tried getValue() method, but i got error import arcpy ...
0
votes
0answers
15 views

QGIS 2.4: adding feature with setLineEdit() data not saving to database

A while ago, I struggled to get a combo box working correctly for QGIS 2.0. This involved transforming a combo box into a line edit if the item named "other" was chosen, enabling the user to add a ...
0
votes
1answer
59 views

Create polylines from point array Python

I am working on building polylines from an array of points I have created from a csv file and am completely lost in building the lines. My code works as follows: I have the point array working, I need ...
2
votes
1answer
73 views

How would I group values in a field based on range of number using python, and then update the attribute table?

An example of what I'm trying to accomplish is described below, however they don't describe how to use the data update cursor to update the attribute column. data - Group values based on range of ...
1
vote
2answers
76 views

How to merge dbf files(zonal statistics as a table) in GIS environment.?

I am not very savvy at using Python. Actually I have around 1000 output files from using the tool zonal statistics as table in ArcGIS. The names of the files are jan_60, feb_60......dec_13. These all ...
0
votes
1answer
34 views

Spatial ETL Tools won't run “AttributeError: 'module' object has no attribute, etc.”

I have a python script that runs 5 Spatial ETL tools that I wish to run as a scheduled task. Each of the tools will run successfully from ArcCatalog and also from the ArcCatalog Command line. If I ...
0
votes
0answers
23 views

Unable to load shapefiles fully using shapefile.py

I am trying to load my shapefiles directly via Python rather than loading them from Arc Catalog to ArcMAP. I load these modules first: import sys import os import arcpy import numpy Then I add a ...
0
votes
0answers
12 views

Python error with OpenLayers [duplicate]

I have recently downloaded QGIS 2.2.0. I am trying to use OperLayers, but I constantly get this message: Errore durante l'esecuzione di codice Python: Traceback (most recent call last): File ...
0
votes
1answer
13 views

ValueError using MapProxy decorate image middleware with WMS

I am successfully using Mapproxys decorate image middleware to apply a watermark to WMTS tiles. I am using the following code: def annotate_img(image, service, layers, environ, query_extent, **kw): ...
0
votes
0answers
39 views

developer problem with PyQGIS

I am a QGIS developer. We have been modifying the source code of QGIS for several months and have done good work in QGIS version 2.1. After that we tried to do the same modifications for QGIS version ...
1
vote
1answer
28 views

How to visualize shortest path that is calculated using Networkx?

I have a graph G (made from a road network shapefile), and a source node S, and a destination node D. I have calculated the length of shortest path using single_source_dijkstra_path_length, but now I ...
1
vote
5answers
97 views

Calculations in if statement

I want to perform a simple calculation with the Field Calculator using this piece of script (note that all the elif statements are attempts for another syntax and non of the worked): def ...
2
votes
3answers
74 views

How can I iterate Selection by Attributes?

I have a large data shapefile for the state of New York. Each shape has a code corresponding to each county, so I want to iterate "Selection by Attribute" for each code, create a layer from all the ...
0
votes
1answer
33 views

count attribute in raster

I'm trying to calculate the total number of counts a raster contains using python script. When I ran the script, I didn't get any error. However, I also didn't get the number of counts for each row in ...
0
votes
4answers
49 views

Populate a field from another field with a conditional

I am working in SDE geodatabase where I have a feature class 'Mange_Waste' and "Q1", "Q2" are two fields. I wanted to use python script for populating "Q2" from "Q1" with a condition. Like, if the ...
1
vote
0answers
19 views

Doesn’t cal AGSSOM program to manage AGS mapservices from python script

We are using ArcGISServer 10.0 on a windows server. Because of database management we need to stop several ArcGISServer Services. For this purpose I use the AGSSOM program, which is called from the ...
-3
votes
0answers
30 views

Batch Convert shape files into aoi's in erdas

How to Convert Shape files in batch mode to aoi's in erdas through python script?
0
votes
1answer
28 views

Erdas python scripting help

I want to write scripts for Erdas in Python. I downloaded some Python examples here but I could not make much. Where can I get the full Help material for Erdas python scripting?
7
votes
1answer
139 views

Batch Georeferencing in ArcMap 10.2

I have about 50 pdf maps that I would like to batch georeference and/or georectify. I've saved one as a jpg and georeferenced it manually and would like to automate the rest which are in the same ...
0
votes
0answers
72 views

QGIS 2.4: plugin changes map tool canvas click behavior from 2.0

I had created a plugin for QGIS 2.0 to add new features more easily. It involves changing extents and updating snapping options along with triggering the default actionAddFeature(). However, I've ...
1
vote
1answer
28 views

How to create an Erdas batch list file (.bls) using Python?

How can I generate the Erdas batch list file (.blf) using Python? For example, I want to run a 5x5 median filter in the Batch Command Editor using a subset of images within a folder. Erdas provides ...
1
vote
2answers
53 views

Python query to find records with more than one alpha character in a field

Using ArcGIS Desktop 10.2. I have a field in a table of several thousand records. The field is made up of alphanumeric characters. I'd like to perform two queries using python on this field: ...
0
votes
1answer
39 views

Converting Raster datasets into layers using ArcPy/ModelBuilder?

I am new to ArcGIS and ArcPy (just started using them on Wednesday). I am using a model to create a Point Density plot from a Shape File, with the output being a Raster dataset. I want to ...
0
votes
0answers
25 views

Running a bat file for rebuilding and republishing a geocoder using two Python scripts, but would it work better as one script?

We all love ESRI and Python.... I'm looking for some insights and here is the situation. I've got a bat file calling two separate .py scripts. The first .py is a geocoder rebuild and the second is a ...
0
votes
2answers
70 views

Python library or algorithm to generate arc geometry from three coordinate pairs?

I'm trying to write code to generate fixtures for a django/geodjango project. I need to generate geometry for arcs (line string) given three lat/long pairs; start of arc, end of arc and centre of arc. ...
2
votes
1answer
97 views

Python support with QGIS 2.4 on Ubuntu 14.04

I recently updated my Ubuntu system to version 14.04. I added the sources and installed QGIS as per the directions on the QGIS website. Everything looks good, except for I do not have all the ...
0
votes
1answer
23 views

How to read Oracle data with PyQGIS? (“identifier is not long” error)

Do you have any idea how load Oracle spatial data to QGIS with using the PyQGIS? Is it possible? I try: uri = QgsDataSourceURI() uri.setConnection("*host*", "1521", "*database*", "*username*", ...
1
vote
2answers
52 views

python crop aerial image

How can i crop an area from an aerial image knowing the latitude and longitude of the image's corners and also the cropped section? I have a LiDAR scan and i and want to crop an image overlay to fit ...
4
votes
1answer
95 views

How to cancel tool execution in python

I've written a python function that calls a tool (Import CAD to GDB) in a loop. When I run it I have seen that it hangs sometimes, and I have to force the script to quit. I am wondering if there is a ...
0
votes
1answer
37 views

How to plot Storm Prediction Center (SPC) Shapefile using python

I am trying to make a plot of the SPC's thunderstorm outlook using Python. I have downloaded the shapefile from this website http://www.spc.noaa.gov/products/outlook/day1otlk.html. Then I use this ...
0
votes
0answers
35 views

how to remove a point or polygon in shapely python

I want to place minimum number of sensors(circles) to cover a maximum area(polygon). I am using "Shapely",python module. I want to know if a sensor i.e a point buffer inside the range of the other ...
0
votes
1answer
51 views

Getting error 'exceptions.NameError' in Python script?

I'm getting <type 'exceptions.NameError'>: name 'B' is not defined when I run this script. Why is my 'B' not defined and is it a syntax error? For clarification, I am trying to get the code to ...
0
votes
1answer
28 views

How to determine bounding box of current qgis 'map canvas extent' from the python console

I've asked a similar question here: How to quickly calculate bounding box coordinates of a selected polygon with qgis ...regarding a quick way to determine the bounding box of a given layer. Is ...
0
votes
1answer
33 views

Issue using Matplotlib in QGIS

I am developing a QGIS-plugin and for graphing I want to use matplotlib, like many other QGIS -plugins. This worked fine under linux, but under windows with QGIS2.4 I am experiencing problems. I ...
0
votes
0answers
14 views

QGIS + python, Attribute index 0 out of bounds [0;0] when adding a feature to a PostGIS layer (view)

I have a plugin which adds features to a particular PostGIS vector layer using the code below feat = QgsFeature() feat.setGeometry(qgsgeometry) layer.dataProvider().addFeatures([feat]) For one user ...
0
votes
1answer
41 views

Arcpy Subtracting rasters error - TypeError: 'unicode' object is not callable

I have a script which subtracts 2 versions of the same raster from each other (one newer than the other) and then extracts the additions & deletions that have happened. I created a simple test ...
-1
votes
3answers
38 views

ArcGIS arcpy code fails in Toolbox mode

This code executes correctly in Python window but fails with ERROR 000732: Input Table: Dataset JHJ does not exist or is not supported # Import ArcPy and other required modules import arcpy ...
2
votes
0answers
81 views

GIS projects with a raspberry pi [closed]

Does anyone know of a project using a raspberry pi and gis that would work for a research project for a computer science major? I am looking to do a research project involving a raspberry pi and ...
2
votes
2answers
151 views

How to bulk print maps using ArcGIS or QGIS?

I have a polygon layer that I would like to print images or PDFs from in bulk as there are a large number of them. Rather than having to manually scroll and print each individual'site' in the print ...
0
votes
3answers
31 views

FeatureClassToFeatureClass_conversion in ArcGis 10.1

I have many > 60 .dwg files I want to convert just the polyline parts of these and have put together a list of python commands using excel to get something like this: However when I try running ...