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

learn more… | top users | synonyms

0
votes
0answers
28 views

Passing Value for Dictionary Look Up in Field Calculator fails [on hold]

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
2answers
43 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
0answers
48 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 = ...
2
votes
1answer
34 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 ...
-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 ...
2
votes
0answers
45 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 ...
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
43 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
4answers
53 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: ...
3
votes
1answer
26 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 = ...
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 ...
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 ...
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 ...
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
2answers
44 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
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 ...
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. ...
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
42 views

how multiply a ranges of values for other value on python

I need multiply ranges>1.5 and <=4.5 * 9, but I am new in this type of language. please help me. def CalcD(Level_water) if Level>1.5 and <=4,5 * 9
0
votes
0answers
34 views

QT GUI make for QGIS plugin

I was used to develop qgis2leaf on a Ubuntu machine and after each change on the PyQT dialog I've used "make" in the terminal to "compile" the GUI. How does this work on a Windows machine?
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 ...
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?
3
votes
2answers
44 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 ...
0
votes
1answer
23 views

How to set the spatial reference to a OGR layer using the Python API?

I create new a Ogr Layer with the Datasource.GetLayer() method: driver = ogr.Open(input_file).GetDriver() datasource = driver.Open(input_file, 0) input_layer = datasource.GetLayer() If the input ...
1
vote
2answers
62 views

Using Python For a Field Calc

In AcrMap 10.2 I'm trying to add a field and run this script in Field Calc: !shape.isMultipart! to see if I have any multipart lines. I keep getting geoprocessing failures. I am clicking the ...
3
votes
1answer
24 views

ArcMap Using Python to Rename a Feature Class based on Print Results

I would like to rename a feature class based on the EDITOR and DATE fields. I wrote this code: import arcpy fc = "C:\Users\PythonTesting.gdb\MyFile" f1, f2, f3 = "EDITOR", "DATE", "OBJECTID" ...
2
votes
1answer
41 views

Install QGIS on Ubuntu with GDAL built from source?

I am trying to install QGIS on Ubuntu 14.04. While I can easily install it via the package manager or apt-get, I find that QGIS, when installed, does not have Python support as expected. The symptoms ...
0
votes
0answers
43 views

name 'row' is not defined error appears overnight

I'm using arcpy with arcgis 10.0. I strived days to write my first python script, and I finally get what I want until...a new error occured during the night. The script you can see below was tested ...
0
votes
0answers
25 views

How do I auto-populate more than one other attribute field with values based on the value of another field within the same record?

Based on value selection from one attribute field, would it be possible to auto-populate many fields within the same record with predefined values either from a range of values within another field or ...
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 ...
1
vote
0answers
34 views

mark points on shapefile using python

I want to mark specific lat long coordinates on a shapefile using python. I am trying to use the plot function from matplotlib to do it. In the examples that have been provided, a basemap object needs ...
0
votes
1answer
47 views

Syntax error using ArcPy Spatial Analyst module in Python [on hold]

I'm very new to using python and figure I'm missing something obvious in the following script. I keep getting a "syntax error" message no matter how much I fiddle around with the first few lines. I ...
3
votes
1answer
37 views

Determine if shapefile and raster overlap in python

I am building a script in python using osgeo/gdal. I have a set of shapefiles and a set of GeoTiff raster files. I would like to have my script ignore shapefiles if they do not intersect with the ...
1
vote
2answers
45 views

Using Python to Rename Feature Class by Field ArcMap

Alright so I made a pretty little model and at the end I want to rename the feature class file to something based on the fields in that feature class. I want to rename that feature class by the date ...
2
votes
1answer
75 views

How to get information about layers using Arcpy

I have this layer structure in ArcMap: "Localities, Gazeteers, Bases, Regions, and Territorial Claims are all Group Layers. All others under these are layers. I have a script that uses the Arcpy ...
1
vote
1answer
54 views

Update a field for similar values in the second field based on third field value

So I have the table like this: City Distance NearFeature Comments A 90.5 131025 A 0 781446 B 15.5 131057 B 42.2 140521 C 21.7 784116 C 0 ...
2
votes
0answers
26 views

Programmatically Harvest and Disapprove Metadata - GeoPortal Server

Is it possible to synchronize an existing metadata catalog in esri's GeoPortal Server? I have access to the server, and have a script to add an XML file to our web accessible folder. After this script ...
-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 ...
1
vote
0answers
48 views

library for minimum bounding box “by width” in javascript or python

I'm looking for a library (or at least a code snippet) to calculate the minimum bounding box "by width" in javascript or python. Below is an illustration from the ArcGIS documentation of that ...
1
vote
1answer
88 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', ...
1
vote
1answer
31 views

How to copy a geometry with Python OGR?

I want to copy a geometry with Python OGR within a loop: I tried the following, but I get ERROR 1: Empty geometries cannot be constructed import ogr import copy d = ogr.Open('sampleData.geojson') l ...
1
vote
4answers
102 views

Calculate Field with Python Issues (If statements)

I don't know a whole lot about python and scripting, so I was hoping somebody could give me a couple pointers on fixing some code. I am trying to calculate a "final results" attribute field. The ...
4
votes
1answer
53 views

GDAL (or other open-source) equivalent of Arc's Point To Raster Tool

I'm trying to convert a python script that relies on arcpy into one that only relies on open source modules, but I'm having some trouble. The bulk of my processing lies in one Arc tool "Point to ...
0
votes
1answer
31 views

Ignoring group layers when iterating through layers

I have this nice code that goes through each dataframe in the current MXD, and through each layer in the dataframe, and generates a list containing the name of the dataframe, the name of the layer, ...
0
votes
0answers
22 views

How to check if there is an intersect between two coordinates? [duplicate]

I have two pairs of lat/lon (expressed in decimal degrees) along with their radius (expressed in meters). How can I see if there is an intersect between these two points? How should I deal with the ...
1
vote
1answer
25 views

How to use gdal's “forceToLineString()” with Python

I'm working with Python and GDAL and I'm quite new to this ^^ For my script I'm looking for a method to convert a MultiLineString into a simple LineString. Example: MULTILINESTRING ((0 0,0 1),(0 1,0 ...
2
votes
1answer
38 views

Qgis how to combine a geotif with a country border shape file?

I have 2 files. A geotif with different values and 1 shape file with country borders of this area. Can I generate with this 2 files an image with the country borders and the data from the geotif? ...