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

learn more… | top users | synonyms

0
votes
1answer
217 views

Save longitude and latitude in Django

I had plotted a Javascript gMap.Using the marker,the values of latitude and longitude are displayed.I need to get that values and save it to database.What is the best way to do this and ,How to ...
0
votes
1answer
91 views

Make many lines in one layer (Python)

I what to create many lines with this code: v_layer = QgsVectorLayer("LineString", "cable", "memory") pr = v_layer.dataProvider() seg = QgsFeature() ...
0
votes
2answers
85 views

Python to get ids from shp dont return all records

I have some Python code to get the ids and georeference from a shapefile: canvas = qgis.utils.iface.mapCanvas() allLayers = canvas.layers() nos = QgsFeature() for i in allLayers: if ...
0
votes
1answer
102 views

How to convert geometry of SHP to decimals

I try to create a line with two points. These points are obtained in a SHP layer. How can i convert that points to decimals? Thank you
0
votes
1answer
184 views

QGIS Python - Convert geometry from Postgres to QgsPoint()

I have made a query in Postgres to get some points to use with python. This points are in geometry data. How can I convert that geometry in decimals to use QgsPoint() in python? Thank you
0
votes
1answer
776 views

How to insert values from one table into another?

I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I ...
0
votes
1answer
210 views

arcpy.setValue for Condition from Dictionary

Hi: I am trying to create a function to update multiple fields based on different criteria. I want to pass the field name and condition thru' a dictionary (please see the function description in the ...
0
votes
1answer
617 views

Make Route with Python and network analyst in ArcGIS 10

Good Day, I'm having trouble debugging my python code to create a network analyst layer in ArcGIS 10.0. Basically when run from a script tool the code completes successfully without actually doing ...
0
votes
1answer
369 views

Check if layer is a QGSVectorLayer from Python Plugin within QGIS

I am trying to extend some concepts in the QGIS Workshop tutorial. Basically, I would like to check if the layer is of type "QGSVectorLayer". In the QGIS Python console, I am able to type canvas = ...
0
votes
1answer
360 views

AttributeError: HelloWorld instance has no attribute 'connect'

Here's the code: import sys,os import win32api from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * import ctypes from PyQt4 import uic class HelloWorld: def ...
0
votes
1answer
80 views

How to buffer increasing/decreasing population zones?

I will find out the difference in population between year 2000 and 2013. I have a feature class file with the population in year 2000 and 2013 that are connected to the municipal number and that is a ...
0
votes
1answer
418 views

psexec remote file execution with ArcGIS Server

This is perhaps going a bit out of bounds, so i'm not confident I'll get an answer. The short of this is that I've created a python script which leverages psexec to start a bat file on a remote ...
0
votes
2answers
228 views

How to make line with arrow head in QgsVectorLayer using python?

I need to draw line with arrow head or after drawn the line i need to make it as arrow head line by using python. or can we set any arrow head symbol for line features by using python? Kindly help me ...
0
votes
1answer
691 views

How can I avoid UnicodeEncodeError when using geoprocessing tools in QGIS?

I have a shapefile, that I want to split with the "Split Layers by Field"-tool. Due to some umlauts (ä,ü,ö) there will be a python error as soon, as the tool reaches a feature with an umlaut. The ...
0
votes
1answer
412 views

python script in modelbuilder: get field value and return boolean expressions

I have problems integrating a python script in a modelbuilder tool. I'm a absolute beginner with python. Maybe there's also an easier way to solve this problem in modelbuilder without using a python ...
0
votes
1answer
138 views

How to find locations for hydro power using raster analysis?

I have a stream network and DEM file both in raster format. I need to extract values from DEM to stream network. For the analysis in stream network after that, I need to find out the places for hydro ...
0
votes
1answer
232 views

Is it possible to use GDAL to combine (rather than mosaic) rasters

Is there a GDAL command which can combine multiple rasters so that a unique output value is assigned to each unique combination of input values, like the combine command in ArcGIS? gdal_merge seems ...
0
votes
1answer
349 views

openlayers python proxy.cgi script is not taking parameters

