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

learn more… | top users | synonyms

1
vote
2answers
478 views

Using reader Feature Type Name as Writer Feature Type Name in FME

I've search and searched for a way to do this, but no method seems to work. Basically I want to use the input feature class name (feature type in FME) as the output name. This normally works, ...
1
vote
1answer
43 views

How to select Qgis features through Python Plugin

I am very new to Python. I am trying to find a way to select and zoom to the features in a QGIS layer. I have created a plug in and built a custom form. I have 3 values from the form which I need ...
4
votes
2answers
4k views

Nested “if” statements in ArcGIS Field Calculator

The solution in VB for the base process is @ "If then" VB Script code (or Python) equivalent to SQL's IN ('x','y',z') expression in ArcGIS Field Calculator question? ...
0
votes
1answer
96 views

Creating plugin in QGIS to access PostgreSQL? [closed]

i want to develop a plugin in QGIS to access to my database in postgres : i want to import a file.sql that contains my SQL Code in a textbox , and execute this code to assign myd database.
4
votes
1answer
1k views

Finding duplicate records in field using ArcGIS for Desktop?

im looking for duplicate records in dbf files based upon the attribute called 'ID'. I have various dbf files from 500,000 records to 1.5 million and I know there are a host of duplicates. I would ...
3
votes
1answer
911 views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
1
vote
1answer
125 views

How to calculate monthly maximum values from daily data in a 365 band grd?

I have a MINT2005.grd file which has 365 bands representing days of year from 2005. Each band is a 32x35 matrix representing the temperature at different latitude and longitude pair. How do I ...
3
votes
1answer
38 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 ...
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 ...
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
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 ...
1
vote
0answers
51 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 ...
2
votes
1answer
39 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? ...
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 ...
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
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
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 ...
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 ...
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). ...
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
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" = ...
3
votes
1answer
232 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 ...
0
votes
2answers
129 views

Error while importing CSV File using PyQGIS

Currently I am trying to import a CSV file using the python extension in QGIS and I have run into a problem that I can not seem to solve. I am trying to do a basic import of a CSV file from a python ...
2
votes
2answers
54 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, ...
1
vote
2answers
153 views

How to recode and recalculate Field Values using ArcPy?

I am trying to figure out how to do several calculations through python and the arcpy set. I have an large dataset (7+ million records of individuals), and I am trying to code a value of 1 that ...
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: ...
3
votes
1answer
47 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" ...
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 ...
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= ...
2
votes
1answer
50 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 ...
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), ...
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 ...
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 ...
4
votes
2answers
237 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 ...
7
votes
1answer
473 views

How do I call external files in Python Geoprocessing Service?

I have created a Python script which calls an R script and then reads the output back into Python. I can run this tool in ArcGIS Desktop (10.2.1) and it works fine. When I publish as a geoprocessing ...
4
votes
4answers
282 views

How to create a label formatted like “ 1,000' ” from a numeric field?

This question builds on a previous question I came across at gis.stackexchange: How to easily edit attribute data using Regular Expressions? Perhaps someone can point me in the right direction? I ...
2
votes
2answers
127 views

List all Feature datasets & feature classes from a single geodatabase into CSV

I have prepared a python code and I got the following errors: "Parsing error IndentationError: expected an indented block (line 11)" and "Runtime error Traceback (most recent call last): ...
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 ...
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 ...
19
votes
9answers
6k views

How do I develop my GIS programming skills?

I would like to develop my GIS programming skills, where do I start? People say learn C++ or Python but where can I learn this in a geographic context? Tutorials or anything would be very helpful, as ...
1
vote
1answer
231 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 ...
9
votes
3answers
3k views

How can I iterate over map layers in QGIS python

I'm having trouble figuring out how to iterate over map layers. I can access the currently highlighted layer in the table of contents via iface.activeLayer() but I want my code to operate on all ...
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 ...
1
vote
1answer
55 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 ...
2
votes
1answer
187 views

calling gdal_merge.py into another python script running GDAL processes

Good Afternoon All, I am wanting to use gdal_merge.py to merge a series of .tif files prior to clipping the merged file to a shapefile boundary, but want to do so as part of another larger script ...
6
votes
1answer
703 views

Working around slow processing times in ArcGIS Spatial Analyst functions?

I am batch processing a large amount of distance functions (~50,000) using ArcGIS 9.3. In this version, using spatial analyst functions, it seems to be the case that users cannot parallelize processes ...