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

learn more… | top users | synonyms

2
votes
1answer
315 views

How to implent a “maketrans” python function on field calculator

i'm traying to implent python string translate function at field calculatore http://www.tutorialspoint.com/python/string_translate.htm in order to fix hebrew imported from cad. here is the code - def ...
7
votes
4answers
1k views

Visualization of satellite image - directly in python

Is there any way (a package or what not), to visualize a geotiff image directly in Python? I don't want to use ENVI or ArcGIS or anything else. Thank you in advance.
3
votes
3answers
2k views

Create an ArcCatalog OLE DB Connection using Python

Is it possible to create an OLE DB connection (*.odc) to a database in ArcGIS 10 , but using Python instead of the ArcCatalog GUI wizard? I don't need to necessarily create a file on disk, just make ...
3
votes
1answer
448 views

Need help translating small code block from VBA to Python

I need help from someone to translate a small piece of code from VBA to Python, due to the fact that the company I am working for has upgraded from ArcGIS 9.3.1 to 10.0 and VBA is no longer supported. ...
3
votes
3answers
728 views

arcpy.Exists not working within standalone script

I have the following code. I want to see if a layer name exists within a map document, not if the shapefile exists in the directory. If I copy paste into the python window within ArcMap works fine. ...
6
votes
3answers
3k views

Raster: How to get elevation at lat/long using python?

I was wondering if anyone has some experience in getting elevation data from a raster without using ArcGIS, but rather get the information as a python list or dict? I get my XY data as a list of ...
5
votes
2answers
788 views

rpy2 installation on Mac OSX. A still unresolved problem on StackExchange and rpy-list [closed]

following lgautier's advice on rpy2 installation on Mac OSX, I posted my request on rpy-list and got in touch with Yair Benita who said he could only install rpy2 through his default Mac OS X python ...
12
votes
2answers
7k views

How to run a simple python script for QGIS from outside (e.g. Sublime Text)?

I would like to run a few small and simple python scripts for QGIS (Mac) from "outside" of QGIS. With outside I mean in this context, either the normal os command line (terminal.app) or even better, ...
2
votes
1answer
280 views

How to manipulate OpenStreetMap schema to be useful in ArcGIS applications?

I have a shapefile of OSM data. I plan to use the data for an ArcEngine application, and I was wondering if there are any existing solutions to getting the data's schema into your typical GIS format. ...
9
votes
2answers
506 views

Generate near table for x number of neighbours using arcpy

There are 3 likely scenerios that I am trying to capture near distances for: An interchange subway station, which has 2 or more neighboring stations. That is, the station in question connects 2 or ...
20
votes
8answers
2k views

Value of a Python programming course

I am considering upping my programming skills by taking a python geoprocessing course through ESRI. Before I part with the hefty registration fee, I would like to get your opinion on the value of 24 ...
8
votes
3answers
427 views

Using ESRI geoprocessing services from a non-ESRI client (Python)?

I'm thinking it should be possible to consume an ESRI Geoprocessing service from a python script without invoking ArcPy or needing an ESRI installation on the client machine. For example I create a ...
3
votes
1answer
1k views

Add multiple fields in attribute table

How do I add in multiple fields in the attribute table? In the attribute table I have crop types such as corn, cotton, sorghum....etc (as shown image below), in square meters. and I want to generate ...
1
vote
1answer
1k views

SImple model works, resulting script doesn't

The goal is to convert an XY layer (from Excel) into a feature class. The "MakeXY" portion works flawlessly, the arcpy.FeatureClassToFeatureClass_conversion portion inevitably returns a 999999 "Table ...
3
votes
2answers
861 views

How should I go about calculating the centroid of several lat long points in python, and perl?

Calculating the centroid several time on a number of geographical points. I was wonder is there a perl or python module that could make my life easier when working with large datasets of lat long ...
5
votes
2answers
294 views

ToolValidator not doing anything

I have created a simple script tool which has a single parameter of type "String". I have written the tool validation to disable the input field (simply trying to learn tool validation). The ...
2
votes
1answer
261 views

