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

learn more… | top users | synonyms

0
votes
2answers
40 views

How to edit the capabilities with python when publishing map services

Publishing map service the normal way is done here using arcgis desktop. But I decided to do it with python so I can automate the process or something like that but first off I need to edit some of ...
4
votes
0answers
21 views

“Merging” 2 layers of LineString with splits at intersections

I would like to "merge" 2 networks of lines and these lines need to be split when they intersect. With pictures it should be clearer : What to do: if a black line intersects a red line, they ...
1
vote
1answer
30 views

How to change time zone for netcdf file

For example, I have a netcdf file from WRF model, and its time zone is in UTM 00. I want to change the time zone to UTM 08, how to achieve that?
2
votes
1answer
50 views

Clean way to identify color scheme in Python QGIS

When I do in the Python QGIS console QgsColorSchemeRegistry.instance().schemes(), it returns the following [<qgis._core.QgsColorScheme object at 0x7f6cc5d8ccc8>, <qgis._core.QgsColorScheme ...
3
votes
3answers
116 views

Flow Accumulation Python or MATLAB Script

does anyone have any resources for scripting the D8 flow accumulation in Python or MATLAB after obtaining the flow direction values and filling in 'sinks' and 'flats'? I am trying to understand the ...
1
vote
2answers
119 views

Determining Min and Max elevation in Python using GDAL? [closed]

I have a DEM file and shape file of specific area ,and i want to Create a module in Python that writes name of each area which is shows in the picture, with the greatest differences in altitude on ...
0
votes
1answer
52 views

import SIP module. QGis 2.12 win 10 64bit. By book: Building mapping applications with QGIS

i have bought the book "building mapping applications with qgis" from eric westra. Currently i'm following the steps described in the book. But at the verry first trial of an external app i get an ...
3
votes
1answer
38 views

QGIS and python: Keep a layer always on top of the others

I am working on a python plugin for QGIS using a layer containing linestrings, which I would like to have on top at all times. I have added the layer like the following: ...
3
votes
1answer
74 views

Optimizing Python GDAL ReadAsArray

I am using the GDAL ReadAsArray method to work with raster data using numpy (specifically reclassification). As my rasters are large, I process the arrays in blocks, iterating though each block and ...
4
votes
1answer
56 views

Cannot correctly iterate IFeatureCursor (calling ArcObjects from Python)

I have started recently using some of the ArcObjects inside my Python modules. Having all the useful posts and insights shared by @matt wilkie et al, I was able to get started pretty quickly ...
1
vote
0answers
15 views

python - Composer plugin menu catch-22

a plugin for the Print Composer checks if the current project has at least one Composer when loading to avoid the error when creating the menu on a Composer that doesn't exist. However, once the ...
2
votes
1answer
53 views

scripted new items don't show up in the “items” panel on Print Composer

I'm working on a plugin to put items (pictures, arrows, labels) on the Print Composer layout. Everything is fine with the exception that once they are drawn, none of these show up in the "items" panel ...
1
vote
1answer
49 views

Using pysal to map location of coordinates?

I am trying to map which county a set of coordinates I have are in. I want the code to go through each coordinate, check which county it is in, and then print the corresponding county. However, ...
0
votes
1answer
25 views

QGIS2Leaf fails with AttributeError: 'QgsMarkerLineSymbolLayerV2' object has no attribute 'penStyle'

Can anyone tell me what this means? and what I have to do to get it done? I'd like to export my map from QGIS to use as a webmap. Data is from a postGIS database. Fehler bei der Ausführung von ...
1
vote
1answer
92 views

Python Gdal ERROR 6: GEOS support not enabled

I installed GDAL from here (https://pypi.python.org/pypi/GDAL/1.9.1) Before attempting the python GDAL I installed the prerequisite gdal libraries using Kyngchaos's description some time ago ...
3
votes
1answer
112 views

PyQGIS - polygon to lines with geometry length and select features with condition

How can I make a script to convert polygon layer to explode lines ? After that I need to get geometry length for conditioned features. I have a part of code ? import processing ...
1
vote
1answer
91 views

shuntil.rmtree() deleting directory gdb instead of files within directory gdb

I want to use the shutil.rmtree() to remove files from a scrap geodatabase. Before adding it to a stand alone script I tried it out in an interactive session and got two different results. The first ...
0
votes
1answer
32 views

Changing date format of feature class with ArcPy? [closed]

I thought this was fairly straightforward; however I am receving NameError: name 'dt' is not defined. What is being done incorrectly? My orginal timestamp is m/d/yyyy h:mm:ss i would like to change ...
1
vote
0answers
31 views

Implementing Python script in QGIS with input variables?

I would like to implement this script in QGIS: How to draw perpendicular lines in QGIS? and be able to choose input data from the layers in my map, and iterate over them. The script from the link ...
1
vote
1answer
477 views

Cannot load maps using OpenLayers plugin in QGIS

I'm currently using QGIS 2.12.1-Lyon. I have installed the OpenLayers Plugin (and updated to the latest version, v1.3.6). However, when I go to load up base maps in QGIS using this plugin (go to Web | ...
0
votes
0answers
53 views

How to combine owslib->WebFeatureService with urllib2->ProxyHandler in Python?

In Python 2.7, I try to do a WFS request from behind an authenticated proxy server (proxy requiring username/password). I managed to communicate to a webserver via the authenticated proxy using a ...
3
votes
1answer
97 views

Split feature by line in PyQGIS

My objects are a polygon and a line. I want to split my polygon according the line. I have used reshapeGeometry and splitGeometry with no success. ReshapeGeometry returns 0. Polygon-foo foo = ...
1
vote
1answer
29 views

python plugin menu action in Composer menu

I'm new developing plugins for QGIS and am working on a plugin to add some pictures on the Composer layout. I think the appropriate place to have the plugin menu action is in the Composer menu where ...
1
vote
1answer
59 views

Given a collection of polygons, how do you find which one contains a given point? Java or Python

I'm looking for Java or Python libraries that will help me answer this question efficiently: given a collection of polygons (via shape files or GeoJSON), which one of them contains a given point? The ...
1
vote
2answers
149 views

How to select by attribute and loop through values to GetCount per month with ArcPy?

I would like to write a script where I select a layer by the [District] attribute and loop through the field [PickUpDate] to get the count per district per month. My month format is m/d/yyyy, i.e. ...
1
vote
1answer
48 views

Random sample from selection

I have a selection in vector point. I would like to do random sample from it. I am using qgis to do it. Here is my selection code: ...
0
votes
1answer
104 views

Fastest way to join many points to many polygons in python

I need to attribute a geographical area (based on shapefile polygons) to 8 million GPS points. There are 405 polygons. I currently have the code below, and a quick extrapolation tells me it will take ...
2
votes
1answer
64 views

Load a GeoJSON layer with QGIS's Python module

I have been able to load a GeoJSON file into QGIS by simply clicking "Add Vector Layer", and selecting my file to load. Now I'm using the qgis.core Python package, and I'm trying to load the GeoJSON ...
2
votes
0answers
26 views

QGIS plugin window qt creator formatting ineffictive

I am developing a QGIS plugin. I have assigned the QGIS main window as the parent window of custom plugin using: QtGui.QDialog.__init__(self,iface.mainWindow()) But after doing so the problem ...
1
vote
2answers
37 views

Split on a dash in python

SO I am looking to do a split on a attribute that looks like 45-4. Now all the attributes have values. here is my code so far: import fme import fmeobjects def processFeature(feature): f_type ...
1
vote
0answers
36 views

Using Python Opensource Libraries to check users who visited a store [closed]

I have a few files with location information: 1) User Lat Long Pings in Parquet Files (can be converted to CSV) format - this contains userid, timestamp, lat and lon 2) US County/State Shapefile 3) ...
1
vote
0answers
40 views

