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

learn more… | top users | synonyms

3
votes
2answers
122 views

assign a number for each group in field calculator

I have several thousand features each of which has a name. The names are not unique. what I want to do with the field calculator is assign a number to each name so I can refer to a number and always ...
2
votes
1answer
42 views

Get intersection of circles shapely

I have a List of Points which I transform to circles. Code from here circles = [Point(random.random(), random.random()).buffer(random.random() * 0.1) for i in range(3)] I want to know which circles ...
0
votes
1answer
42 views

Python-ArcObjects mxDocument Stand Alone

if I need to work with classes MxDocument with the MapDocument that I have selected to work , for example style gallery, How can I instantiate ? InitStandalone() pMapDoc = ...
1
vote
1answer
233 views

Is it possible to embed python in code for HTML pop-ups in ArcGIS

When clicking a point feature I want the html pop-up to not only contain the data of the feature but also an image of the area around the feature (eg. 2 km^2). The image would have the base map 'World ...
1
vote
1answer
635 views

Debugging 'module' object has no attribute 'SdeWorkspaceFactory'?

I am new to python, am debugging one of existing python code, where am facing an error "'module' object has no attribute 'SdeWorkspaceFactory". Earlier this code was working fine but suddenly does not ...
5
votes
1answer
142 views

Python and ArcObjects- Stand Alone open MXD

I wrote a Python function using comtypes to access ArcObjects to programmatically change the size of layer symbols in an MXD. The function works great in the Python window of ArcMap. However, I need ...
2
votes
1answer
112 views

Trying to generate a PDF for each feature in a feature class based on an attribute with Python.

I have a feature class of points that represent storm water inlets. I am trying to automate a process that does the following. finds all of the inlets that have a field called "Marker" populated ...
9
votes
2answers
826 views

Histogram Matching using Python to improve mosaicking process of multiple overlapping rasters?

I am trying to do histogram matching using Python to improve the mosaicking process of multiple overlapping rasters. I am basing my code on that found at: ...
0
votes
2answers
34 views

Trouble getting shapely to run

I downloaded the GDAL complete Framework von Kyngchaos which also includes the GEOS Framework and shapely for python. I can import shapely without a problem, but when I try to perform some "geo ...
4
votes
2answers
50 views

How to get layers in x number of subgroups?

I have a project which has dozens of groups and subgroups. E.g.: Main_Group > Sub_Group_1 > Sub_Group_1A > Layer_1A > Layer_2A How can I access ...
2
votes
0answers
29 views

QGIS Function Editor/ Python question

I'm currently using the layer_property(layerName,'source') to produce a list of copyright statements for the Print Composer by putting that in an if() statement. However, that isn't very flexible as ...
1
vote
0answers
30 views

Eclipse PyDev has quit recognizing QGIS objects

I followed the instructions for setting up Eclipse with PyDev to start creating QGIS plug ins found here: http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/ide_debugging.html after doing ...
3
votes
2answers
57 views

Label and symbol with condition in layer properties under style tab