I have setup the python proxy.cgi in cgi-bin folder in my server. [myserver]/cgi-bin/proxy.cgi returns the openlayers website [myserver]/cgi-bin/proxy.cgi?url=www.openlayers.org returns list index ...
0
votes
1answer
141 views

Join multiple shapes in a workspace based on a common field

I’m completely stucked!!! I’m working with meteorological data (wind) but I have to arrange the data for a program to be able to process it. I have text files, two per day (one with the wind direction ...
0
votes
1answer
94 views

Error on rendering linestring

I am using Mapnik 2.0.1rc0 on a Windows 7 with python 2.7 32bits inside a GeoDjango App using xml. The datasource come from spatialite 4.0. My tiling script can render polygon and point features ...
0
votes
1answer
618 views

Where Clause problems when all parts are user input variables

I have written some generic user ipnut code for a toolbox script (ArcGIS 10.0) but because everything is a variable I don't know how to write the SQL whereclause. Please can someone help and suggest ...
0
votes
1answer
450 views

qgis plugin: “WindowsError: [Error 6] The handle is invalid”

OS: Windows 7 64bit GIS: QGIS 1.8 (qgis.org/downloads/QGIS-OSGeo4W-1.8.0-2-Setup.exe) path variable: GISBASE=C:\Program Files (x86)\Quantum GIS Lisboa\apps\grass\grass-6.4.3RC2 ...
0
votes
1answer
95 views

What could I do to make QGIS find all the plugins?

I'm starting to use Ubuntu 12.10 and would like to get my QGIS running on it. Installation was fine but when I tried to add a package called Points to Paths the Plugin Manager was unabled to find it. ...
0
votes
1answer
318 views

how to make a join with sql server table

I have a question. I'd like to join .shp to table by using AddJoin_management. But I'd like to make join to sqlserver table (not to *.dbf). Is it possible to do? it should look something like this: ...
0
votes
3answers
928 views

Summarize values per row using field calculator via Model Builder

I think my problem is easy to solve, but so far I couldn't find a solution. I have a Feature Dataset created with the Union tool in Model Builder and now try to sum up all values of one specific field ...
0
votes
1answer
624 views

Points in Polygon Count: Error with arcpy.selectLayerByLocation_management

I'm working on generating some multivariate hexbins and am running into a problem with the initial step of counting the number of points (for the first variable) that are within each hex polygon. Here ...
0
votes
1answer
62 views

Error while publishing a mxd as service uing python

I have created an Excel file with Lat/lon values. I added this data tas a layer in the ArcMap. And I "used Display XY data" otion available on right click. I selected the GCS_WCS_1984 co-ordinate ...
0
votes
1answer
68 views

How to use a property of a different interface for a created ArcObject

I have created an arc based three points (from point, through point, and to point). To create the arc I used this code: import arcpy, comtypes.client import comtypes.client.CreateObject as ...
0
votes
1answer
182 views

ArcGIS 10.0 Running Python function CADToGeodatabase() crashes ArcMap/ArcCatalog

My code: import arcpy, csv from arcpy import env dgnfile = str(arcpy.GetParameterAsText(0)) outFeatureClass = str(arcpy.GetParameterAsText(1)) #the fc in my fgdb template to be ...
0
votes
1answer
734 views

Invalid topology error when running script

I am trying to run a python script and I get an invalid topology rule when I get to the feature to line tool. I am using arc 10.1 but I think the script was written in 10.0. I know it was built in ...
0
votes
1answer
496 views

Invalid data source issue when trying to use lyr.replaceDataSource

When I run the following code in an open mapdocument, it executes and does what I want it to, replace the datasource of the Indianacounty_shp layer with the County_Boundary feature class. import ...
0
votes
1answer
1k views

Runtime error <type 'exceptions.TypeError'>: 'unicode' object is not callable

I'm working on a script to replace a layer datasource, and I'm getting an error I cannot figure out. When I run the following code in a python window inside ArcMap, I get a "Runtime error : 'unicode' ...
0
votes
1answer
166 views

How to code Data Driven Process using ArcPy?

I need to come up with a Python code to automate a map creation process but I am a little bit of lack of python knowledge. Any help would be much appreciated. My problem is that I have a 20 mxd file ...
0
votes
3answers
451 views

Run function if item in QComboBox is selected

I got another issue writing a plugin to convert three shape files into an .obs input file. I created a UI (Qt) with a QComboBox to select a layer (that works fine). As soon as one of the layers in the ...
0
votes
1answer
928 views

arcpy - how to run geoprocessing python script on SDE

I was testing my script on a .gdb on my local drive and I got it to work. The actual geodatabase I would like to run the script on is an SDE. I tried changing my filepath from the .gdb to the .sde and ...
0
votes
1answer
748 views

Unable to delete .lock files within geodatabase using Python

I am having problems with lock files while deleting and copying geodatabases for backup purposes. print "Now backing up your Geodatabase" distutils.dir_util.remove_tree ...
0
votes
1answer
217 views

Python adding grouplayer to muliple maps

I have the following code which is supposed to add a one group layer to each of the maps. In this case the group layer is always the same. Desired output: Map1 = 1 group layer added Map2 = 1 group ...
0
votes
1answer
103 views

Creation point layer from linear layer with only ends of lines

I have ArcGIS 10 with ArcView licence and I need to make point layer from a linear layer, with only start and end points for each line. In ArcInfo I could use Feature Vertices To Points with ...
0
votes
1answer
174 views

How to populate Unique ID field after sorting?

I am trying to create an new unique id field in a feature class. I already have one field called "SITE_ID_FD", but it is historical. The format of the unique value in that field isn't what our current ...
0
votes
1answer
431 views

Parse attribute table value to export filename using data driven pages and arcpy.mapping

I'm trying to customize a data driven page looping statement workflow and want to set a better filename to the final export. Currently the file name uses the page index (pgIndex), but I would like it ...
0
votes
2answers
867 views

How to auto populate multiple fields in attribute table?

i have Feature Class Buildings, it has many fields like ...
0
votes
2answers
465 views

Why does TableToTable give ERROR 000732 when published to ArcGIS Server?

I have a python code that uses ArcPy command "arcpy.TableToTable_conversion" to convert a database table to a dbf file. arcpy.TableToTable_conversion The input table is from a SQL Server database ...
0
votes
1answer
726 views

Is getting wrong attribute values from a feature in qgis

I make two polylines features(in my example both consists of two points) with the add feature tool. Then I (with code) add some attribute values on the first feature, then changes the geometry of the ...
0
votes
1answer
883 views

how to execute a python tool in ArcGIS 9.3

I have a problem executing the code below. The file is not found in split_row_0717.py Please kindly help any modification and thank you. The error said that Traceback (most recent call last): ...
0
votes
1answer
487 views

Defining projection in arc toolbox (JSON to shapefile) in python

I have a arc toolbox which converts JSON txt file to a shapefile but we have to define the projection. How can I hard code the defined projection so that user don't have to input the projection ? ...
0
votes
2answers
222 views

extract edge of a line of a vector layer in a new point layer [closed]

I'm using python to build a plug-in in Qgis. I need to extract the edges of each line feature of a vector layer to create a new point layer of all edges. Someone can help me? My data input is a vector ...
0
votes
1answer
486 views

ArcGIS: Extracting data from large intersect dataset

I have a big dataset imported into ArcMap. For each point, I created a buffers of 200m. And I apply Intersect to all the buffers, resulting in a huge dataset of around 2183962 objects. Previously, I ...
0
votes
1answer
671 views

Null output from field calculator code block

I have a simple calculation to compare two columns and populate a new column with the lower value but I am getting null output...any ideas? expression ...
0
votes
1answer
344 views

Generate a random 100x100 m bounding box in any projection in pure Python?

I'm given: Extend of WMS Layer SRS Now I want to, in standard 2.6 Python (no OGR or C lib dependencies), to generate a 100x100m random bounding box within that extent (assuming it is more than ...
0
votes
1answer
309 views

python calling def __init__(self, uri=None): method

I am working on python plugins for QGIS. I have my QueryBuilder.py and postgis.py files. I connected it to database using Connection class and under def __init__(self, uri=None) in postgis.py file. I ...