Creating a model to run a complex query

I'm just a rookie when it comes to creating models in ArcGIS. I have two shapefiles from which I need to calculate an AVG and a MAX erosion rate for individual properties. The two shapefiles are: ...
1
vote
1answer
567 views

How to get a signal when the geometry to a line in QGIS is changed

I am working on a plugin in QGIS and want to get a signal when the geometry to a feature(in this case a polyline) in my layer is changed. For example if I use the node tool to drag one of the nodes. ...
1
vote
0answers
35 views

qgis.core error [duplicate]

Possible Duplicate: qgis.core import error I am new in quantum gis and python, I installed quantum gis 1.8 from osgeo4w installer, after I installed python 2.7 and started python shell and ...
6
votes
2answers
1k views

Creating a multispectral image from scratch

I want to make a multispectral image from cero to do some tests on it. Something really simple like 5 completely uniform bands with salt and pepper noise on them or a square of different values at the ...
2
votes
2answers
3k views

arcpy.Delete_management not deleting a geodatabase folder

This script runs fine the first time but fails when run the second time. The issue seems to be that the KMLToLayer_conversion statement creates a file geodatabase (no surprise) that subsequently ...
3
votes
0answers
76 views

Adding points to represent non-chosen locations

I am looking for a way to set up a discrete choice model in ArcGIS for foraging behavior of individuals, in a grid of 15 locations. To do that I need a point for every possible choice they could have ...
1
vote
1answer
582 views

rpy2 installation on Mac OSX

I'm desperatly trying and retrying to install rpy2 on my Mac OS 10.6 in order to run SDA4PP plugin on QGIS. My version of R is 2.14.0 and it was obviously compiled with the option --enable-R-shlib ...
1
vote
2answers
1k views

How to batch convert Shapefiles to GMLs?

I know how to do this within Quantum GIS but I have 30+ shapefiles that need to be converted to GML. Is there a Python script sample or plugin for Quantum GIS that I can use to convert my shapefiles ...
1
vote
1answer
743 views

Applying layer file not formating labels in ARCGIS 10

I'm applying layer files in ARCGIS 10 using the ApplySymbologyFromLayer_management command via a python script tool. The symbology part works fine but the lables are not formatting. It is my ...
7
votes
3answers
422 views

Remove username and password from saved arcgis layer (.lyr) files?

How can one remove the saved username and password from arcgis layer (.lyr) files? A scripted solution preferred but even a point and click method will be welcome.
0
votes
2answers
2k views

Replacing NULL values in geodatabase table?

How do you update NULL values within a geodatabase table using the ArcGIS Field Calculator (service pack 4) without changing other values to NULL? I've tried the suggestions on this previous ...
3
votes
2answers
2k views

How to perform volume calculation in QGIS

EDIT 07/12/12 Ok, meanwhile I came to another problem I want to discuss. I just tried around with the volume calculation with some layers and came to a point where I receive the following error. ...
5
votes
2answers
2k views

How to return individual address components (city, state, etc.) from GeoPy geocoder?

I'm using GeoPy to geocode addresses to lat,lng. I would also like to extract the itemized address components (street, city, state, zip) for each address. GeoPy returns a string with the address -- ...
1
vote
3answers
1k views

How can I edit a file geodatabase without using tools from Esri?

I am looking for a tool (Python library etc.) that would allow me to edit a file geodatabase without ESRI software? It is possible?
7
votes
1answer
2k views

How to get GDAL to create statistics for GTiff in Python

I regularly create my own GeoTIFF rasters with GDAL in Python, e.g.: from osgeo import gdal from numpy import random data = random.uniform(0, 10, (300, 200)) driver = gdal.GetDriverByName('GTiff') ds ...
4
votes
1answer
903 views

How to save a newly created shapefile in PostGIS?

I am creating shapefile using shapefile.py and my database has records more that 65k which is the limit of the shapefile. How can I create shapefiles then? Is it possible that somehow I am able to ...
3
votes
1answer
435 views

Creating a Raster Filter

