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

learn more… | top users | synonyms

1
vote
2answers
124 views

AML routines and python

I´m trying to use some AML files in ArcMap 10, but I have noticed that this option is not available for this version. Does anyone know or tried to "translate" the aml sequences to another language ...
2
votes
2answers
60 views

Can we no longer reference an ArcMap layer to get the spatial reference?

I'm currently using ArcGIS 10.2.1. In previous custom geoprocessing tools, I've used the following code to create a feature class in-memory, and set the spatial reference using an existing layer in ...
0
votes
1answer
11 views

Error using arcpy.da.SearchCursor and MakeFeatureLayer

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...
0
votes
1answer
28 views

Add field to feature class by location

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...
4
votes
2answers
515 views

Load and display a layer using PYQGIS

I'm having a go at using pyqgis from within the QGIS python console to load a layer from SQL Server and display it. I feel like I'm part way there but I'm having a real issue getting the layer to ...
6
votes
2answers
261 views

How to load a raster layer at the top of the QGIS ToC?

The following code inserts my new_layer just above the active layer in the QGIS ToC. new_layer = iface.addRasterLayer(...) Instead, I'd like my new_layer to be inserted at the top of the QGIS ToC. ...
0
votes
0answers
14 views

Edit attribute table for several layer files?

I try to edit attribute table for 20 layers that spread in big folder that divided to a lot of sub folders. In How to edit attribute tables using Python/ArcPy? the script used only for one layer at ...
1
vote
1answer
572 views

Linux Client for OpenGTS server

I've installed an OpenGTS server and successfully linked it with the GPS2OpenGTS_Pro application for android. The buses I'm tracking offer 3G with a wireless AP, however whenever the bus stops, the ...
0
votes
0answers
6 views

mapserver python mapscript WFS RAW POST data

I installed mapserver-6.2.2 and python mapscript in a Openshift gear (Red Hat cloud). But I can't work with WFS RAW POST data. This is my configure line ./configure --prefix=$OPENSHIFT_DATA_DIR ...
2
votes
2answers
190 views

Issue while running grass from subprocess

I have a map based web application using geodjango. I needed to display the crime hotspots within a selected polygon area. I found that v.kernel is very good for generating heatmaps/hotspots. So in my ...
0
votes
0answers
30 views

Tool to create triangle buffer using Python in ArcGIS Desktop?

I want to make a tool to create triangle buffer by python script in ArcGIS, like circle buffer that we use it in ArcGIS Desktop? I need a tool that allows user to input the length of sides of the ...
2
votes
0answers
32 views

Overwriting layers in a geodatabase maintaining its position in a feature class list

I'm working with ArcGIS 10. I work on ecological habitat mapping. I have some features classes inside a geodatabase which represent years of data on a specific area. Each has a reliability field with ...
1
vote
1answer
21 views

QGIS 2.6 : Programmatically setting key value pairs for ValueMap widget

Using QGIS 2.6 and Python 2.7 on Windows 7, I am trying to programmatically insert key value pairs into a ValueMap widget via a csv file. Issue is that some of the values are properly inserted and ...
1
vote
2answers
48 views

How to add 2 layers in qgis and display them at the same time

I added 2 layers in qgis using python but only one layer is shown on canvas. After clicking (anywhere on the canvas) both layers are displayed. layer = ...
1
vote
4answers
221 views

Python script to open many small images in QGIS

I have access to about 1000 satellite images that covers my country. Each of them is associated to a smaller image that is used for browsing the real deal. I would like to write a script that will ...
0
votes
1answer
180 views

Spatial ETL Tools won't run “AttributeError: 'module' object has no attribute, etc.”

I have a python script that runs 5 Spatial ETL tools that I wish to run as a scheduled task. Each of the tools will run successfully from ArcCatalog and also from the ArcCatalog Command line. If I ...
2
votes
0answers
36 views
+50

filename of current style in QGIS using Python

