Python is an open source interpreted programming language used in many GIS programs.
1
vote
1answer
78 views
How to run “create mask” from the console?
There's a plugin called "create mask" for qGIS and trying out some simple scripting from the Python console.
I would like to call it after I select the vector features I want, then do more related ...
5
votes
1answer
189 views
How to load raster data with hyperlink path in ArcGIS MXD?
I have a problem/question and hopefully someone of you is able to help me:
I have thousands of georeferenced raster files which have corresponding polygons (outer borders of rasters) with a hyperlink ...
6
votes
2answers
96 views
Refresh open attribute table in ArcMap (arcpy)
I am running the Calculate Field GP tool from the arcpy in ArcMap. When a row value is updated, it does not show up untill I use the Reload Cache tool (Table Options > Reload Cache). How do I refresh ...
0
votes
1answer
125 views
How to properly add a Python Module to a Plugin?
I've been trying to use a module that is installed in my local version of python, but whenever I open the plugin itself, it does not manage to locate said module. The module in this case is Noise ...
2
votes
2answers
187 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 ...
5
votes
2answers
88 views
How to do advanced Python labeling in Arcmap?
Does anyone have a good reference for advanced/complicated labeling expressions in Arcmap? I am attempting to write a Python label expression that would involve multiple label definitions.
Here is ...
5
votes
1answer
162 views
Changes in synchronized replica not shown in ArcMap or ArcCatalog without refreshing
I am synchronizing a one-way replica in ArcEditor using Python. I tried adding RefreshActiveView and RefreshCatalog to the code, but I still need to refresh the synchronized database to see the ...
1
vote
2answers
59 views
ArcMap label expressions with Python
Having trouble here: I'm trying to use python to write selective label expressions. I have several concentrations and depending on its "_Ex" number I either want it labeled red, not red, or not ...
-1
votes
1answer
60 views
QGIS and Python - create line with multiple points in postgis
How can I create a line, with Python functions, with many points that are records in Postgis?
Thank you
2
votes
0answers
75 views
How to interpolate GPS data correctly?
I'm working on a project that involves using linear interpolation to fit lines to
lat/lng points. I'm pretty new at scientific programming related stuff, and I was wondering if people could steer me ...
2
votes
1answer
89 views
How to calculate volume from a raster file?
I have a raster file containing the depth of water. I need to find the volume of water using that raster file. I need to find the area of each cell and multiply with the depth. How can I do it in ...
4
votes
1answer
44 views
Using matplotlib to create and export graphs automatically from ArcMap
I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows:
1. A feature ...
0
votes
1answer
63 views
Use subprocess.call with gdalwrap
I am now want to use subprocess.call with gdalwrap to clip raster from shapfile
(in qgis 1.8.0)
I use raster→projections→wrap(reproject)to generate command_line below
gdalwarp -t_srs "+proj=tmerc ...
3
votes
1answer
60 views
Why are z-values replaced with zero after in_memory use in Python?
My script takes separate 3D feature classes, calculates a field, appends to a target feature class, and then deletes the originals. This is a huge data processing task of over 4700 mass point feature ...
0
votes
1answer
54 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 ...
2
votes
1answer
88 views
Need help assigning values to field using OGR in python
I've got a similar question to this one How to programatically populate a shapefile field with polygon areas in OGR?, but the solution doesn't seem to be working for me. I am trying to import a ...
6
votes
1answer
1k views
Python Script to Create Table Using Data Driven Pages
I am trying to convert some python script to display a table (based on a dbf) of features located within a specific data driven page. So far, I have the script successfully able to refresh the map to ...
0
votes
2answers
52 views
Splitting Shapefiles [duplicate]
I am trying to create a code that will accept the input of a shapefile, and separate each of its features into separate shapefiles into a specified directory location. Can anyone help ? I am trying to ...
1
vote
1answer
62 views
How to get point x and y geometry from a shapefile?
I have a shapefile of US Cities and I want to get the X and Y coordinate of EACH city in that shapefile. I've tried this:
for city in city_cursor:
geom = city.Shape
point = geom.getPart()
...
3
votes
1answer
187 views
How to install SciPy in the QGIS Python folder under Windows 7? [closed]
I am trying to run a plugin in QGIS that requires SciPy on a Windows 7 computer. Now the Windows installer file for SciPy by default tries to install SciPy in a standalone Python version. The version ...
1
vote
1answer
124 views
Python SQL connection causes crash in ArcMap
I have the following code which I have striped down to just included the part that is causing a crash in ArcMap.
import pymssql
# Connect to the Research db using Windows Integrated Authentication.
...
1
vote
2answers
101 views
Can anyone recommend an Arcpy GUI? [duplicate]
Alright I have been having really good luck with you guys so here is my question...
Can anyone recommend a GUI for arcpy? So if I want to run my script as an exe with some blank text boxes(or text ...
3
votes
1answer
93 views
changing symbology
I have problem with my script. Layers are in one geodatabase, and have names like: orne1942, orne 2003, orne 2009 (the same forpart e.g. orne). Script should changing symbology layers wich have the ...
2
votes
1answer
49 views
Script to either rotate existing text element or insert graphic element
I have about 300 maps that contain a text element that needs to be rotated. I am pretty new to python but I have heard how great it is. This seemed like the perfect task for python but I have had no ...
1
vote
0answers
25 views
Problems running zonal statistics - not all zones represented
I have been working on a Python script to automate the steps illustrated by whuber here:Create points around the edge of viewshed results
I am trying to create a horizon graph illustrating the ...
0
votes
1answer
52 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 ...
2
votes
1answer
76 views
How to add one or more points to an existing polyline or polygon?
Using the following code, I make a polyline with two points.
vl = QgsVectorLayer("LineString", layerName, "memory")
pr = vl.dataProvider()
vl.startEditing()
fet = QgsFeature()
...
7
votes
2answers
139 views
How to use Python modules as data providers in QGIS?
I don't know if it has been discussed in the past. Qgis data providers can only load native compiled libraries (.so, .dll, etc) that offer the required interface.
Is there anything blocking to the ...
-1
votes
0answers
25 views
How to use sub queries while inserting record into db using cx_Oracle in python? [closed]
I need to add a symbol with the value of self.wrkArea variable like this
(select chr(182) from dual) || self.wrkArea || (select chr(182) from dual)
i.e. ¶workarea¶ will be the result. how to ...
0
votes
1answer
46 views
Change ID for each line in vectorlayer in python
I am creating a vectorlayer with lines by doing this in python:
for i in frange(1, noOfPoints, 1):
polyLine = line()
polyLine.AddPoint_2D(minE,minN - addEastRange +(i-1)*linespacingEast)
...
0
votes
1answer
51 views
How to save after using fet.setFeatureId in pyQGIS?
By using the following code, I want to change the id of the line when saving the line. But the setFeatureId command, gives a false when doing the commitChanges(). Any idea how to change the id?
vl = ...
1
vote
2answers
152 views
PyQgis overwrite shape file and adding layer to Qgis
I am creating a shapefile in python by:
driver = ogr.GetDriverByName('ESRI Shapefile')
datasource = driver.CreateDataSource('c:/temp/toke2.shp')
layer = ...
2
votes
1answer
45 views
How can I set the settings of an Address Locator within a Model or arcpy?
I am creating a model that processes a large road dataset, then creates an address locator from the roads. The Create Address Locator tool does not allow me to set options like Spelling Sensitivity or ...
2
votes
1answer
43 views
Exporting Selection Using Python
I currently have a search cursor iterating through a shapefile in ArcGIS 10.1 that selects a feature and runs a viewshed analysis on that feature (and only that feature).
What's the easiest way to ...
1
vote
0answers
20 views
Calculate complete spatial randomness using Python [duplicate]
I currently use the csr() function from Splancs for R (http://cran.r-project.org/web/packages/splancs/splancs.pdf) to calculate complete spatial randomness (CSR) points to be used for spatial ...
1
vote
2answers
63 views
How to Add Shapefile with Symbology from Layer File to ArcMap MXD using ArcPy/Python?
Say I have a Shapefile:
C:\DATA\points.shp
A layer file:
C:\SYMBOLOGY\symbology.lyr
And a map document:
C:\MAPS\map.mxd
How can I add points.shp to map.mxd with the properties of symbology.lyr ...
0
votes
2answers
70 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 ...
3
votes
1answer
47 views
TKinter to provide variables
I've been looking for a way to enter a unique field name into an attribute table for up to 40 feature classes. I need the field names to be meaningful, not just 'field1', 'field2' etc. For example, if ...
1
vote
2answers
48 views
ArcPy- AddJoin-function struggles using Table of PersonalGeodatabase
Hey,
I am doing some arcpy -functions and afterwards I'm trying to add the calculated results from one table to another table. I'm using the arcpy.AddJoin_management() function.
As input table I'm ...
0
votes
1answer
42 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 ...
9
votes
1answer
481 views
How to implement MultiValue Parameter with Multiple Columns?
This might be a simple question, but I haven't been able to find a straightforward answer.
I'm working on an ArcGIS (9.3) Python script. One of the inputs is a list of features. For each feature, I ...
1
vote
1answer
59 views
A simple Python Script to save the currently opened mxd and changes
Here is what I have so far...
import arcpy
import arcpy.mapping as map
mxd = map.MapDocument()
mxd.save()
And yes I know that map.MapDocument requires an argument, but I want it to automatically ...
3
votes
1answer
54 views
Why is my simple arcpy script failing? (sets raster cell value to null if below threshold value, ArcGIS 10.1)
As mentioned in the title, simple script to set null cell values below three standard deviations beyond the mean:
import arcpy, sys, os
#Accept input and output raster
inRas = sys.argv[1]
outRas = ...
2
votes
1answer
64 views
How to access the road graph plugin in python?
I am developing a few scripts in Python for QGIS 1.8 to automate some geo-tasks and one of them would be to calculate the shortest distance from a hospital to each building in a town.
I would like to ...
2
votes
2answers
46 views
Raster format to read with python
I currently have a DEM raster stored in an ESRI geodatabase. I've been asked to create a purely python (e.g., no arcpy functions) program that works with the values. Therefore, I need to convert the ...
4
votes
2answers
1k views
Arcpy Insert Cursor not inserting all rows
Good morning all, I have a script here that takes data from a cross-tabulated non-spatial dataset where monthly values are stored in a single table row for a given year and linearizes those data so ...
0
votes
1answer
37 views
Maintain 8-bit pixel depth in Raster Calculator
Would anyone know how to maintain 8-bit pixels when computing raster calculations in ArcMap?
1
vote
0answers
70 views
How to embed a PDF into an Excel spreadsheet? [closed]
This is what I want to do:
Create report using a polygon feature class to output areas of polygons using some logic and the ExportReport() function (This I have accomplished)
Create a PDF of the ...
1
vote
1answer
54 views
How to get an attribute of the selected feature and pass it into a URL?
As a total Novice with Python, I thought 2 weeks would be enough time to learn how to build some tools for our GIS... I was wrong and I'm running up on a deadline.
I am attempting to get a value ...
0
votes
1answer
99 views
How to clip raster by multiple polygons in multi rasters?
Using QGIS, I want to clip a raster by multiple polygons contained in a single shapefile. I read that gdalwarp can clip my raster by multiple polygons BUT the output is a single merged clipped raster. ...


