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

learn more… | top users | synonyms

3
votes
1answer
39 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
46 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
77 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
57 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
27 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
47 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
52 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
95 views

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
107 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
32 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
40 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? ...
3
votes
0answers
55 views

Geometric Network for Electric Utilities

I'm not expert in the use of geometric networks nor in Python scripting and I need help with the following problem. I'm using ArcGIS 10.0. I have defined a geometric network for an electric ...
1
vote
1answer
52 views

Run a custom model via ArcPy fails

I'm trying to geocode a few address using a custom model created. When running the model via model builder all runs perfectly. Also when running it via the embedded interactive python console in ...
0
votes
0answers
98 views

convert lat/lon into meters

I have a database of latitude, longitude and radius in the following form: 48180759,11518950,19.0 Both latitude and longitude are expressed in degrees but then multiplied by 1e6 (or 1000000). ...
1
vote
1answer
27 views

ERROR 000358: Invalid expression “Parcelles_class.OBJECTID” = 1 OR “output_table1.src_OBJECTID” = 1 Failed to execute (Select)

I'm executing this code. I don't know if i'm missing something, I'm using Arcpy, Python, Arcgis 10.1 whereclause1 = '"Parcelles_class.OBJECTID" = 1' whereclause2 = '"output_table1.src_OBJECTID" = ...
-1
votes
2answers
57 views

SelectLayerByLocation - arcpy

I have 2 layers: "atikot" and "ways" that located in C:\Project\layers\New File Geodatabase.gdb , and i try to use this code based on "ArcGIS Help 10.2" to select features from "ways" layer: import ...
3
votes
2answers
38 views

Gdal: clipping a raster with another raster

I'm writing a simple utility to crop batches of multi-band geotiff raster files to the same (smaller) area. Using gdalwarp, I can easily crop a file using a single-polygon clipping shapefile: ...
2
votes
2answers
55 views

Query for numeric field against text field that contains a numeric value

In my database, I have one field, Service_Day, formatted as numeric, which contains a single digit number 1 through 7 (for days of week). I want to compare it against another field, called Region, ...
3
votes
1answer
48 views

Confused about ST_DWithin function postgis

First Time here. Anyway, I have a database that I want to use to store user locations. I want to be able to get all the users with in say 15 miles. How do I do this. I'm using PostGIS 2.1. My SQL ...
2
votes
1answer
43 views

Nested SearchCursor functionality

I am trying to ultimately compare the gate height to the corresponding fence height located nearby. So far I have come up with the following: gates = "gate_line" fence = "fence_line" ...
1
vote
0answers
38 views

Unable to call GDAL functionalities from Python

I am trying to call GDAL functionalities from the following script I made in the past. import os, fnmatch from subprocess import call call("dir", shell=True) # define the variables inFolder= ...
0
votes
1answer
32 views

How to round up/down an pixel value of a raster to a pixel value with 2 decimal places?

I have a raster (DTM) with floating points as pixel value. Now i want to round up/down the pixel values (to its next nearest value) to 2 decimal places. I use ArcGIS (with extensions) and tried the ...
2
votes
1answer
52 views

How to format an excel table using python

I am trying to come up with a way to export an attribute table as a formatted excel table in ArcMap 10.2. I am aware that there is a "table to excel tool" in the conversion toolbox, but I am not sure ...
0
votes
1answer
49 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 ...
1
vote
0answers
32 views

Why must I write `geometryType() == 3` for point and polygon shapefiles?

I am asking this question based on the result I received from this earlier post. The following script only works if I set geometryType() == 3 as that is what is being printed out in the Python console ...
2
votes
1answer
37 views

netCDF4 Python climate algorithm