I get the name of the current style file using layer.styleURI(). Then, I change the style file using layer.loadNamedStyle(different_filename). However, when I call layer.styleURI() again, it returns ...
3
votes
1answer
42 views

Cemetery Grave/Person Locator

I'm a mediocre to intermediate ArcGIS user. I have created several point shapefiles, one for each section of a national cemetery, roughly 200-600 points in each section in a grid. Attached to these ...
1
vote
0answers
29 views

Connect to QGIS 2.6 Python Plugin function via button on custom feature form

I am trying to connect to a QGIS 2.6 Python plugin function via a custom feature form button. On my feature form, I'm attempting to do a few things : enable the updateButton only if the ...
-1
votes
3answers
53 views

Batch Re-projection script syntax error

import arcpy ... sourceWorkspace = "C:\\Users\\tx8p90\\Desktop\\Lesson2" ... targetProjection = "C:\\Users\\tx8p90\\Desktop\\python excercise data\\Lesson1\\contourlines.shp" ... listDataSet = ...
1
vote
1answer
44 views

Tool to delete all data from a shapefile

I am looking for a tool that deletes the data in the shapefile, and then copy and pastes all the features from a layer into the blank layer. We get updates to our layer from a separate organization, ...
1
vote
0answers
14 views

pymodis download issues

I'm trying to download and process MODIS imagery using pymodis. I have Python 2.7.8 (Spyder), numpy 1.9.1 and gdal 1.11.1. I've also installed WXPython. I originally tried to use the ...
3
votes
2answers
671 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
1
vote
1answer
70 views

How to add fields to shapefile from standalone script?

When I run the following script via OSGEO4W64 Shell, I receive the following error when trying to run the qgis:fieldcalculator algorithm: 'NoneType' object has no attribute 'mapCanvas' I read ...
1
vote
2answers
130 views

Adding layer into ArcMap via Python - .pyt versus .py

In the final step of a script I've built, I'm trying to add a layer into an empty blank map document. This is my block of python code below that adds the layer. Everything works fine if its run from ...
8
votes
4answers
2k views

Python script - how to avoid exclusive schema lock error?

I have a script for updating some features on my database every night (just for copying and replacing some features). This features are "read-only". My problem is that I can't avoid that these ...
4
votes
1answer
184 views

draw lines with an angle inside a rectangle in python

I am trying to make a plugin for Qgis with python. I have the four corner coordinates for a rectangle. I want to give the user the inputs, line space and angle (0 -180 degrees). With these inputs, I ...
1
vote
2answers
40 views

Is it possible to toggle draft mode in ArcGIS with Python?

I'm curious if it is possible to toggle on and off 'draft mode' in layout view in ArcGIS using python scripting. Does anyone have any ideas? Python is preferred, but if there is another solution in a ...
1
vote
2answers
44 views

How do I convert a GeoTiff's neatline metadata from vector format to pixels using GDAL?

I have a GeoTIFF that produces the following when run through gdalinfo: Driver: GTiff/GeoTIFF Files: PAA_1.tif Size is 14400, 6600 Coordinate System is: ...
3
votes
1answer
158 views

how to load the QGIS openlayers_plugin in standalone python script (not the QGIS embedded python console)

if I try to load the openlayers plugin in a standalone application it always fails with False, although paths are set, and plugin shows available. (tested on Ubuntu 14.04, QGIS 2.4, python-2.7) ...
3
votes
1answer
37 views

specifying extent in GDAL's WriteArray

Is it possible to specify the extent when creating an empty raster in GDAL? I looked everywhere, but can't seem to find anything. The portion of my script where I write the raster would look something ...
2
votes
5answers
129 views

Field Calculator expression to replace string only if it occurs

I have two fields (STREET1 & AKA_STREET_TEST1). I'm having a problem creating a simple IF THEN Python statement in the Field Calculator box. I've been searching the threads for a similar ...
7
votes
4answers
2k views

Insert points into SQL Server?

I am collecting X and Y values from a web service (Twitter) via a python script. In the long run, this will run over a period of months and I intend on stopping at around the 6 million point mark. ...
0
votes
1answer
49 views