I am looking to create a raster filter which reclassifies single or contiguous pixels less than, for example, 30 pixels (shown in white below) into another class (shown in black). The filter, ...
3
votes
3answers
757 views

Add date to feature class name?

I still working on my big project, big at least for me, but I am currently stuck on this: I have a lots of .shp, that I want to move to a gdb. While creating a feature class, I want to add date ...
5
votes
1answer
1k views

Reset local memory in ArcMap 10

I often am unable to delete files due to a lock or need to reset the data frame coordinate system. Very often starting a new session of Arc will allow certain geoprocessing or data management tasks ...
14
votes
11answers
9k views

Python GDAL package missing header file when installing via pip

I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too. I'm trying to install gdal from pip pip install gdal inside a ...
8
votes
4answers
2k views

Python script - how to avoid exclusive schema lock error?

I have a script for updating some features on my database every night (just for copying and replacing some features). This features are "read-only". My problem is that I can't avoid that these ...
4
votes
1answer
2k views

If statement in ModelBuilder to check if field exists

I'm trying to create the following in ModelBuilder: Set input feature class if field1 exists execute the processes in branch1 else add field1 execute the processes in branch2 ...
2
votes
1answer
198 views

Does ArcMap/ArcPy support creation of textElements using Python?

From what I can tell python at ArcGIS Desktop 10.0 cannot create new textElements nor GraphicElements. Yet, 10.1 seems to support the ability to at least create a clone, of a existing GraphicElements, ...
9
votes
1answer
728 views

Arcmap Select by Attribute with Python

I would like the following to select (highlight) the "project" layer that intersects the grid, and then pull a record from the selected "Grid". I do not need to save the layer. Note: Running the ...
5
votes
0answers
175 views

How to rotate polygon to find best fit in Mapnik? [closed]

I have a quite simple problem but somehow I just fail to solve it. There is a polygon and a range xsize and ysize. The x and y size determines the mapnik generated image. The polygon should now be ...
3
votes
1answer
685 views

Looping based on a spreasheet using python (in ArcGIS 9.3)

Here's what I am trying to do: I want to move feature classes from one .gdb (OLD) to another (NEW), but only the feature classes that are present in an excel spreadsheet. read from excel spreasheet ...
4
votes
1answer
298 views

Counting and Storing Event Data Contained Within a Polygon (Using Python)

I have a fairly large project and I would like to automate some tasks using Python. Problem is, I don’t have any experience with Python for ArcGIS. And I rarely use ArcGIS until something big like ...
5
votes
1answer
698 views

Raster processing with Python or Arc raster calculator

I have 4-band NAIP imagery that require the following processing steps: Convert to 8 bit unsigned B/W Reverse (note not inverse) the image, so that dark values appear light and light values appear ...
1
vote
2answers
531 views

Need help getting started with QgsComposition

I am using QgsComposition for the first time, but I fail at the first step :-( mapRenderer = iface.mapCanvas().mapRenderer() line 31, in mapRenderer = iface.mapCanvas().mapRenderer() ...
2
votes
1answer
392 views

How to create new layer within a DXF file?

Using OGR in Python, I'd like to create some geometries within a DXF file, but not in the "0" layer, but in new ones. I tried with: import ogr, os, osr, sys ds = ...
3
votes
1answer
383 views

Update Arcpy version?

This is probably the answer to my previous question. The version of arcpy that I am using does not include GetNAClassNames naClasses = arcpy.na.GetNAClassNames(serviceAreaLayer) ...
0
votes
0answers
162 views

Export Data Driven Pages extents to Kmz

Is it possible to export the extents of DDP to KMZ using arcpy - Map to KML (Conversion)? Alternatively can we export each extent of a single DDP extent to a new mxd and then run arcpy.MapToKML_3d on ...
1
vote
1answer
77 views

Is there a way to access ps.map in python?

i am wondering whether its possible using python interface to load layers and edit them in Print/Cartographic Composer without displaying, and finally export to PDF? something that can be done via ...
0
votes
1answer
336 views

How to convert the python plugins into dll file for QGIS application?

How to convert the python plugins into dll files for QGis application? Thanks in advance.