I have been working in Python with the Acaconda Python distribution to create code that accomplishes the following algorithm: I have multiple variable netCDF4 files [NCEP Reanalysis tmax(K), tmin(K), ...
2
votes
0answers
24 views

QGIS Python install question

Apologies for the 101 question; however, in trying to ramp up on python/QGIS I've seen mentioned that python.exe is the key executable in a python install. I have both Python 2.6 and 2.7 installed on ...
0
votes
1answer
61 views

Add CAD feature class to Arcgis using arcpy

I'm trying to add a CAD layer (point, polyline, annotation...etc) into ArcMap by python code, i'm using Arcgis 10.1, IDLE(Python 2.7), I faced many codes but they all gives errors, so i'm blocked ...
1
vote
1answer
63 views

Problem with Nested For Loop in ArcPy

I have two vector layer files, 'hausnummer_cropped5' and 'gebaudepoints_cropped5 - Kopie2'. Both have a point geometry and I am trying to shift the locations of the gebaudepoints_cropped5 points onto ...
2
votes
1answer
35 views

Merge tif files with python

I'm also having problems with running gdal_merge.py within another python script and I cannot run it. I already checked a similar problem here. My example is as follows: First I set my workspace and ...
0
votes
0answers
19 views

Python, KML and Geoserver/MapServer

I have this question: Is it possible to create an script that syncs a Google Drive folder with a MapServer/Geoserver and creates the visualization of an KML/HTML embedded file in Mapserver/Geoserver? ...
1
vote
1answer
30 views

QGIS 2.6 python PlugIn Error : NameError: global name 'QMessageBox' is not defined . any idea ? this use to work in QGIS 2.4

I am wondering why is this code not working ? def run(self): QMessageBox.information(self.iface.mainWindow(),"Ok", "You pressed F7") NameError: global name 'QMessageBox' is not defined ...
0
votes
1answer
42 views

Script giving error accessing field name

In the code below, the line 'alias = dict[fld.name]' always throws an exception. I don't see why; printing out fld.name works just fine. Also, the exception message is the field name printing ...
4
votes
2answers
238 views

How to identify polygon/point shapefiles in python?

I have a script which performs various functions on shapefiles, most of which are polygon-based. However, some shapefiles are point-based and I have to specify where these files are by editing the ...
1
vote
1answer
69 views

Trying to loop if condition at PYTHON code using Arcpy

I'm working with Arcgis 10.1, i'm trying to loop if condition on PYTHON code, but they give me as error : Parsing error IndentationError: unexpected indent (line 18) I don't know what is going wrong. ...
2
votes
1answer
24 views

QGIS - Edit UI - Python Init function localization with QTranslator

I have interaction with layer defined by custom designed UIs. In layer properties the following settings: Edit UI - customline.ui and Python Init function: customline_set.py. #coding: utf8 from ...
3
votes
0answers
24 views

Configuration problem anaconda python in ArcGIS

I used Eclipse with PyDev to create a script in Python (windows 7 x64). My code runs perfect when I start the run in Eclipse, but when I add it as a Tool in ArcGIS 10.1, I have the following problems: ...
3
votes
2answers
35 views

Exporting multiple dataframes as images using ArcPy?

I use this code to export a dataframe to png, and it works. import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] ar = df.extent.height / df.extent.width ...
2
votes
1answer
54 views

Add value to field using arcpy

I calculated the azimuth angle between two points. I'm trying to create a new field where I will store my angle values, but although the field is created it stays empty, no values within! I'm using ...
2
votes
1answer
26 views

Trouble renaming layers using arcpy

Running ArcMap 10.1 So, I have a bunch of layers that all have the same name. I'm trying to rename them so that they have names that actually mean something. Everything runs fine until it is time ...
2
votes
0answers
57 views

Raster to polygon using R [closed]

I am trying to convert a raster object to a polygon object using R but I am running into some problems using my Windows 7 machine. I originally tried to use rasterToPolygons (package: raster) but it ...
1
vote
1answer
70 views

Use row as input to other processes in python

I am new to python and need help. Looked for my answer but don't know if I am even using the correct terminology. I have a model in which I iterated through rows and performed a set of processes on ...
1
vote
1answer
56 views

Bulk insert with Python and cx_Oracle into st_geometry enabled table

I'm trying to make a bulk insert of a CSV file with Python and cx_Oracle into an st_geometry enabled table of an Oracle database with ArcSDE. I could do it with the method execute() of cx_Oracle but ...
4
votes
2answers
52 views

How to check for corrupted raster data?

I am working with thousands of tiled (2km x 2km) 4-band NAIP images. When I diced the images in Erdas, the program corrupted many of the tiles. The screenshot shows an example of one of the ...
2
votes
1answer
34 views

Is there a python version of qTuio? [closed]

Is there a python version of qTuio? qTuio is implemented in C++. However, I am currently trying to use pyqgis due to problems with C++ environment (I cannot even create a raster layer). Any help is ...
1
vote
1answer
31 views

How to use a feature class attribute to look up values in a table and pass them as parameters to a function?

My problem: I have a set of points inside a polygon. My goal is to figure out how long it takes (in days) for each point to move outside the polygon, based on a daily movement which affects all the ...