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

learn more… | top users | synonyms

3
votes
1answer
23 views

How to replace a string with a variable inside a pgsql2shp command in Python

How to replace a string with a variable inside a pgsql2shp command in Python command = "pgsql2shp -f /test.shp -h localhost -u postgres -P postgres gis_exercise \"SELECT d.latitude, d.longitude, ...
1
vote
1answer
40 views

How to select attributes by unicode field value?

I have an attribute table in QGIS 2.10 with a string field (myfield) and when I want to make a selection based on the unique values of this field I get no selection at all. >idxmyfield = ...
2
votes
1answer
69 views

Using Proj.4/GDAL to convert lat,lon to i,j

I'm working with a data set in GRIB2 format and need to determine the grid cell index (i, j) corresponding to a given lat,lon. I have the projection definition in the form of projparams as follows: ...
3
votes
1answer
66 views

PyQGIS - Densify geometries given an interval

I have question, is it possible to make python command for QGIS function "Densify geometries given an interval": input layer: Polygon.shp output layer: Densify_interval.shp interval: 50 meters ...
0
votes
0answers
30 views

Accessing Geoserver plugins through the REST API

I am writing Python scripts to automate the creation of Geoserver layers. For this the gsconfig module has been invaluable, but I often need to execute operations that are handled by plugins, most ...
1
vote
0answers
41 views

Upper limit to number of GeoTiff tiles?

I'm using the GDAL SWIG python bindings to create a new GeoTiff raster for use in a blockwise exponential-decay function. kernel_size = 177764054 driver = gdal.GetDriverByName('GTiff') kernel_dataset ...
0
votes
1answer
46 views

Convert coordinates to census tract for large dataset

I have about 20 million sets coordinates from the Philadelphia, PA, USA region. For each set of coordinates I would like the FIPS code of the corresponding census tract. I looked at this thread: ...
1
vote
1answer
37 views

Batch Clip shapefiles by filename or attribute using Python? [closed]

I used a Split Layer By Attribute tool I found online to split a feature class into 90 different shapefiles. These were outputted to a folder with the name for each shapefile ending in a 5 digit ...
0
votes
0answers
31 views

ArcPy FeatureCompare vs. FileCmp

I have a huge number of shape files that I receive on a recurring basis. I want to be able to compare the new version to the current version, and then only update the db with those that are different. ...
0
votes
0answers
40 views

Intersect using Open Source GIS [duplicate]

I have a CSV containing user locations (has lat, long, userid, timestamp). I have a countries shapefile (has country name, geometry - got this from thematicmapping.org). I am trying to append a ...
0
votes
0answers
43 views

Call qgis function from R?

Is there a package to call QGIS functions directly from R? Is rPython the best alternative?
0
votes
2answers
42 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
32 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
51 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
119 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
122 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
54 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
39 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
76 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
58 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
51 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
100 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
114 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
498 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
61 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
153 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
49 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
108 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
65 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 ...
2
votes
2answers
38 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
37 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
41 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
15 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
65 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
63 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
44 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
80 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
255 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 ...