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

learn more… | top users | synonyms

2
votes
3answers
769 views

Python code : Help with using Search Cursor and Messaging the Total Count of Items from Field in Layer that was Searched

My program works but it is not displaying a message of the total sheet count found in attribute table that the search cursor searched through. For Example: It goes through the mxd chosen by user finds ...
2
votes
0answers
142 views

Python script to create a point on a line with attribute data

I have a line feature class with 2 lines (Engineering and Continuous Station series) co-incident on each other. I have created a toolbar(ArcGIS Desktop add-in 10.1) with 3 tools on it, add control ...
2
votes
0answers
330 views

Multiple ring buffer on point-shape error

I need to calculate multiple ring-buffers, but every time I try, arcgis produces a failure: Executing (Multiple Ring Buffer): MultipleRingBuffer Y:\GIS\RDY\clip\sn_clip.shp ...
2
votes
0answers
267 views

Running a new iteration for each column of a dataset in ArcGIS

I'm pretty new to Modelbuilding, having just been turned onto it about a week ago on here. So my problem is, I currently have a dataset of habitats that change through time (from Immature to Mature, ...
2
votes
0answers
68 views

Arcpy: Counting number of segments where altitude rises or decreases based on DEM?

I have a DEM of Sudety mountains and linear .shp with several hiking paths. I'm trying solve one problem: How to make a script based on input DEM and input line shapes that would count number of ...
2
votes
0answers
186 views

problem in read_shp() to generate a networkx.DiGraph from point and line shapefiles

I tried to use the Python module networkx and specifically the read-shp () to ensure the transformation of a graph to a file sharpe but I always find this error noting that this is the first time I ...
2
votes
2answers
806 views

OSR Python testSR.ImportFromEPSG(4326) returns empty spatial reference

This is empty using Python .ImportFromEPSG(4326): import osr #this fails: testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) print testSR.ExportToPrettyWkt() #why did the import from EPSG ...
2
votes
0answers
174 views

projection discrepancy with gdal (1.9) and proj4

I boiled the problem down to that python example: import sys try: from osgeo import gdal from osgeo import osr except: import gdal import osr if __name__ == '__main__': version_num = ...
2
votes
1answer
600 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
2
votes
1answer
265 views

gdal.py as part of bat script in windows 7

I need to run the following bat file from a MS4W shell which has gdal_retile.py as the final option. I have added C:\ms4w\python\gdal to my pythonpath but within a pyscripter shell I can not import ...
2
votes
0answers
172 views

Localized Linear Histogram Match using python

I would like to use the local linear histogram match for filling the missing pixels of a Landsat 7 image with another older image (SLC Gap-Filled Products). Do you have any idea how can I do it by ...
2
votes
0answers
73 views

Removing FID as an option from ArcGIS Tool Validation Parameters

I am currently building a script tool which requires the user to select a sorting field from a list (built using a dependency on the featureclass). This Element is working fine, but I would like to ...
2
votes
0answers
56 views

Is there a way to distinguish between digitized and pasted features?

Is there a way to tell if an added feature in QGIS is in fact a newly digitized one or a pasted feature? I think QGIS is treating both cases in the same way, emitting the same signal: ...
2
votes
0answers
33 views

How can I set python path and version for QGIS? [duplicate]

Possible Duplicate: Couldn’t load SIP Module When I'm starting QGIS I'm getting the problem: "Couldn't load SIP module. Python support will be disabled." And there is also: Python version: ...
2
votes
0answers
105 views

Convert geojson labels MBR to MapInfo text object

