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

learn more… | top users | synonyms

5
votes
2answers
596 views

Python: how to speed up spatial search (nearest point)?

I'm working on a program that determines the closest location from a given point. The point cloud I'm testing against is very big (~800.000). However, this doesn't really explain why my implementation ...
3
votes
2answers
456 views

Can we create a temporary in-memory geodatabase using python?

I have been using in-memory workspace for creating temporary features, but I was wondering if we could create a temporary in-memory geodatabase (using python) and then use it for importing other ...
1
vote
0answers
62 views

Should I move from ArcGIS modelbuilder to python? [closed]

I have been learning how to use ModelBuilder with ArcGIS 10.2, and I like that it shows me visually how to process data using ArcGIS's functions. I think visually. I see, however, many replies by ...
2
votes
1answer
321 views

ArcGIS 10.0 get sde information out of .mxd

The overall goal here is to iterate through several directories of .mxd files and document which SQL Server instance of SDE they are pointing to, with the database name and feature class names. All ...
0
votes
1answer
183 views

Better way to handle HDF and GeoTIFF files

I am using GDAL and MODIS reprojection tool in my python project and want to know better way for math new indices of HDF data (MODIS data). Also I want to visualize them in web. Which format is more ...
0
votes
1answer
123 views

ERROR: “Can't save to disk (check for space, write permission, or name)” while creating TIN in memory

I get the following error while creating TIN in memory : ERROR 999999: Error executing function. Can't save to disk (check for space, write permission, or name). Failed to execute (CreateTin). I ...
1
vote
1answer
522 views

How to create a feature class in memory?