I have forest areas. I want to put tree.svg with condition. Layer properties-> style-> background -> shape ->svg Something like this: if (myfield<1300 , then show, ...
4
votes
1answer
40 views

Getting pixel values at single point using rasterio

To get a single pixel value at a point in a raster using rasterio, there is an example here: https://github.com/mapbox/rasterio/pull/275 However, is there a direct API within rasterio (and not the ...
3
votes
1answer
45 views

Update ID Field Using Common Types

Not exactly sure how to word this, but hopefully I do it in a way that accurately conveys what it is that I'm trying to do... I'm using Manifold GIS for this particular project, but I'm open to any ...
3
votes
3answers
49 views

How to get appropriate CRS for a position specified in lat/lon coordinates?

I have a set of city networks whose coordinates are specified in lat/lons. I wish to run an algorithm on each network that treats them as a planar graph. I'm using python and can use pyproj to project ...
1
vote
0answers
54 views

qgis python: select on screen and change (pre-set) properties accordingly

I have a map with different zones where I have drawn isochrones -where I will arrive within 15 min, within 30 min and so on. The picture attached shows the 15-120 min isochrones. This is set as a ...
0
votes
1answer
79 views

Python: Trying to figure out Geopy in python for reverse look ups

I am trying to test the following code on my system but I cannot get the correct output. Is this code correct for using geopy with GoogleV3? If so, how can I return country and continent name? ...
3
votes
1answer
693 views

Extract data from netcdf using a shapefile polygon in python

I need to subset data from a NetCDF using a specific shapefile. The data are sea surface temperature and ocean color at 1/4 degree resolution. I have 4 polygons describing the US. Northeast ...
7
votes
0answers
218 views

Automating creation of ServiceDefinition from Python script tool of ArcPy without broken project data source?

Summary: I can create a ServiceDefinition through ArcCatalog or ArcMap, but when I try to generate the ServiceDefinition through python, it does not copy the /data folder with it, thus the script ...
2
votes
2answers
181 views

How to iterate over layers and export them as PNG images with PyQGIS in a standalone script

I would like to export specific layers as a png from a QGIS .qgs map. From the table of contents the script would first export the "boundary, climits, and Div1_Irrig_1956_0" layers as one png. The ...
0
votes
2answers
36 views

Casting between PostGIS types in GeoAlchemy

I'm working with OpenStreetMap data, and loading it into a PostGIS database using osm2pgsql. The issue that I am currently dealing with is that osm2pgsql stores the shape as a geometry type. I'm ...
10
votes
1answer
207 views

Birch algorithm does not cluster as expected

I'm using Birch algorithm from scipy-learn Python package for clustering a set of points in one small city in sets of 10. I use following code: no = len(list_of_points)/10 brc = ...
0
votes
2answers
402 views

Conducting geographically weighted regression on a raster

I have a relatively big raster file on which I want to conduct geographically weighted regression. Size of raster ~ 2 GB and number of rows is around 100,000 One way might be to convert from raster ...
0
votes
1answer
1k views

OSRM API - nearest point fed into routing

I am using the OSRM API to (1) determine the nearest point on a road segment from a give random point with http://server:5000/nearest?loc=_lat_,_lon_ The returned coordinates are used then as an ...
2
votes
2answers
100 views

Using zoo-project WPS service in QGIS WPS-Client

I've created a python wps service in the zoo-project framework, which is used to calculate a Line of Sight based in on a start point, an end point and a start point height. The service works fine if i ...
0
votes
1answer
21 views

gdal writeArray causes appcrash at end of python script

i'm using OSGeo4W64 (gdal 2.0.2-8) with Python 2.7.5 on Windows 8.1 64bit. Editor is PyCharm 2016.1.2. I want to save an image with gdal, but i always get an error when the python script is complete. ...
0
votes
0answers
21 views

Points within a circle in Python - geoindex

I'm trying to use the geoindex package to perform a nearest neighbor query. For example, I have this two coordinates (in the real case I have a lot more): (40.607255, -73.75083) (40.7261465 ...
0
votes
1answer
60 views

Why can't I run .tif file with GDAL?

I am trying to extract data from a geotiff file in the Ubuntu terminal. My professor used the command "gdal NDVI.tif" and was able to write the data to a text file. When I use that command, I get the ...
1
vote
1answer
16 views

Matching Python and GRASS projection

I have a colleague producing maps with the following Python Basemap projection: from mpl_toolkits.basemap import Basemap m = Basemap(width=6000000,height=3900000, ...
2
votes
0answers
19 views

Writing 3 channels to 8-bit TIF in Python using gdal

I have some Python code to write 3 channels to file. Here, channels is an array of 3 numpy 2D-arrays (RGB), outfile is the filename, and rows and cols are the image dimensions. def ...
1
vote
0answers
27 views

Python GDAL open dataset in PostGIS with quotations

Error trying to use gdal to open a dataset in PostGIS with the following code: ds = gdal.Open("PG: dbname=nyc host=localhost user=postgres password=mypassword port=5432 mode=2 schema=public ...
1
vote
1answer
43 views

How to pythonically set a symbol as an ascii character (Font Marker) in QGIS

I need to set a point on a map as an ASCII symbol with python. I'd like to do this in a rule based renderer. something like: rule.setSymbolAsFontMarker("✫") So I'd have something like this in my ...
2
votes
0answers
78 views

arcpy.AddIndex_management error for in_memory variable

I am trying to optimize a script that uses addJoin_management. To do this efficiently, I am attempting to add an attribute index on the join table. I am getting a generic error when i do this though. ...
1
vote
1answer
136 views

How to use gdal.openEx with flags and parameters?

I'm new in python. I have a class which opens SXF format, and i want the last string self.sxf_ds = gdal.OpenEx(self.sxf_path) to be opened with flag 'GDAL_OF_VERBOSE_ERROR' but the nOpenFlags is ...
0
votes
2answers
498 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 ...
1
vote
0answers
23 views

Using “Ruled Based Render” to display labels without the marker with python in QGIS

I'm writing a script to load and manipulate some shapefiles. Unlike my previous question I now need to display labels only on certain zoom levels. My usual result is that the previous formatting gets ...
2
votes
1answer
127 views

Open a NetCDF file with multiple time step on QGIS (using Python console)

How to load a NetCDF-file into QGIS using Python? explains well how to load a NetCDF with PyQgis. However, it did not help me to choose among all the available time steps. Is there a way to import a ...
3
votes
2answers
3k views

How to load a NetCDF-file into QGIS using Python?

I have a CF-conform NetCDF-file which can be loaded into Quantum GIS (Version 1.8) by using the "Add Raster Layer"-button and subsequently choosing the file and the raster layers of interest. This ...
3
votes
2answers
300 views

Trying to use Tkinter to open dialog box in ArcMap

The following script works great from the command line but crashes from the pythonaddin: import Tkinter import tkFileDialog root = Tkinter.Tk() root.withdraw() pathtest = ...
1
vote
0answers
36 views

Python error in Qgis 2.14.0

I'm trying to build virtual raster (catalog) following instructions from the documentation in QGIS.. It appears the following error in python code: 2016-04-17T12:13:07 1 Traceback (most recent call ...
1
vote
1answer
26 views

Parameters for osm2po web service to route for walking

I have started the osm2po web service using the jar file. In the configuration file, I could see different parameters related to walking but not sure what each one does. I am trying to call the web ...
6
votes
2answers
2k views

Python script using SAGA and arcpy for converting 'on the fly' LAS point cloud to shapefile?

Summary: I have created a process to import a LAS point cloud, clip it, select the ground points and save the output as an XYZ.txt for clients to use. This uses a python based script (will become a ...
2
votes
0answers
266 views

pyQGIS 2.0: Sending signal when identify button is pressed via gui

I have a question regarding the qgis identify tool for version 2.0. I would like to know if it's possible to send a signal when the actionIdentify is triggered by the user via the gui. I'm trying to ...
-4
votes
0answers
30 views

Path used to save file

on another post, someone gave me some code to save a raster to .tif, but I was never able to save the files, and the person who shared the code said it worked for him. I noticed that in the path I ...
1
vote
0answers
32 views

ogr2ogr - Shapefile database SQL query; missing .cpg and .xml

I am using gdal and ogr2ogr to perform a SQL query on a database of shapefiles with the code below. The geoprocessing works and the appropriate shapefile is extracted from the query, but when I print ...
1
vote
0answers
17 views

QGIS plugin 'Module' object has no attribute 'classFactory'

I am trying to learn how to make QGIS plugins and have been trying to follow tutorials such as this one; https://anitagraser.com/2014/04/26/getting-started-writing-qgis-2-x-plugins/ but I keep ...
2
votes
2answers
559 views

How to convert latitude, longitude to EPSG 3857?

I'm looking to study the math involved to see how a given latitude and longitude in decimal degrees can be converted to epsg 3857. Can anybody point to a good reference or a possible python/c/c++/java ...
14
votes
4answers
13k views

How to convert projected coordinates to lat/lon using Python?

I assume this is a basic question but I can't seem to find or recognize the solution. This site returns Point: X: -11705274.6374 Y: 4826473.6922 when you searching with the first key value of 000090 ...
1
vote
0answers
18 views

Python plugins not available, OS X 10.10.5, QGIS 2.8.4

I’m using OS X Yosemite 10.10.5 and QGIS 2.8.4 Wien. My mainproblem is that python support is disabled and I can’t use python plugins. QGIS seems to act fine and I’ve done a lot of work with QGIS. ...