Installing Rtree on Windows 7 Python 35

I tried installing Rtree on Python35 on my windows 7 machine using the pip install command but ran into this error: OSError: could not find or load spatialindex_c.dll I also tried this and it gave me ...
1
vote
0answers
14 views

QgsCategorizedSymbolRenderer default ramp colors

I have a plugin and I want to symbology a vector file with some default ramp colors but I see that in graduated symbology is not so easy as in graduated symbology. Is it possible to assign a default ...
0
votes
1answer
64 views

ArcMap 10.3.1-Attribute Table Sorting Issues

I have received a shapefile from a third party that contains a column of alphanumeric characters. ArcMap has it listed as a 'string' in the field properties. The numbers range from 1-6000 with a ...
1
vote
1answer
62 views

GDAL Python OGRFeature .GetGeometryRef vs .Clone().GetGeometryRef

Just recently I was trying to get the geometry of a polygon stored in an ESRI Shapefile. In the script I was trying to read the polygon as follows: import ogr path = "shape.shp" ds = ogr.Open(path, ...
0
votes
0answers
42 views

Number of polygons in shapefile too high

I downloaded administrative shapefiles from www.gadm.com/country (China). The Python (Basemap) code below tells me that there are 2365 polygons in it. However the .csv and .dbf files included with the ...
2
votes
0answers
77 views

NetCDF to Shapefile with Python and GDAL?

I need to save my outputs, which are netcdf files or panda python tables, to shapefiles. They cannot be rasters because the software I am loading them into accepts shapefiles only. I have googled ...
5
votes
1answer
253 views

Using Python to discriminate Personal Geodatabases and MS Access Databases

I need to list a server's geodatabases, to analyze and process them. My users are however creating both personal geodatabases and MS Access geodatabases. Listing mdb files reports both types of ...
0
votes
1answer
24 views

ez_setp.py: how to download the package to install for future install from disk?

I'm using ez_setup.py to install pysal for QGis, by using the command: easy_install pysal (I followed the following post: http://anitagraser.com/2014/07/13/installing-pysal-for-osgeo4w/) I have to ...
2
votes
1answer
56 views

Polygon split with defined area

I have polygons with interpolated data like on the picture on right. Now I want to split this polygon into smaller polygons with predefined similar area. Positions of these smaller polygons must be ...
3
votes
0answers
61 views

spatial index intersection with qgsrectangle only computes polygones

I have the problem, that i only get polygon features inside my defined rectangle. If i switch off my polygon layer(s) i get my lines. TOC: Line-Layer on, Polygon-Layer on: i only get Polygons which ...
2
votes
0answers
39 views

Button to run Python Script on Custom Form Open QGIS

I'm very new to QGIS and Python (although years ago had some programming experience with C++), but have been muddling through with a fairly large project cataloging cemetery plots at the moment. I ...
3
votes
1answer
93 views

Has the “Warp (Reproject)” tool changed in QGIS 2.12?

I am writing a QGis plugin, for QGis 2.10, which imports processing 2.10.3, that needs: testproc = processing.runalg('gdalogr:warpreproject', thisName, # input ...
0
votes
1answer
15 views

Clearing Calculate Value before Model Run in ArcGIS ModelBuilder?

I am using ArcGIS 10.2 for Desktop. I have a model which contains several branches, which branch should run is based on the results of an earlier stage in the model. If the first stage of the model ...
3
votes
1answer
51 views

Extending QgsRasterResampler in python

I'm developing a Qgis plugin to use my own raster resampling method rather than what is provided in Qgis (cubic/bilinear). And so, I've extended the QgsRasterResampler class. However, I'm having ...
3
votes
1answer
47 views

When validating geometries, what are “Nested shells”?

I am validating shapefiles polygon geometry using shapely, and have also attempted it using FME. Some polygons return the error "Nested Shells". I cannot find a definition of what the problem is, ...
0
votes
0answers
39 views

Using peewee ORM with spatialite databases?

I would like to use the peewee orm in front of some Spatialite databases. Getting peewee to connect to a Spatialite database was relatively simple, and basically boiled down to: class ...
1
vote
3answers
58 views

Clip one folder of shapefiles by another with same name endings

I have two folders with shapefiles: r'E:\SO\Polygons' and r'E:\SO\Districts' Within each folder I have 215 shapefiles named with similar naming conventions: poly_100 or dist_100. I need to clip the ...
2
votes
0answers
28 views

QGIS, add a layer (shapefile) to a running QGIS from an external application

I'm trying to load a shapefile as a new layer into a running QGIS application using python within a Windows command shell. The python is basically what is explained in this post: How to open a layer ...
1
vote
1answer
40 views

PyQT: QFileDialog keeps on opening window after clicking on cancel or ok

I use to write QGis plugins, which is based on PyQT. I use to create QButtons and connect their click to a function that itself calls a QFileDialog. For example: def doOpenFile(self): fname ...