Tagged Questions

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

learn more… | top users | synonyms

2
votes
1answer
48 views

Add OpenLayers layer from QGIS's Python console?

On QGIS 2.4.0-Chugiak the Openlayers plugin is found under Web menu rather than the Plugins menu. How can you use the Python console to add a Openlayers Google Maps layer? The following code give us ...
3
votes
2answers
74 views

What is the best way to get from wkt to shapefile in Python?

I am querying tables from a SQL-Server database and would like to convert the table into a shapefile. It has wkt geometries and wkb as columns in the table, along with other attributes that need to ...
1
vote
0answers
48 views

py2exe ImportError: No module named _err

The .exe file generated with py2exe returns the following error: c:\Users\...\dist>ShapeFileConverter.exe Traceback (most recent call last): File "ShapeFileConverter.py", line 4, in ...
1
vote
2answers
34 views

Automating procedure to add shapefile to multiple map templates using ArcPy?

I have a project that has me create a package of about a dozen maps for a client and I do this multiple times per week. I am trying to figure out if there is a way to automate this with python. I am ...
1
vote
1answer
40 views

slow Python script pulling from an iSeries database

I've converted and updated some python scripts that exported data from an iSeries database (HTE) to Access to export the same data to a fgdb. My biggest issue is the time it's taking to export the ...
3
votes
1answer
68 views

Fast raster combine using rasterio

I'm trying to duplicate the functionality of ArcGIS's Combine function within rasterio. Given a list of (presumably categorical) rasters read with rasterio, I want to output a combined raster and a ...
1
vote
1answer
59 views

ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Layer Name or Table View: Dataset L does not exist

