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

learn more… | top users | synonyms

1
vote
0answers
15 views

Can i use CreateMapSDDraft in the arcpy.mapping library to set the scale range on tiled services at 10.1?

I know that esri has exposed many properties to the acrpy lib for publishing services. I need to published a tiled/cached map service but i need to set the min/max scale when i do that. Can this be ...
0
votes
0answers
24 views

slope in model different value than slope in stand alone script [duplicate]

When running slope(analysis) from model I receive a high value of somewhere around 71. After then exporting model as python snippet and changing only the output raster name (using same input raster) I ...
0
votes
0answers
48 views

Programmatically add paramaters to ArcToolbox based on number of FCs in GDB?

I'm creating a custom geoprocessing tool. If a user inputs a GDB with a variable number of feature classes (FC), how can I retrieve and add a list of the FC to the tool? If the user doesn't add a ...
0
votes
1answer
34 views

Updating Arc Toolbox paramaters with validation script

I'm simply trying to disable parameter 1 if parameter 0 if entered. I modified the following, but it does not work, do I need to return anything? def updateParameters(self): """Modify the values ...
1
vote
1answer
52 views

Adding attribute list to combobox in a python plugin

I am developing a simple plugin at the moment which contains 3 combo boxes: comboBox_1 comboBox_2 comboBox_3 Combobox 1 & 2 lists the vector layers available, however I would like the 3rd ...
3
votes
1answer
47 views

How to use variables in arcpy tools which quote the variable name

I'm having a frustrating time trying to use the Create TIN tool within Python, when the input featureclass name is a variable. The help file entry for Create TIN shows a hard-coded path to the ...
1
vote
1answer
72 views

Python: Ray-trace a WGS84 point with heading and distance

