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

learn more… | top users | synonyms

1
vote
0answers
15 views

Passing Value for Dictionary Look Up in Field Calculator fails

I've a field calculator that I am trying to use that uses a csv file to look up appropriate value based on key that is passed provided to the function. As provided below, the only values calculated ...
2
votes
0answers
42 views

Access ESRI .GDB in PyQGIS

I can access ESRI .GDB data using OSGeo's OGR. The following code gives feature class names embedded in .GDB... from osgeo import ogr driver = ogr.GetDriverByName("FileGDB") data = ...
1
vote
2answers
122 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 ...
3
votes
2answers
634 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
1
vote
1answer
138 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
2
votes
2answers
39 views

Creating a weekly FGDB backup of ArcSDE?

I need to create a script that will copy our county's parcel data, maintained in SDE/SQL, to a file geodatabase. This script will be run as a scheduled task over the weekend. What GP tool do you ...
2
votes
2answers
183 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
220 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 ...
1
vote
4answers
52 views

NameError: variable not defined even though set multiple times

This code original worked when run through the python shell in ArcCatalog. After I added the script to a toolbox I have had all sorts of troubles. The most frustrating error has been: NameError: ...
1
vote
1answer
541 views

Linux Client for OpenGTS server

I've installed an OpenGTS server and successfully linked it with the GPS2OpenGTS_Pro application for android. The buses I'm tracking offer 3G with a wireless AP, however whenever the bus stops, the ...
0
votes
1answer
37 views

How to draw perpendicular/Parallel line using pyQGIS?

While digitizing a line with multiple segment, how to create a particular segment parallel to (or) Perpendicular to another feature using pyQgis?
2
votes
3answers
1k views

Adding shapefile as layer in ArcMap via Python scripting?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...
2
votes
0answers
49 views

Iteratively exporting from Table to .txt in Model Builder (ArcMap) not appending correctly

I am solving a location-allocation type of problem where I use a loop to go through several specifications of the problem. The model runs fine, and produces the vizualization outputs just as expected. ...
1
vote
1answer
3k views

ArcGIS Iterate Files tool in Model Builder

I want to use a "simple" iterator to process all the text files in a directory using my model but model builder won't let me connect the file to the first step of the model. Once I run the Iterate ...
2
votes
0answers
43 views

Help with Python/GDAL documentation

The instructions from the url http://gdal.org/gdal_tutorial.html give the following example: dataset = gdal.Open( filename, GA_ReadOnly) with the following description: It's interpretation is ...
3
votes
1answer
25 views

Help with Python script to query feature server

For the purpose of saving the data locally from a feature server online I have written code below: import arcpy fcout = r'C:\Forum\Hydrants\test01.shp' url = ...
2
votes
0answers
28 views

Access ArcCatalog Window through ArcPY

I want to create a button in ArcCatalog that takes the metadata from the selected file in ArcCatalog and prints it to a text file. The metadata extraction part is done, and I have succssfully tested ...
2
votes
1answer
18 views

Output raster from IDW interpolation tool is from 3.40282e+038 to -3.40282e+038 in ArcPy

I am not familiar with Python in ArcGIS, so I used ModelBuilder first to set the environment and put the tool in. The model worked right and the output raster seemed good. Then I exported the model ...
0
votes
1answer
34 views

Can not SET a Value in table using Python?

I'am trying to set values in table, the code run good, i don't got errors, but nothing is done ! I'm using Arcgis10.1, arcpy and Python This is the code : import arcpy import math import arcview ...
1
vote
1answer
76 views

Find and replace text based on feature class attribute

I've been struggling with this problem for a few days. It seems to be more programmatic than geospatial in nature, so I'm open to suggestions to redirect this elsewhere. I have a text file ...
1
vote
1answer
313 views

Python scripts execution in ArcGIS Runtime WPF app

DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far… I am facing a quite interesting requirement: "run python scripts within an ArcGIS Runtime app". checking the concepts in the ...
-2
votes
0answers
21 views

AttributeError: 'module' object has no attribute 'users' [on hold]

I'm new to PYTHON. I keep getting above error. B elow is my code #!/usr/bin/python import socket import sys #with open('./users.txt', 'r') as f: with open('./users.txt') as f: for users in ...
0
votes
1answer
48 views

Replace a feature class in a feature class list

I'm using arcpy with arcgis 10.0. I try a script that erase successively all the feature class of a list depending on a reliability field value. Each time a feature class is erased by an other one, I ...
5
votes
1answer
364 views

QGis Zonal Statistics Plugin NoData included in Calculations

I have been trying to use the QGIS zonal statistics plugin. My raster has a nodata value of -99999 and all other values are positive. After computing the mean zonal statistics there are a number of ...
1
vote
1answer
42 views

Creating Self Executing Python Script (*.py)?

Trying to figure out how to create self executing python scripts with using the ArcGIS python window. I'm ok (generally) when developing and running scripts inside the python ArcGIS windows but ...
1
vote
1answer
2k views

How to Clear Selected Features in Arcmap using Python

I would like to Clear Any Selected Features using python since it causes an error if I run my tool and the user has a recorded selected. I need some thing here that runs ("CLEAR_SELECTION") first ...
1
vote
3answers
530 views

ArcGIS 10.1 crashes on use of python window

