A version of the Python programming language
1
vote
0answers
24 views
Programmatically selecting features by polygon
Expanding upon this post how could you use QGis to programmatically draw a selection polygon and select features within the polygon? I have been using QgsMapToolEmitPoint(self.canvas), to find and ...
0
votes
1answer
31 views
batch buffer with different distances with python 2.7 in arcgis 10.1
I am trying to write a "smart" way in Python to process multiple buffer to lines, polygons and points with different distances. I use Python and ArcMap 10.1.
I can figure out to separate lines, ...
2
votes
0answers
15 views
How to use matplotlib with ArcGIS 10.1 without Microsoft Visual C++ Runtime Error?
I have problems using the matplotlib for python with ArcGIS 10.1
If I run the code below as a script tool in ArcMap. No pdf is generated and when I close ArcMap this error is shown.
If I run the ...
2
votes
4answers
43 views
How to Add (+) up integers in a field and print a total count in pyhton 2.7
I'm a complete beginner to python. I have what I hope to be a simple question. I want to run a bit of script in IDLE so that it adds up all figures in a table under attribute name "Tot_Aff". When I ...
1
vote
1answer
35 views
Find minimum elevation along a polyline and return xy or point?
Using ArcGIS 10.1 and Python IDLE 2.7.2...
I'm trying to find the minimum value of a polyline with a raster layer and turn that LOCATION into a point. I put everything together in model builder, but ...
1
vote
0answers
21 views
How to create a circle vector layer with 12 sectors with Python and to save average value of underlying raster in each sector?
Hi I am writing a code with Python 2.7 using Arcpy 10.1 and I guess I am doing stuck with a silly problem that lies under my eyes. I have created a grid of points (with "Create fishnet" function) over ...
0
votes
1answer
29 views
Unknown error concurring when developing QGIS 2.0.1 plugin in Windows 7
I am following the tutorial found here for developing a simple QGIS plugin within QGIS 2.0.1 installed on Windows 7. However, as I have began to try developing a link between the GUI and each the ...
6
votes
1answer
180 views
Increasing speed of Python scripts using arcpy
Update 4/11/2014
It looks like the script was getting hung up on the Delete Features tool, so I switched to Truncate Table, as suggested in the answer below. I also removed the unused variables from ...
0
votes
1answer
20 views
how to calculate the average temperature of each band of a .grd file?
I am having a GRD file in which the temperature at different longitude and latitude are given in a 32x35 array for one day(band),i am having 365 such bands and want to calculate the average of all ...
4
votes
1answer
62 views
How to select all values by default in arcgis tool's multivalue parameter using python?
I am using ArcGIS 10.2 and have three parameters, Feature class, field and a multivalue parameter respectively in ArcGIS tool. I populate multivalue parameter with unique values of feature class on ...
0
votes
1answer
17 views
GRASS module g.mremove returns irrational outputs
I want to use g.mremove to remove multiple files in my mapset,
import os
import sys
sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python'))
import grass.script as g
import ...
0
votes
0answers
9 views
saga_api python library : raise AttributeError(“No constructor defined”)
Good morning,
I'm traying to execute a python script using saga_api library, unfortunately I'm stoped in the first step :(.
when I tray to execute this command on python: ...
3
votes
1answer
97 views
Arcpy Update Cursor (arcpy.da.UpdateCursor()) not saving changes to 'SHAPE@LENGTH'
Looked around and found other Cursor questions, but nothing dealing with updating 'SHAPE@LENGTH'. I am running ArcGIS 10.2.1 and have a multipoint shapefile that I am grouping into polygons based on a ...
0
votes
1answer
61 views
How to save results of postgresql to csv/excel file using psycopg2?
I use driving_distance in postgresql to find distances between all nodes, and here's my python script in pyscripter,
import sys
#set up psycopg2 environment
import psycopg2
#driving_distance module
...
0
votes
1answer
47 views
GRASS module g.copy returns irrational outputs
I took this as reference, Moving raster to different mapset GRASS GIS, and I use pyscripter to use GRASS module g.copy from outside,
import os
import sys
#set up GRASS environment variables
...
0
votes
1answer
45 views
Use psycopg2 to do loop in postgresql
I use postgresql 8.4 to route a river network, and I want to use psycopg2 to loop through all data points in my river network.
#set up python and postgresql connection
import psycopg2
query = """
...
1
vote
1answer
93 views
How to execute sql lines in postgresql using python?
I use postgresql 8.4 to route a river network, the following is my code typed in pgAdmin and the result is fine,
select * from driving_distance
('select gid as id,
start_id::int4 as source, ...
0
votes
0answers
29 views
GRASS module g.mapset can't create new mapsets from outside
I use pyscripter to control GRASS from outside. I want to create a new mapset named water.
Here's my script to generate new mapset,
import os
import sys
#set up GRASS environment variables
...
1
vote
0answers
28 views
Error in cliping raster with multifeature polygon shape with arcgis9.3 using python
I have raster and I have a multifeatured polygonshape file. I Need to Clip my raster Image. Python code was developed for arcgis 9.3. It was working before and suddenly it stoped working. my codes is:
...
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
0answers
32 views
Python Error in recognising ENVI file
I am trying to read a .bip AVIRIS file using GDAL in Python. here is the code:
from osgeo import gdal
from osgeo import ogr
from osgeo import osr
from osgeo import gdal_array
from osgeo.gdalconst ...
1
vote
2answers
109 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
26 views
Better ways to check if GRASS r.water.outlet works out fine output
I use my python script to call GRASS module r.water.outlet from outside, and here's my script(I perform this script in pyscripter):
import os
import sys
#set up GRASS environment variables
...
0
votes
1answer
21 views
How to map factors and their relative importance in ArcGIS 10.1 for Desktop?
I want to know how I can calculate a map from a set of factors (in the form of raster layers) and Their relative importance for example:
slope 20%
lithology 10%
.
.
.
1
vote
2answers
42 views
arcpy 10.0 iterate through shapefile1 clip shapefile2 to shapefile1's polygons
I know that this question has been answered several times before, but for some reason I cant get this script to run...So I was hoping someone could point out where Im going wrong.
I have 2 ...
2
votes
1answer
113 views
Field Calculator: return two or more field value
I trying to return three field values in same If Statment and conecate them, but i Get NULL value insted of the conecated fields
getClass (!InDiameter! , !OutDiameter! , !TheridDiameter!, ...
0
votes
1answer
33 views
Difference between python IDLE and eclipse on accessing GRASS
I have seen these posts:GRASS and Python, Using Eclipse to develop GRASS Python programs.
I used to use python IDLE to control GRASS, but I can't make python and GRASS connected, as I described in ...
0
votes
1answer
43 views
SyntaxError: invalid syntax (<string>) in Pl/Python (PostgreSQL) [closed]
I have python 2.7 and I have weather script which returns temperature infos, I would like to implement this script into PostgreSQL. I always got this error: DETAIL: SyntaxError: invalid syntax ...
0
votes
1answer
62 views
AttributeError: 'module' object has no attribute 'Open'
Hy, I am running the following code which I found on: GDAL - Perform Simple Least Cost Path Analysis which I adapted to my case, but I get the following error when running the code in the python ...
1
vote
1answer
21 views
How to Select by Location and assign attributes using Python?
I have a polygon layer with a 'lot' field, and a points layer.
How can I use python to select the points by location (to find what points are contained in what polygons) and assign the value in the ...
0
votes
0answers
34 views
Suggestions on how to create an Owner Index for a Plat Book?
I've been tasked with creating a county wide plat book for publication this june. The cartography portion is fairly straightforward as I am using ESRI's Data Driven pages for ArcInfo 10 to produce the ...
0
votes
1answer
87 views
Is it possible to run qgis through python?
I need to build an app to analyze some raster layers in qgis.
I thought it was possible to just write code in python (2.7.6) (IDLE) and let it automatically open QGIS, load some layers, do a distance ...
0
votes
0answers
23 views
Reload Table Cache with Python & ArcGIS 10.1 [duplicate]
I am trying to create a button in arcmap that reloads the table cache. Exactly, like the existing button Table Options > Reload Cache. The button is inside when you open an attribute table. I would ...
2
votes
2answers
54 views
python add fields that may have NULL values
I would like to use python to calculate a field (short integer) using other fields (short integer) present in the table. In some cases these fields may have NULL values for one or more of the fields. ...
3
votes
0answers
50 views
How to extract zipped shapefile and check its shape type using arcpy module without writing on disk
I have a zipped shapefile saved on my disk. I want to extract it in memory and check the shape type. I'm using arcpy module and want to stick to only default modules comes with python installation. I ...
0
votes
0answers
14 views
random point through raster
I've some issue in some task pls help if you can as I've not good python skills.
I've a raster with values from 5 to 97 and I want a python script which can scan the raster and generate random points ...
1
vote
1answer
81 views
python dissolve by field error
I would like to dissolve a feature class by a field. When I run the code, I receive an error that says, "invalid topology [out of memory]" I have 16GB of RAM and terabytes available on the hard drive. ...
1
vote
2answers
18 views
Comparing projections of two datasets when SRID not available
Similar to this question:
How to test if two GDAL datasets are in the same projection?
However, the above does not cover cases where an SRID is not available.
It can often be the case that an SRID is ...
4
votes
1answer
109 views
How to do a separate Python installation with ArcGIS?
I see a lot of threads asking how you can have a separate Python installation (e.g. the Anaconda or Python XY distribution) and get it to work with arcpy, while not 'breaking' ArcGIS at the same time.
...
0
votes
1answer
69 views
Plotting 3D Data using Python
I have a Uniform Grid of 1KMx1KM squares as a shapefile with population data in each grid in a specific column as an integer. I would like to extrude each polygon based on the population and export ...
0
votes
1answer
170 views
What might cause “python.exe has stopped working” when closing ArcPy script?
I created a script that take a .tab file and join it to a shapefile. The script works perfectly but when it finish, it gives me an unhandled exception which crashes python. I dont know what might be ...
3
votes
2answers
163 views
Sqlite, Python 2.7 and Spatialite
I am trying to spatially enable my sqlite database:
import sqlite3
db = r'c:\temp\mydata.sqlite'
conn = sqlite3.connect(db)
conn.enable_load_extension(True)
cur = conn.cursor()
cur.execute(r"SELECT ...
-2
votes
1answer
53 views
How to create a link in the message body of email with Python? [closed]
I want to send an email with python that contains as a link in the body of an email as well. This link is actually a path to a file. If a receiver clicks on link It should open a folder where the file ...
1
vote
3answers
96 views
Append Attribute Table of multiple feature class with same points/ pointID
I used extract by points function to extract values from multiple rasters using a point feature class. The output is a couple hundred point feature classes with values associated with those rasters.
...
0
votes
0answers
47 views
Missing pyexpat on QGIS 2.0.1: pyuic4 fails
I have encountered a problem when trying to develop a custom plugin for QGIS 2.0.1 (Python 2.7.5 with two additional Python installations on the same machine). When I try to compile the UI file ...
2
votes
2answers
195 views
Automatically download Modis image using python script
I need download Modis imagery automatically from the website: https://earthdata.nasa.gov/.
I found this link: http://gis-techniques.blogspot.com/2010/06/getting-modis-image-automatically-from.html
...
3
votes
1answer
92 views
Can folder connection in ArcMap Catalog window be added using python?
I have created a set of general scripting tools for map automation etc. in one of my tools a geodatabase is created in the workspace folder the script points to. Just out of curiosity is there any way ...
4
votes
1answer
238 views
Issue on using Pyscripter with ArcGIS 10.2
Can someone please let me know how I can set the Pyscripter 2.5.3.0 x64 works with Python 2.7.3 which comes with ArcGIS?
what I did was:
1- I installed the ArcGIS 10.2
2- I installed Pyscripter ...
0
votes
1answer
78 views
Copying Network Analysis Layer - Service Area Polygon in Python Script
I have built a geoprocessing tool using arcpy modules in python. Screenshot shown below:
In this tool I am creating Service Area Polygons and selecting census boundaries within those Service Area ...
1
vote
2answers
86 views
How to Project a point on feature in PyQgis?
In Arcgis IProximityOperator.QueryNearestPoint Method was available to get the nearest point. Similarly Is there any function available in pyQgis?
Thanks in Advance.