One of my services defines geofences for a mobile app. The geofences consists of a lat/lon pair and radius in meters, in JSON, e.g.: { "geofenceId":"geofence_b39da38cff7be4b4693cbc31b2394bbb", ...
2
votes
1answer
54 views

How to Format Description when writing Help for Python script tool?

I try to format the description in script tool but I don't know how it works so i don't manage to add a line break for example. Does it works with HTML tags ? When editing my script the description ...
0
votes
0answers
30 views

PyQGIS loading layer style with PostGIS

I'm loading layer styles from .qml files in a Python plugin. I'm about to switch to loading them from a non-local postgreSQL db. I've been looking at the (from QgsVectorLayer (v2.2)) ...
2
votes
2answers
36 views

Why is arcpy.StackProfile_3d -> arcpy.SaveGraph_management creating empty graph?

In a python script I'm trying to save a graph to a .png file with graph output from arcpy.StackProfile_3d but the .png file shows an empty graph. The table created from arcpy.StackProfile_3d shows ...
1
vote
1answer
55 views

Python.dll could not be loaded with PyScripter

I'm trying to configure PyScripter with QGIS. I've installed it using OSGeo4W and I'm following instructions to setup a pyscripter.bat file by copying content of qgis.bat file. I have the following ...
2
votes
2answers
51 views

raster standard deviation stretch python script

I am looking for ways of applying a permanent standard deviation stretch to rasters via python script. Are there any arcpy raster stretch functions? I was looking for a reference but could not find ...
1
vote
0answers
33 views

QGIS Custom Form: “Other” category in combo box replaced by line edit

I am trying to create a custom form for QGIS with comboboxes containing an "other" category. I wonder how to provide a line edit to enter info replacing the "other" choice if chosen. Not sure if I can ...
3
votes
0answers
27 views

Why does the QgsVectorFileWriter have probelms creating vector files?

I am using QGis 2.0.1 and have tried to create a new GIS feature file (SQLite, Spatialite, and Shapefile) of a subset of the data. I am then saving a copy of the style of this layer and applying it to ...
0
votes
0answers
33 views

Data driven page error when adding world_file

my python script for data driven pages causes a runtime error when I set world_file=True, or geoTIFF_tags=True. Else it runs and shots the ddp - in this case a grid of my city. I'm searching the web ...
2
votes
1answer
65 views

How to convert Python (ArcPy) script into tool or toolbox script?

I've written a simple python script that allows me to quickly create a copy of a template Mxd, pointing to different shapefiles. The user specifies the new location, a name for the new mxd, then the ...
2
votes
2answers
65 views

Conditional field calculator expression

I need to calculate the PIPEID field to equal the G_KEY_COMP field if PIPEID is null or PIPEID and G_KEY_COMP do not match. I think the first condition of the PIPEID being null is covered by the ...
1
vote
1answer
60 views

Using 'construct points' on all lines in a shapefile (arcpy)

I need to use the editing tool 'Construct Points' on several shapefiles that each have ~1300 polylines. I need to do this to create points every 1km along each of the polylines, which represent the ...
0
votes
1answer
17 views

Arcgis9.3 Problem with search cursor and update cursor in two different table

I am making a python code for ArcGIS 9.3 : -I have one folder with a lot of shapefile polygon inside - Ech polygon shapefile have a field "Average" and one ID - I have a table with each field ...
0
votes
0answers
22 views

How to make turn feature class from line feature class?

I have a road network of one county in Norway . To this road network, I will make myself a turn feature class of all the road barrier in the road network. I have a feature class with all the road ...
0
votes
1answer
23 views

replace data source for all layers that point to shapefile

Hi I'm trying to do something quite simple but its not working. I want my python script to change all of the layers that point to the same datasource (a point shapefile) to another point shapefile. ...
1
vote
1answer
30 views

Extract information of a raster overlayed on another raster with a lower resolution directly in python

I have two aligned rasters with the same extent, one has a resolution of 5 meters and the other of 125 meters. I would like to place the 5 meter one over the 125 meter one and assign to these smaller ...
0
votes
1answer
32 views

Retrieve path of running plugin in QGIS

In my plugin's directory I've got some XML settings files that I'd like to parse at a particular point during execution of the plugin. Is there a way to get the absolute path where the plugin's .pyc ...
5
votes
2answers
88 views

Is there a way to refresh imported modules in a ArcGIS Python Toolbox?

When using a python toolbox (.pyt) in ArcMap, I'll typically follow a pattern where the .pyt file itself is simply a wrapper to collect input arguments and define the tools themselves. Supporting ...
2
votes
0answers
20 views

Compare line with next line in attribute table shapefile

I am making a python code for ArcGis 9.3. The aim is to compare the value of my field "ID_BV" at line l with value of field "ID_BV" at line l+ 1. And depending of the test answer i populate another ...
1
vote
1answer
66 views

Arcpy Script tool

I'm creating a script tool and using the SelectLayerBy Attribute function (below), arcpy.SelectLayerByAttribute_management("cities_lyr", "NEW_SELECTION", '"CRIME_INDX" <= 0.02') However, I keep ...
1
vote
0answers
26 views

model to connect points with line and set the digitize direction according to height

I'm trying to develop a tool that connects a point layer (manholes) with lines (waste water pipes) and sets the line direction according to an height attribute acording to gravity(from high to low). ...
1
vote
1answer
47 views

Python syntax error -can't figure out why? [closed]

This should be simple. I hope I don't get down votes! I just got the following code from an article about using Google Maps API and ArcGIS to calculate routes without network analysis and just can't ...
0
votes
0answers
44 views

How to read out the geoPDF data downloaded from USGS ned database?

I am new to GIS, so this might be a stupid question. Google foo din't get me anywhere, so here goes.. How do I read the geoPDF data that I download from the National elevation database from USGS? ...
0
votes
1answer
16 views

whereClause syntax for Cost Distance parameter

I am looking to create a sql expression regarding point feature class and selection based on 'Name' field to pass to arcpy.sa.CostDistance() param[0]. similat to: savepath = env.workspace = ...
1
vote
1answer
31 views

QGIS Map tools and Map canvas--QString errors

I'm trying to learn more about using QGIS Map Canvas widgets and creating custom map tools, so the information from the PyQGIS cookbook is very helpful. After trying to experiment with mywnd.py from ...
0
votes
0answers
16 views

How to select Qgis features through Python Plugin

Hi I am very new to Python so this may be a bit basic. 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 ...
2
votes
0answers
62 views

Python problem visualization .tif image

I am trying to read a hyperspectral image in Uint16 .tif format and visualize it. I use GDAL in Python to read the data and everything works perfectly when I use matplotlib to show one band of the ...
0
votes
2answers
38 views

Output of RasterToPolygon not supported as shapefile

I made a python code for arcGis 9.3 which do the following step : 1) Convert all the raster (.tif) in a folder to polygon shapefile in another folder 2) Intersect all the converted ...
1
vote
1answer
58 views