I am trying to create a feature class in memory but I am not sure how to use the syntax. My code looks like this: FC = arcpy.CreateFeatureclass_management("", "in_memory/FC", "POLYGON", "", ...
1
vote
1answer
69 views

Model converted to Script - No editing mode? [closed]

I have a model that an ESRI associate sent me as an example. When I run the model everything is great. I click on the model and because the seleting features is a parameter, it automatically starts ...
4
votes
1answer
129 views

How to populate SQL options for ModelBuilder parameter from ArcSDE feature class?

I am creating a very basic model tool for a class project and I am running into trouble getting the SQL values to populate. I have read the ArcGIS 10: How to populate SQL options for parameter in tool ...
7
votes
2answers
922 views

Split a feature when intersecting with a feature of another layer using PyQGIS/Python?

I have a buffer layer (green polygon) which I want to split to two polygons whenever it crosses a barrier (blue line). I have been trying to use "splitGeometry" method, but I just can't get it to ...
2
votes
0answers
213 views

Buffering a Raster with GDAL and Numpy

I am using GDAL to convert a raster dataset into a numpy.array and then using numpy to buffer the data in the raster. For example, I need to know all the regions within 100ft of a school point ...
0
votes
1answer
494 views

How to obtain an extent of a whole shapefile?

I have got two shapefiles. One of them is a point shapefile and the second one is a polygon shapefile. I need to find out which of them has a larger extent and then set the environment extent to ...
0
votes
0answers
75 views

QGIS2.0 plugin with freeglut

Has anyone been successful in using QGIS 2.0 plugin which uses freeglut? I have tried all of the below to import freeglut but none of the freeglut functions are recogonized in my plugin. import ...
0
votes
0answers
61 views

Using arcpy.GetRasterProperties_management gives strange results

I have a loop which goes through folders and do some raster operations. Inside this loop I checked for a raster properties using arcpy.GetRasterProperties_management with NODATA parameter. And then ...
1
vote
1answer
174 views

Select a single entry using SearchCursor and create variable

I am trying to select a single entry of a floating point entry in a dbf table that contains 9 entries (sampled from a raster image), some of which is NULL using SearchCursor. I want to select one of ...
1
vote
4answers
416 views

Offline Python or C++ library for plotting locations on map?

I'd like to plot locations using longitude and latitude coordinates using Python or C++, is there a good library for such a task? I know that matplotlib is an option, I'm wondering if there are any ...
2
votes
0answers
89 views

Python scaling issues and possible subprocess conflicts?

I have always found such great analytical and programming expertise on StackExchange in the past that I hope you can help me. Background: I have a project that involves spatially joining and ...
1
vote
1answer
72 views

Field does not get updated with Geoprocessing Service

Can anybody tell why the field gets updated when I run this script in ArcMap but not when I run a geoprocessing service? Thanks #Import modules import os, sys, arcpy, traceback, arcgisscripting gp ...
1
vote
1answer
97 views

How to correctly use LIKE in the code block of a Reclass expression in ModelBuilder Calculate Field

I have a Reclass expression that works when i am search for single instance of a data field. I also wish the Reclass to work with a SQL type LIKE selection with Wildcards. e.g. I need to reclassify ...
0
votes
1answer
201 views

“shutil.rmtree” doesn't get rid of my intermediate folders

I have a script that works fine, but now I'd like to remove all the intermediate folders I created therein in order to save memory and to be clean. I've been trying using the "shutil.rmtree ()" ...
3
votes
1answer
209 views

How to programmatically detect a canvas refresh or pan/zoom in QGIS

For my python plugin I would like to remove a VertexMarker when the user pans/zooms there map. Which is the best way to detect a canvas refresh or pan/zoom carried out by the user? Can you suggest ...
5
votes
0answers
51 views

Altering the order of attributes in a table [duplicate]

I have gone through a sequence of table joins. The resultant table should be with the attributes rearranged in more logical order. I cannot find this functionality within Arc GIS or any mention of it ...
2
votes
2answers
51 views

Is there a way to replace just a specific character in a variable? [closed]

Here is an example township = township[3].replace("0", "") My goal being that if 10.0 is the current value for township I want to remove the zero after the . but not the one after the 1 with the ...
3
votes
1answer
316 views

How to render area that crosses 180°?

The problem is that the Chukotka Peninsula is located in the Western Hemisphere. So it is on the left side of Natural Earth Datasets. It needs to be moved to the right. I tried to use following ...
2
votes
2answers
63 views

Setting ProductCode for python script (Citrix environment)

I have set up a python script in ArcToolbox for our users. However when running it with ArcView 10.0 licensing the script fails with: ERROR 000824: The tool is not licensed I think it's an ...
2
votes
1answer
798 views

How to install QGIS 2.0 on Mint 15?

Trying to use QGIS 2.0 on Mint 15 (based on Ubuntu 13) I installed, uninstalled and re-installed QGIS from various repositories (ubuntugis-unstable, then qgis.org/debian raring - not clear for me ...
2
votes
0answers
36 views

ArcPy: Distortion towards edges when exporting to TIFF [duplicate]

I am writing a function to zoom to selection (based on a criteria) and Exporting it to TIFF. The problem I am getting is that the when I load the exported TIFF image in Map, I am seeing distortion ...
1
vote
1answer
630 views

GDAL loads in Python, but not IPython (Linux)

I am trying my hardest to utilize the work of the good folks at the GeoDa center, but I cannot seem to get all of the components to load. GDAL, in particular, has been giving me some difficulty. The ...
2
votes
2answers
159 views

How do I produce map images for Wikipedia?

I would like to make several map images (e.g. SVG or PNG) like those on wikipedia but in not popular projection. I am interested in scripting solution. Here I found this note: Generation Notes perl ...
1
vote
2answers
7k views

Export list of values into csv or txt file

I would like to know how to export in Arcgis a list of values calculated in python script into one of the following data formats: csv, txt, xls, dbase or other. I would also like to know how to create ...
1
vote
0answers
161 views

How to change the color of a selected feature with pyQGIS?

is it possible to change the color of a selected feature in qgis 1.8? To highlight a feature I use: vlayer.setSelectedFeatures(selectedList) box = vlayer.boundingBoxOfSelected() ...
1
vote
0answers
84 views

How to join attributes by location with command line

I would like to joint the attributes of 2 shapefiles by location but with a command line (linux). This feature is easy in QGIS but it is VERY slow. Is there a way of doing this with ogr or pyqgis ? ...
0
votes
0answers
23 views

Using sedac/GPW PopStats Service

I need to estimate population density based on a geographical area. I thought about using the Gridded Population of the World (GPW) service available here. Because I never used a RESTful WS before, ...
1
vote
0answers
178 views

merge_management

Here is the edited code: import arcpy import os from arcpy import env set the environment settings env.workspace = "C:\RG\Kings County\Test.gdb" fcs = arcpy.ListFeatureClasses("Sub_NVF_*") ...
7
votes
2answers
175 views

How to access current job id from geoprocessing script running on esri server?

I want to programmatically access the current job id of a geoprocessing script running on ESRI 10.2. The script is what needs to know the job id, not the caller of the script. While searching, I ...
0
votes
1answer
167 views

Problem with converting rasters to arrays and adding them to main array, then converting to raster via NumPyArrayToRaster : output is NoData values

I have a process that aims to loop through a list of rasters (testing with only 3) covert each raster to an array, add the array to an existing 'template' array, then save the final array back to a ...
3
votes
1answer
772 views

Getting the name of the mxd using python

I have a python script which reads through all the mxd's in a folder and changes their properties from relative file paths to absolute file paths. I now want to add a bit to the script to change the ...
2
votes
2answers
231 views

Does shapely within function identify inner holes?

I have a series of shapefiles that include both polygons and multipolygons. I am using ogr to extract them in wkb, and them I am using shapely to check if a point fall inside a polygon (or a ...
5
votes
1answer
279 views

ArcGIS - Python - Extend XY Line to Z Value

Long time reader, first time poster. So here's my goal: Working in ArcGIS, trying to work with Model Builder and Python Scripts. I have a series of lines and a single raster DEM. I'd like to extend ...
1
vote
1answer
241 views

Python Field Calc for Document Hyperlink

I am trying to create a script that will hyperlink to a .tiff or .pdf. These files are stored in one folder on a shared server. I want the script to look in a field: 'PLAT_IMAGE', which has the plat ...
7
votes
1answer
207 views

Draw middle ordinate perpendicular to chord, out to curve, with arcpy

I've been assigned to find the radius of road curves. My boss found this article describing a pretty straightforward method of doing so: find the start/end points of the curve; create a chord; ...
1
vote
1answer
238 views

remove whitespace Python code results in odd character - Field Calculator

I need to remove whitespace from the end of a string in a field in ArcMap. I tried first the VBA function RTrim, but whitespace still remained. I thought maybe the whitespaces were tabs, so I tried ...
5
votes
1answer
208 views

What is the difference between 'Make Feature Layer (Data Management)' and using 'in_memory workspace'?

I was wondering What is the difference between 'Make Feature Layer (Data Management)' and using 'in_memory workspace'? to me, one can use either to do some steps in memory instead of writing data to a ...
10
votes
6answers
612 views

How do I iterate through every cell in a continuous raster?

See this link for more details. The Problem: I want to loop through a continuous raster (one that has no attribute table), cell by cell, and get the value of the cell. I want to take those values ...
0
votes
2answers
539 views

How to extract subdataset from HDF raster?

I am trying to extract a subdataset from HDF raster. Later on, I intend to make operations such as mosaicking and extracting raster averages from the extracted subdataset. The following code is ...
1
vote
0answers
209 views

Pyshp 1.2 example from documentation fails

I must be doing something really stupid because I am trying to run an example straight from the PyShp (shapefile.py) 1.2 documentation with the only change being the input shapefile and it is failing. ...
4
votes
2answers
151 views

Can Hyperlink be based on two fields for path and file name separately?

I need to create a hyperlink field. I have one field with the file name, and another field that contains only part of the file path (the real path is unknown). The table contains 14,000 records with ...
3
votes
2answers
147 views

How can I generalize “field name” variable?

Here is my code: import arcpy import math arcpy.env.workspace = "C:\RG\Kings County\Test.gdb" fcs = arcpy.ListFeatureClasses("NVF_*") try: for fc in fcs: rows = arcpy.UpdateCursor(fc) ...
1
vote
0answers
140 views

Modifying Raster Layer with Python Console

Forgive me if this has been asked somewhere else. I am looking for a way to edit a raster file which has already been loaded into QGIS through the python console (i.e. I would like to edit the raster ...
1
vote
1answer
1k views

QGIS 2 Installation on MAC OSX - couldn't load plugin 'processing' [duplicate]

New installation of QGIS running on Macbook Pro OSX 10.8.4 - this comes up on startup. I urgently need this fixed!!! I have a project due in 10 days that I desperately need QGIS for. Thanks for the ...