Hi I am trying to create a loop so that each layer is produced in its own map. This is my code: import arcpy path = "C:\Users\Et\Documents\ArcGIS\Default.gdb" mxd=arcpy.mapping.MapDocument(path ...
2
votes
1answer
65 views

QGIS select reversed geometries

I have a road network and a geometry for each road direction. One Geometry from A->B and another Geometry from B->A. This geometries are covering each other. Is there a tool available in QGIS to ...
3
votes
0answers
63 views

Select and copy attributes features in ArcMap using Python add-in tool?

I'm trying to add a tool to an add-in toolbar to select features from an existing feature class and copy attributes to another feature class,from point to point. TopoHeight_Field_Name='Comment' def ...
0
votes
0answers
20 views

Script Efficiency

I have been working on a script to read pixel values and print the values out to a text file. This is currently working but takes around two hours with a 6.6gb file. This is to replace an older script ...
2
votes
1answer
32 views

Shapely's simplify won't simplify any more

I have a multipolygon in shapely, and I want to simplify it until it has less than a certain number of points. When I use the preseve_topology=False argument to geom.simplify, I can get the number of ...
4
votes
1answer
57 views

SQL-query in arcpy - SELECT WHERE feature between two values

I need to select features between two values in python with arcpy. However, whenever I try to run the code below, it returns with error message "An invalid SQL statement was used". whereclause = ...
0
votes
0answers
35 views

Free ebooks of QGIS [duplicate]

I am new to QGIS and python. Can any one tell me, where I can find QGIS and Pyqgis ebooks for free.
1
vote
1answer
65 views

Could not open/read USGS raster file

I could not open/read the following .img file. The document below says it is a raster file. http://edc2.usgs.gov/1KM/land_sea_mask.php I tried to open it using many ways such as Q-Gis software, and ...
10
votes
3answers
222 views

How can I parallelise embarrassingly parallel GIS operations in QGIS python?

A common requirement in GIS is to apply a processing tool to a number of files or apply a process for a number of features in one file to another file. Much of these operations are embarrassingly ...
2
votes
0answers
36 views

What is the issue with geopdf format?

I'd like to add the geopdf format as output of a library that I am working on. After have looking around, I have not been able to find a (c, c++, python) library that meet my license requirements ...
2
votes
0answers
81 views

Error with da.UpdateCursor and SDE feature classes

I am making my first attempt at editing an ArcSDE feature class with python through a da.UpdateCursor. I'm essentially taking code I've written for a file geodatabase feature class and applying it to ...
2
votes
1answer
37 views

Arcpy PointGeometry does not carry forward the ID

I used this as starting point I have the following code: Test data data = numpy.array([(0, 51.1047664, -114.3722785, 1205, ...
-1
votes
1answer
45 views

Geocode as soon as PostGIS table is updated

I am trying to create a map such that as soon as I enter an address into PostGIS table, it'll automatically be geocoded (and published in geoserver). The only way I could think of doing this was using ...
1
vote
1answer
92 views

Calculating distance between latitude and longitude by using python

I have a database of 2000 points, which is in csv format of latitude and longitude. I want to find distance between these points all at once. And also showing these points in Map by using only pyQGIS. ...
1
vote
2answers
28 views

QGIS 2.4 crashes when symbolizing QgsComposerShape in Python with ScriptRunner

I'm attempting to use ScriptRunner to output a jpeg of a red rectangle using QGIS Composer to understand the QgsComposerShape. Everything works except QGIS crashes when the symbol is applied. The ...
0
votes
1answer
56 views

Needed either python or VB Script to write right indent

Question : I have a field column that is has numbers with percent. The field properties are string and 50 in length. I ran it in an expression using round([T_Acres]/207 * 100,0) + "%" in VB script . ...
1
vote
0answers
74 views

How to convert length in Decimal degrees to meters programmatically?

I'm new to qgis and I want to find the length of some roads in a map. So I used the following code, from shapely.wkb import loads def getLength(): layer = ...
2
votes
1answer
70 views

Reading postgis geometry with shapely

I am doing a small-scale workflow in ipython notebook with geopandas and shapely, pulling a bunch of geospatial data, sometimes from shapefiles, sometimes from postgis (where more expensive processing ...
1
vote
2answers
42 views

Specify a GDB feature class using Python Tkinter dialogue box

I tried to specify a feature class from a GDB dataset through Python Tkinter tkFileDialog.askopenfilename. Below is the script. It worked for me in the past when I was dealing with .txt or .las files. ...
1
vote
0answers
28 views

Asset point IDs, pipeline and flow direction

I have a data set of a sewage pipe network and point data (assets). I would like to: first calculate the flow direction of pipes (polyline feature) assign IDs to the pipelines using asset IDs ...
0
votes
1answer
38 views

Writing shapefile with projection defined crashes Fiona part two

I have the same problem as this post. Writing shapefile with projection defined crashes fiona It says that was an issue with GDAL. I cleaned my site-packages of anything GDAL, fiona, six related. ...
1
vote
1answer
40 views

Iterating an ArcGIS tool over multiple Fields with selection boxes

I have one shapefile that contains many fields and I'd like to write a simple script tool that allows me to run IDW for the fields I select. Is this possible? For example..... Input: 1 shapefile ...
1
vote
2answers
120 views

Field Calcuator to add percent using Python

What might I go wrong here is that I am trying to add percent. I use the Field Calcualtor and it keeps getting an error. I am opening the Table to add a field named Percent and then type this: ...
1
vote
3answers
52 views

Export selected fields in ArcGIS to Excel using Python

I'm am creating a script that will allow a user to add XY coordinates to a point layer, then export (along with any addition user selected fields) to Excel. I am getting stuck on the iteration of the ...
2
votes
0answers
57 views

Iterating between two layers using QGIS python

I will try and explain my situation as clearly as possible. I just created my first plugin that is being used to analyze between various layers and give back quantities to the user. Most of it is ...
4
votes
2answers
54 views

How to get arcpy to work with Anaconda?

I am trying to follow the step-by-step directions in the answer to "how to separate Python installation with ArcGIS" but cannot find the path file, DTBGGP64.pth, in ...
2
votes
1answer
49 views

How to find length of a discontinued line feature

I wanted to find the length of features in a road layer. So I go through each feature in the layer and used, line = feature.geometry().asPolyline() to find the points which particular feature is ...
1
vote
0answers
33 views

Error Loading Layer/Shapefile in a Standalone Python QGis Application

I tried loading a shapefile on Python using PyQgis API but to no avail. I double-checked the path to shapefile and found it to be correct. QGIS module also seems to be imported just fine. When I ...
1
vote
1answer
31 views

Use subprocess module to run GDAL processes

I am attempting to write a python script that will reproject & merge a series of .tif files then clip them to the boundaries of a .shp file. I have successfully used the subprocess module to do ...
0
votes
2answers
46 views

Count the number of points in a (multi)polygon in shapely?

I'm using Python, Shapely and Fiona to process some shapefiles. Is there an easy way to count the number of points in a polygon/multipolygon in Shapely and Fiona?
1
vote
1answer
40 views

PyQGIS reload a QGIS plguin

I have a plugin that has a psycopg2 connection to a PostGIS database. When i close GUI with the X-Button and open it again, all the widgets are filled with the data from before. It looks like the X is ...
2
votes
2answers
63 views

I've downloaded the GDAL-1.11.1 package but why can't I call on it in python?

I have a Mac and am very new to this coding stuff.. I'm using a code that includes import osgeo as gdal and so I've downloaded GDAL from https://pypi.python.org/pypi/GDAL/ which has a folder ...
1
vote
0answers
18 views

Identify, Get, recover ArcGIS for Server (AGS) user?

have some one try or succed in recover the ArcGIS for Server (AGS) User name used in the connection, i need this cause i'm doing some edits to a Enterprise GDB, SQL Server with the same user and ...
2
votes
2answers
101 views

Intersect Shapefiles using Shapely

What I'd like to try and do is intersect some point buffers with census tracts, maintain their ID's and the tracts attributes. I found a sample from ...
0
votes
4answers
78 views

Subsetting a x,y,z into a text file from a large xyz text file

I have a large txt file with x,y,z format. The file size is almost 8 GB. So I don’t want to process in ArcMAP. What I wanted to do is, I have a end coordinates for polygon shapefile and i have ...
0
votes
1answer
16 views

Issue using Osmconvert with Python

I want to use osmconvert to parse down the size of my diff files for just the area I'm interested in because osmconvert is way faster than osm2pgsql, which loads the data. When I call the command ...
0
votes
0answers
25 views

Custom ArcGIS Server Backup Python Script

I am running into issues using the ArcGIS REST API import site operation because the server is federated with Portal and only has a domain certificate (i.e. not CA-signed). So I am looking for a ...
1
vote
1answer
81 views

How to work with accentuated strings in Python scripts in ArcGIS Desktop Field Calculator?

` pre-logic: def myCalc(name,nameVal): if (name == nameVal): return 1 else: return 0 var_name= myCalc(!Epulettipus!,"Lakóépület") ` This doesn't work with accentuated strings. (But ...
0
votes
2answers
91 views

Writing Python script in Field Calculator in ArcGIS Desktop?

I'm a programmer, I have programmed in C#, Java, but not with Python. And I'm not a geographic worker. How can I write a python script into Field Calculator to be able to check the other column value. ...
0
votes
1answer
66 views

Copying XY to clipboard using Python Add-In (ArcMap)

I am trying to create a simple tool to copy XY from where i click the mouse button. What i have done already is: create add-in files using Python Add-In Wizard create toolbar and tool inside it in ...
1
vote
0answers
19 views

Python 2.6 Module for GDAL 1.9.2, ImportError

I work on an internal network(IE I cant get the latest 1.11 stuff) and have GDAL 1.9.2 setup on a Red Hat Linux Enterprise Server 6. My linux box has python 2.6.6 however the python binding I received ...
0
votes
2answers
56 views

How to extract portion of a string for a field value

This is simple but driving me mad. I am using Modelbuilder to iterate through a folder of feature classes, and need to add a field that extracts a portion of the filename. Example: CF0140r01.shp I ...
1
vote
1answer
39 views

Properly writing floats to feature properties of a new shapefile in Fiona

The following piece of code returns a shp following the driver and crs of a model .shp. import numpy as np #just to test I correctly handle data types import fiona from shapely.geometry import ...
0
votes
1answer
39 views

Poly shapefile using pyshp

I have a script for creating points shapefiles, but I can not fix it for make a new polyline shp file. I have obtained the data from a excel file and extract data in three differents lists ...