Python Scripting Error (Adding a Field)

I'm using this code as a python script tool in ArcGIS 10.1: import arcpy, os arcpy.env.workspace = r'W:\S&P\s&p techs\Emily\Errors.gdb' #Looping through dissolved feature classes, adding ...
2
votes
1answer
28 views

How to plot trajectory points on maps in python

When I read the paper Characterizing Urban Landscapes using Geolocated Tweets, I'm attracted by the figures illustrated in it, like this: And I want to know how to plot these figures for my own ...
0
votes
2answers
33 views

Field calculator to copy numeric values from other fields

FieldA contains text: both numeric(123) and alpha-numeric(123a, 2-3, 3/2, '). FieldB is longstring. I want to use field calculator and codeblock on FieldB to bring from Field A only the numeric ...
0
votes
1answer
52 views

How to show the attribute table of selected features using arcpy?

Is there a way to show the attribute table of selected features using arcpy? Maybe in the mapping module? I would like to be able to select some features and then have an Add-In button that ...
4
votes
1answer
49 views

Why the order of imports matters in a standalone PyQGIS processing script?

I've come across a weird issue while running standalone PyQGIS processing scripts. The order of imports in the script affects its normal execution. You can reproduce the problem by opening a Python ...
0
votes
0answers
29 views

Restrict text widget to only integer between 0 and 999 in IntraMaps Roam

I have created a form and added an attribute as a Text widget in the Roam manager. Now I'm trying to restrict the input to be an integer between 0 and 999. I want the field to stay "empty" (or ...
1
vote
1answer
35 views

Populating list widget in IntraMaps Roam?

How do I add values (items) in a list widget in IntraMaps Roam (2.3.1 release)? I'm trying to add values (items) to a list widget in a form with Python code (ver. 3.3.2) I have created the form and ...
4
votes
2answers
1k views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
1
vote
1answer
166 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
0
votes
1answer
99 views

40k+ points from Shapefile, clustering them and populating on Google Maps/Webapp

I just started a new Python/Django webapp job related to GIS (and i'm totally new to GIS). Here is my task and what i have found so far, and i am stuck as to finding out what's the best way or the ...
1
vote
3answers
36 views

Raster calculator to create single raster with 4 values from two binary rasters

I have two binary rasters showing habitat suitability (0 = unsuitable, 1 = suitable) under current and future climate scenarios. I am trying to create a raster showing: 0 = cells that are not ...
1
vote
0answers
29 views

Difficulty with python package mgrs by Howard Butler

I am developing an app in python and I am trying to import Howard Butler's mgrs package. I am using setuptools to install the package. It does not find the setuptools library module. I have tried ...
1
vote
2answers
124 views

How to plot Storm Prediction Center (SPC) Shapefile using python

I am trying to make a plot of the SPC's thunderstorm outlook using Python. I have downloaded the shapefile from this website http://www.spc.noaa.gov/products/outlook/day1otlk.html. Then I use this ...
0
votes
0answers
27 views

Create polygons enclosing same number of points on PostGIS

I have a geodatabase on Postgis with points representing customers, what i need is give a number of customers, lets say 100 and it need to generate polygons enclosing 100 clients each one. I only ...
1
vote
1answer
44 views

Load the raster image which is in TIF format using QGIS API

I am quite new inthe field of GIS. I am interested in is to load the raster image which is in TIF format using QGIS API I have followed the steps given the in the follwing link to load shape file ...
1
vote
1answer
27 views

How to reduce area boundaries resolution?

I managed to plot zip codes boundaries for an entire US state using ArcGIS data and python tools such as arcpy and Bokeh. The result: The dataset has high resolution area boundaries so, I have like ...
0
votes
1answer
23 views

equation solving by using python or model builder in arcmap 9.3

I want to solve one formula in arcmap 9.3 by using Python or Model builder. I have one shape file, in that there is in attribute table for field A & B Solve the formula: A*B/Sum(A). where Sum(A) ...