empty file geodatabase error (nowhere feature class)using arcpy [closed]

i want to import a python(2.7) script to arcmap 10.1 my script has 2 inputs variables one for workspace and another raster dataset and i want o convert input raster as feature class polygon . i want ...
0
votes
1answer
25 views

gdalwarp from within python script misbehaving

I'm trying to run gdalwarp from within a python script start = "gdalwarp -overwrite -ts 22 20 -r average -srcnodata 99 " input_file = filename[12:] output_file = "temp1.tif" print ...
2
votes
2answers
44 views

How to save python ogr2ogr shapefile to memory, and stream to web client as zip

I'm trying to accomplish something similar to the site http://ogre.adc4gis.com/ I want to be able to manipulate a geojson file, and send it to the client as a shapefile, in a single zip file. I'm ...
-1
votes
0answers
34 views

Removing the same character from the middle of a string in Field Calculator [migrated]

This is the String I have in one column; CO060020N0650W0. I need it to say 2N65W. The second character is '5', sometimes it's '7'. I want to remove just that character from field calculator. How ...
3
votes
2answers
42 views

Add row and column name to square grid feature in ArcGIS

I have a square grid feature class of 250 x 250 tiles. This will serve as a tile index for a a project. They currently have no identifying attributes other than a unique ID. I need to add a field ...
0
votes
1answer
25 views

How do I use ogr2ogr with python GDAL? [duplicate]

I've just installed GDAL, but I don't know how to import/use ogr2ogr. I've tried: from osgeo import gdal from osgeo import ogr and searched both for ogr2ogr, but it wasn't there.
0
votes
1answer
32 views

Problem with SetValue method in ArcGIS 9.3

I am trying to make a python script for ArcGIS 9.3. I have a problem with the SetValue method. I try to use it in a very simple code but it still doesn't work : No error is return but my field is not ...
0
votes
1answer
44 views

Weighted Overlay - passing parameter as text error?

For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such... arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route ...
0
votes
1answer
25 views

Changing band for greyscale in plugin

I am trying to make a qgis plugin to change which band in a multiband data set (netCDF where the band represents time steps) is used for a grey scale rendering. The file works fine with manual ...
-1
votes
1answer
42 views

define error for python script to import arcmap [closed]

i want to create a simple python script for create one file geodatabase but show me define error # Import arcpy module Import arcpy import sys import os from arcpy import env from arcpy.sa ...
1
vote
2answers
107 views

Why my python script of r.watershed has no output?

I type those code in pyscripter, import os import sys #set up GRASS environment variables sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python')) import grass.script as g import ...
0
votes
1answer
72 views

How to generate jVectorMap for United Kingdom (UK)?

I have shapefile for UK , i need to convert this to the jVectorMap Here is my script python ^ converter.py ^ ./shapefile/map.shp ^ ./output/jquery-uk.js ^ --width 400 ^ --where "ISO = ...
2
votes
1answer
47 views

Conditional SQL Query

I've been running a code that searches a desired field in a feature class and performs an specified SQL query based on whether the field is string or double. The variables are just temporary fillers ...
1
vote
2answers
123 views

Create an X,Y latitude and longitude grid from an raster

I have a satellite image (LandSat 5), I want create a raster with X,Y coordinates, this is possible in Model Builder of ArcGis 10.0? or other option. I know that the option $$YMAP ($$XMAP) not work ...
0
votes
0answers
23 views

No data appears when using gdal_calc.py but source had data values

I'm in the process of calculating topographic exposure using a mix of GDAL, grass, R and python in Windows. I need to process a very large tiff file using the following calculation: ...
0
votes
0answers
22 views

TileStache : Unknown geometry type in geoJSON file

I'm currently trying to set up a TilSstache server on Ubuntu 12.04 to serve some GeoJSON tiles from a shapefile/JSON file (administratives boundaries) for a web mapping project using the Leaflet ...