When I open the python window in either ArcMap or ArcCatalog (ArcGIS 10.1) as soon as I press a key it freezes the entire program and it crashes. It doesn't produce any warning, error, or pop up with ...
2
votes
2answers
104 views

Get Index for a group QGIS Python

I am trying to add new layers into a specific group which I can get to work if I know the index but how can I get python to fid the index of a group so it can load the new layer into the group ...
3
votes
2answers
380 views

How to add layer/raster with specific position in the QGIS layer list?

I use addRasterLayer(rast,'Name') but this adds the raster to the top. It is possible to set position when I add raster at once? Is it possible??
2
votes
1answer
48 views

geting geograpic locations from an address list

I have a table with 150 addresses. I would like to automaticly generate a point shapefile/PostGIS layer from all of them. Is that possible in any way or do I have to search for every single address to ...
1
vote
2answers
108 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 ...
4
votes
2answers
1k views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
0
votes
0answers
22 views

GDAL/OGR Python [on hold]

Does anybody know any sourses explaining methods, atributes of Python wraped GDAL? http://gdal.org/python/ - does not do it. It shows lists without explanation. ...
0
votes
0answers
24 views

Meaning of AttributeError: 'module' object has no attribute 'da'? [duplicate]

error is : AttributeError: 'module' object has no attribute 'da' Code is below: import arcpy import os from arcpy import env # Set local variables inWorkspace = "Q:\\NHD project\\Connection ...
2
votes
1answer
216 views

Index for data driven page created atlas?

We have a parcel atlas created from a data driven page document where each page represents a particular 16 mile square township. I have created my own index of polygons instead of ArcGIS index ...
0
votes
0answers
14 views

Make qgsmapcanvas.extent().size equal to qwidget.size()

I am using Qt and QGIS to write a touch device application. Right now, I have a QWidget which is the child of qgsmapcanvas, and both of them are full screen. However, the qwidget size is (1920,1080), ...
2
votes
1answer
349 views

How to interpolate GPS data correctly?

I'm working on a project that involves using linear interpolation to fit lines to lat/lng points. I'm pretty new at scientific programming related stuff, and I was wondering if people could steer me ...
2
votes
2answers
42 views

How to encode a point geometry in Geojson?

I have point geometry in posgresql which I query as follows: select ST_AsText(geom) as pointgeom from pointable. I'm using python as server side script. I want to pass the result as Geojson response ...
-1
votes
2answers
46 views

Intro to Geoprocessing Scripting with Python for ArcGIS? [duplicate]

Can you point me to any recommended online resources where i can learn the fundamental basics of geoprocessing scripting and the different modules/python has available for an ArcGIS environment. I ...
2
votes
3answers
181 views

Executing Python code takes a lot of time (more than 2 hours)? (Arcgis10.1)

I am executing this Python code, in which I am trying to determinate the position of neighbor parcel (north, south, east, west). It works fine but it took 2 hours for just 50 parcels! I think that ...
1
vote
1answer
26 views

MakeFeatureLayer_management wrong output

I have a huge database with Sightings from whales and dolphins from 1995 till today. So I want to sort the database with python. Till now I can make FeatureLayers for each year for ...
2
votes
2answers
27 views

Add both string and automated numbers in series to attribute table using field calculator

I would like to fill a column in my attribute table with an string that ends in a numeric value. Example: Object001 Object002 Object003 I would like to automate the process of filling in the ...
1
vote
1answer
81 views
+50

How to update projection of layers in Geoserver using gsconfig

Im using following code to find projection of layer from geoserver.catalog import Catalog cat=Catalog("http:// localhost:8080/geoserver/rest") myResource = cat.get_resources(store='storeName', ...
0
votes
1answer
53 views

Error 000728 field does not exist within table - field already exists

I am running arcpy.AddField_management to add a field called "cnid" and update it with x centroid values. For add.field I get the error "cnid" already exists. I tried print.field name and I cannot ...
0
votes
0answers
31 views

Rename open MXD using ArcPy

Is there a method in ArcPy that will rename the MXD you currently have open? I don't what to use mxd.saveACopy("newFileName") as it will just save a COPY with a new name, not rename the current MXD. ...
1
vote
2answers
153 views

Save a layer for each unique value using Python in QGIS

I have a map, in which each region is defined as an attribute of the map (I can select each region from the attribute table). I am trying to create new layers each one containing only 1 region using ...
5
votes
5answers
4k views

How do I build a form within ArcMap?

I am building a file geodatabase using ArcGIS. The gdb is going to be distributed to dozens of 'stand alone' machines. End users are expected to populate the gdb with data. End users do have ArcGIS ...
11
votes
4answers
4k views

How to develop GUI in Python for geoprocessing?

I want to develop GUI in Python for geoprocessing, but I don't know what is the best GUI tool or library (Tkinter, PyQT, wxPython) for geoprocessing? Can I use PyQT for GUI programming in ArcGIS?
2
votes
2answers
848 views

OSR Python testSR.ImportFromEPSG(4326) returns empty spatial reference

This is empty using Python .ImportFromEPSG(4326): import osr #this fails: testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) print testSR.ExportToPrettyWkt() #why did the import from EPSG ...
3
votes
2answers
43 views

ArcGIS Removing values from a shapefile with Python

I've got a monster shapefile with lots of duplicate records, however each duplicate record has an accuracy rating. I want to remove all duplicate records with a lower accuracy rating. This would be ...