Im using Dymo (https://github.com/migurski/Dymo/) to generate automatic point labels placement. The output of Dymo is a geojson containing MBRs of the positioned labels with the names of the labels in ...
2
votes
0answers
4k views

Create a stacked bar chart with matplotlib [closed]

I'm trying to create a stacked bar chart in python with matplotlib and I can draw my bar one up the other # -*- coding: utf-8 -*- import psycopg2 import matplotlib.pyplot as plt import numpy as np # ...
2
votes
0answers
353 views

How to access mysql data from python built-in console?

I'm writing a QGIS Plugin, and somewhere I want to present data from a MySQL database. It's simple data(strings,etc), not Geospatial, or vector data. I'm familiar with querying databases from python ...
2
votes
0answers
62 views

How to call a method when self.iface.actionSelectRectangle().trigger() is released?

In my QGIS python plugin I use "self.iface.actionSelectRectangle().trigger()" to select features. I also have a button which changes the attributes of the selected features. Is there a way instead ...
2
votes
0answers
169 views

qgis and embedded ajax (bing map)

I need to load in a docked QWebView this html: < html > < body > < iframe width="100%" height="499" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" ...
2
votes
0answers
133 views

How can I draw an ellipse filling the dataframe with ArcPy?

I need to modify one of my template scripts to draw a circle from the centre of the (inset) data frame to the edge of the data frame. This will then be used to clip the data frame to shape. I'm using ...
2
votes
0answers
59 views

How do I make a path cross the most possible classes in a raster?

I want to create a function and possibly use Arcmap tools to create something similar to Cost Path. Instead of just choosing the LCP, it must cross through the most different integers. Let's say I ...
2
votes
0answers
146 views

Why would an ArcGIS 10 Python custom tool fail without throwing a “failed to execute” or “completed script” message at the end?

I have written a custom tool in Python for ArcGIS that converts in batch SHP files to GML files. It processes one file at a time in a folder, file, or ZIP file and then moves on to the next. If the ...
2
votes
0answers
452 views

Add CAD Drawing Dataset into ArcMap using Python

I am trying to add an CAD Drawing Dataset into ArcMap using Python. Question is how to add a Auto-CAD .dwg file to ArcMap using Python Normally comes in as CAD file within a Group layer with: ...
2
votes
0answers
817 views

How to load data programmatically from shapefile into feature class (geodatabase)? [closed]

Can some Genuis here help me programmatically (using python and comtypes) load shapefile data in to an existing geodatabase (feature class). The attributes of the shapefile has to match with the ...
2
votes
1answer
479 views

How to display local file's geometries as rubber bands in QGIS

I'd like to get geometries from a local file (e.g. GML) displayed as rubber bands (QgsRubberBands) in QGIS. However, I wouldn't like to load the layer into the map because in the real scenario there ...
2
votes
0answers
123 views

OpenLayers Issue: plugin crash during opening [closed]

I've encountered problems while loading the OpenLayers plugin in Quantum GIS 1.7.4. My hardware: Windows 7 Home basic 64 Bits My Python crash window: Traceback (most recent call last): File ...
2
votes
0answers
172 views

How to Auto Increment Attribute Based on Nearest Point? [closed]

An authority I am working with would like their Hydrants, a point shapefile, to be renumbered based on their location. I am looking for any python script that would help me A. Find the next closest ...
2
votes
0answers
146 views

Setting border-style to 'no pen' using QgsGraduatedSymbolRendererV2

I am developing a QGIS plugin that, after a series of inputs, will produce a thematic map using the QgsGraduatedSymbolRendererV2. Because the polygon are very small, the boarders make it such that ...
2
votes
0answers
157 views

Are there Plugin Compatibility Issues between QGIS 1.6.0 and 1.7.4?

I've been working on a QGIS plugin on Quantum GIS 1.6.0 Copiapo with Python 2.5 that calculates additional values for eachf feature of a vector layer and adds them to the .dbf. We've just upgraded to ...
2
votes
0answers
226 views

Recalculate Quantile Breakpoints in CalculateField_management loop?

I have a program that iteratively replaces a temp field where I choose a certain symbology (color ramp and quantile color break methodology) with a few other fields from a join. The program works in ...
2
votes
1answer
540 views

Attribute Table Decimal Places

As we all know, the attribute table field properties has number format to display number of decimal places to up to maximum 15. If we have many fields/columns in attribute table, how can we change all ...
2
votes
0answers
58 views

Tiled image transforming to new profile

i have a set of tile which was tiled profile of mercator and proper to tms scheme mechanism. unfortunately i dont have any tif or georeference table or anything for this. all was tiled with mercator ...
2
votes
0answers
161 views

Is there any way to suppress the calculate field dialog box in arcpy script?

I've got a python script that I inherited. The python script takes input from a variety of feature classes and tables and spit it out to a single table. When I run this script via a scheduling ...
2
votes
0answers
136 views

How to change the QGIS help dialog?

I am working with python plugins for QGIS. I am done with my one of my .py file using python 2.5 and pyqt4. It is just help file for QGIS, which i changed. I wanted to incorporate the same in QGIS. I ...
2
votes
0answers
250 views

RT Sql Layer plugin giving an error [closed]

I am trying to use the aforementioned plugin with QGIS 1.7 and Postgres 9.0/PostGIS 1.5. Added a PostGIS spatial layer w/out a problem and then clicked on the RT Sql layer button which displayed the ...
2
votes
0answers
610 views

Perfectly running python script gives error when run from web.py

I have the following python script which runs perfectly if run separately: import arcpy val = arcpy.GetCellValue_management("D:\dem-merged\lidar_wsg84", "-95.090174910630012 29.973962146120652", ...
2
votes
1answer
1k views

How do I insert a DATAFRAME_ELEMENT value into a dynamically generated shape file containing its extent?

This is for ArcGIS 10, Python 2.65. I have code which captures the extent of dataframes within all mxd's in a directory. I also want it to add the dataframe name, scale and the name of the mxd it ...
2
votes
0answers
591 views

Spatial Analyst Cell Statistics seems to give the wrong answer in ArcGIS 10.0

I have a script that calculates standard deviation for a list of grids using the Cell Statistics function in Spatial Analyst for ArcGIS 10.0 The syntax is this: stdevGrid = ...
2
votes
1answer
98 views

Is it possible to destroy a spatial index?

QGIS 1.9 Is it possible to destroy a spatial index? I am noticing that if I generate a spatial index on a set of polylines (within a plugin), split one of the lines, and then recreate the spatial ...
2
votes
2answers
301 views

Can anyone tell me why my field calculator is returning this error?

All I am trying to do is pull into a text field, a section of another text field via: fieldB = !fieldA![some_index:other_index] However I keep receiving the error below and I can't figure out why. ...
1
vote
3answers
5k views

os.sep in python scripting

what is os.sep and when should i use os.sep while scripting for arcgis ? for example in below code i don't understand why should i use os.sep . import arcpy from arcpy import env import os # Set ...
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?
1
vote
2answers
2k views

GetParameterAsText() error in python script

i have a huge problem with an error . when i use getparameterastext and use it for searchcursor , i encounter to an error .for example the below code import arcpy featureClass = ...
1
vote
3answers
821 views

Is it possible to open rasters as array in NumPy without using another library?

I know that it is possible to open a raster as an array in NumPy using GDAL, but I want to skip GDAL and use NumPy only, as it is cooler handling rasters with NumPy as matrices. There is a similar ...
1
vote
2answers
959 views

Merging many rasters using Python

I have a list of many many rasters. I want to have a simple and easy to understand script that takes this and merges it into one big mosaic. I found a similar question but the accepted answer adivises ...
1
vote
2answers
142 views

UpdateCursor only takes last value of SearchCursor

I have this piece of code: #written on python 2.7 for ArcGIS Desktop 10.2.2 import arcpy #set to folder where features are located arcpy.env.workspace = "c:\\Users\\python_ex" #on windows use \\ ...
1
vote
3answers
582 views

How to install Fiona to read Shapefile attributes with OSGeo4W?

I´m developing a plugin in Python and I need to read the shapefile attributes, so I found the Fiona API and dbfpy also but I don't understand how to install these packages because I install the QGIS ...
1
vote
3answers
163 views

How to limit input of Python script parameter to polyline only when using Layer file?

When the parameter is feature class I can filter the input to polyline only. How to do this when the input is layer file at CURRENT MXD? I'm looking for something that will operate before the script ...
1
vote
1answer
459 views

ARCGIS Python script (needs a raw input line to let the user choose the output file name)

I just need a quick fix here. Having trouble finding a way to allow the user to input the new output file name (the one that is created after the buffer function completes). Any ideas? I am also not ...
1
vote
3answers
471 views

More Efficient Spatial join in Python without QGIS, ArcGIS, PostGIS, etc

I'm attempting to do a spatial join much like the example here: Is there a python option to "join attributes by location"?. However, that approach seems really inefficient / slow. Even ...