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

learn more… | top users | synonyms

2
votes
2answers
986 views

Having trouble getting specific items from a list. What am I doing wrong?

I am a total beginner when it comes to python. I received some help already getting this code started but I hit a wall. I have a directory with 200 folders, each with a geodatabase, feature dataset, ...
2
votes
1answer
374 views

Use arcpy.SearchCursor with raster

How can I efficiently subdivide one raster into multiple rasters using the arcpy.SearchCursor? For example if I have a slope and I was to subdivide into 3 rasters: slope1 with values between 0 and ...
2
votes
2answers
318 views

What are my hosting options for an app that needs tilestashe along side a django app?

I'm building a GIS webapp that uses tilestache to serve MBTiles and a django app to serve geoJson. I'm having trouble understanding exactly what kind of setup I'd need to host this. I'm new to server ...
2
votes
1answer
669 views

How to switch to a GDB created in the middle of a script

EDIT: Here's my full script and hopefully a better way of explaining what I need done: #Import import arcpy, sys, os # Set environment settings arcpy.env.workspace = sys.argv[1] inFiles = ...
2
votes
2answers
1k views

How to set up a plugin repository for QGIS?

I am working with python plugins for QGIS.I developed my plugin and created .zip file including my .ui,.py and resources files.In order to incooperate this plugin into QGIS i created .xml file ...
2
votes
1answer
255 views

Query for Selecting only Selected Fc's from a GDB

I need to version n number of fc's which start with sde."ENT-QA". I need to select only those feature classes and run versioning for it. Can anyone help me in writing the query for selecting only fc's ...
2
votes
2answers
642 views

Parameterized insert query to PostGIS fails

I have a PostGIS database table that I need to insert data into. I'm using Python 3 and the pg8000 interface to Postgres. Somehow, parameterized inserts do not work. If I do iq="INSERT INTO ...
2
votes
1answer
631 views

Running C# code from Python tool for ArcMap?

It appears that the only way to copy individual rows of data while preserving GlobalIDs in code is by using C# or VB.NET. I need to run the C# code from the above link within a python tool, and I am ...
2
votes
2answers
1k views

Automate creating Rectified files from georeferenced images

A python 2.6.5 / ArcGIS 10 solution is preferred. UPDATE: I found a tool to do this "Create Ortho Corrected Raster Dataset" but the python script for it gives errors when I try. import arcpy import ...
2
votes
3answers
714 views

Definition Query to Python script on Oracle 9i and ArcGIS 9.3.1

SUBTYPECD=1 AND SERIESNAME NOT LIKE '%-%' AND OPERATIONALSTATUS IS NULL OR SUBTYPECD=1 AND SERIESNAME NOT LIKE '%-%' AND OPERATIONALSTATUS = 976 The above is my def query in ArcMap against ArcSDE ...
2
votes
1answer
1k views

Area units for GEOS area property?

I'm working with GeoDjango and have a polygon in the WGS84 projection. I need to find its area in square meters. When I call polygon.area, I get some float out and I have no idea what the units of ...
2
votes
2answers
2k views

Recoding values based on contents using ArcGIS Field Calculator or Python?

Is there a convenient (or even effective) method for recoding field values using the field calculator or standalone python script? In this case, I am given several unique strings to identify a type ...
2
votes
2answers
878 views

Any python script to convert a geoPDF to a KML embedded with a jpg link?

I have many geoPDFs. I want to turn them into KMZ or KML+JPEG using a python script. Any suggestions? SEE CODE BELOW
2
votes
2answers
569 views

ArcObjects table views or SQLite3 in Python?

Given a larger csv (1000+ points) with attributes, I need to do both attribute and spatial queries on the data. Would it be faster to read the points into an xy feature class, and do the spatial and ...
2
votes
2answers
39 views

Sort Column and Sequentially Number Separate Column

I am trying to sort (alphabetize City) a column, and sequentially number a separate column for the purpose of labeling and creating a map key. What is the best way to do this?
2
votes
1answer
32 views

Using zonal_stats with python in QGIS to calculate statistics for each image

I work with Python in QGIS, I want to calculate statistics for each image that I have with a specify shapefile and save result after, I tried to do like this: from rasterstats import zonal_stats ...
2
votes
1answer
30 views

Raster brightness, contrast, saturation in PyQGIS

I'm trying to find a way to change these properties (especially contrast and brightnes) and I've found a QgsBrightnessContrastFilter class, but I can't fugure out how to apply it to my raster layer. ...
2
votes
1answer
77 views

Delete all fields with the string “RAWI” using QGIS Python

I would like to delete all fields with the string "RAWI". For instance the field "RAWI_WA" and the field "RAWI_BO" should be deleted but not the field "NSG_RAW"
2
votes
1answer
21 views

Store geometry Qgis feature creation

I make a form that has a textEdit wich stores the length of a line. How it is possible to store the length of the new created line and put it in the textEdit, when form appears?
2
votes
1answer
43 views

Creating custom forms in Arcmap 10.3

I am hoping to make a custom form within ArcMap 10.3 where the end user can select a recently digitized shape file (or feature), and enter values of specific attributes through a custom form. This ...
2
votes
2answers
50 views

Creating a list using an attribute query with arcpy.da.SearchCursor

I have a shapefile of a river network containing the following fields: toJunction, fromJunction, Int_DAM (which indicates free-flowing status) and Strahler. I'm trying to create a list of the rows ...
2
votes
1answer
34 views

Why is the first element of my WFS layer None instead of a feature?

I have made a WFS connection and got a layer from it. I want to use the first feature from that layer. driver = ogr.GetDriverByName("WFS") wfs_url = "WFS:http://example.com/wfs" wfs = ...
2
votes
1answer
35 views

Optimise Search within the QGIS API

I would like to ask you about the following code, it works, but I don't think is very helpful to have elif, elif,elif... always. Then, I have to optimise it. The problem is that I can't access to ...
2
votes
2answers
86 views

AttributeError: 'NoneType' object has no attribute 'split' from arcmap only

I'm running a simple python script from arcmap that sends an html post and processes the response. This script runs just fine from pythonwin but for some reason I receive the following error when ...
2
votes
1answer
37 views

Use ArcGIS for Server geocoding service results in QGIS (or another generic approach)

An ArcGIS for Server geocoding service can be used via http get (singleline geocoding for 'Jugendamt' [youth office]) ...
2
votes
2answers
58 views

QGIS explode lines from python script fails at alg.processAlgorithm

I've been trying to run QGIS procedures from python scripts via terminal on Ubuntu (ultimately I want to automate a process via cron). The first task I have tried to script is the "explode lines" ...
2
votes
1answer
24 views

Count Lat Lon Data Points Lying Between 2 Azimuths

I need to count the number of points (LAT, LON) from a cvs file that exist inside an arc defined by 2 azimuths. Ultimately it will need to be iterative where the arc defined by the 2 azimuths rotates ...
2
votes
3answers
74 views

Can not Run function when item selected in comboBox. Pyqgis. QGIS

I'm writing a plugin, I want to change the content of a comboBox (fields) depending of the content of another comboBox (layers). My plugin is a dockwidget. I can populate the fields comboBox just ...
2
votes
1answer
60 views

pyQGIS segfault

I am trying to get started with pyQGIS but failing pretty hard. Trying to follow http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html A lot of it seems incomplete for Windows ...
2
votes
1answer
18 views

Trying to get PRECISE vector coordinates using geom.asPolgon

I've got a bit of a problem. A script I've written is trying to get the coordinates of every vector in a layer, which is MAINLY working: output_file = open('c:/myfile.txt', 'w') layer = ...
2
votes
1answer
40 views

How to set CRS for a DXF file and prevent any warning on QGIS using pyQGIS?

I am trying to import dxf file with no warnings or popup from Spatial Reference Selector. However, even after modifying QGIS Spatial Reference Selector setting, I still get a qgisMessagebar warning. ...
2
votes
1answer
75 views

aggregating using 'gdalwarp -average' resulting in incorrect values

I'm trying to aggregate data up from 0.05 to a coarser 0.25 resolution and am having trouble getting gdalwarp to work correctly. From comparing the original input data with the aggregated data and ...
2
votes
1answer
60 views

Get LineString length in meters (Python, GEODjango)

In a Django model, I have a LineString field which holds GPS coordinates of a street route. I know that I the .length holds the length of the LineString, but I don't know what unit the returned value ...
2
votes
1answer
43 views

Convert CSV file format to Breakline CSV format file [closed]

I have a csv file with almost 36000 rows.The format of csv file is x,y,Polygon number, Z I would like to arrange this csv file in the below mentioned format. Let’s say in this example, Polygon ...
2
votes
1answer
36 views

Encode an azimuthal equidistant projection in NetCDF conversion

I'm trying to do Azimuthal Equidistant in CF-compliant NetCDF, but I didn't get the correct projection. If you compare the first two information (gdalinfo) you see there is no AUTHORITY and also ...
2
votes
1answer
36 views

Importing Several Raster Layers, Doing Manipulations and Exporting The Newly Saved Rasters

I have the following code: src_ds = gdal.Open("/home/usr/Desktop/RasterFolder/Name.tif") if src_ds is None: print 'Unable to open %s' % src_filename sys.exit(1) myarray = ...
2
votes
1answer
69 views

QGIS - PYQGIS Import gpx as vector layer

I'm trying to use the python console to import some gpx files as vector layers. When I do it manually I have to choose which layers to add, my options are: I've tried various versions of the code ...
2
votes
2answers
72 views

Is there a size limit when adding features to ArcGIS Server programatically using POST?

I'm inserting new points using the ArcGIS Server REST API addFeatures method - this is working correctly. However, I'm finding that when the JSON reaches a certain (undefined) threshold the POST ...
2
votes
1answer
40 views

Actions undertaken in QGIS somewhere stored as Python code in a history file?

For practioners that are not willing to study all the methods for each class, it would be helpful if every action that was made within the QGIS interface can be looked up afterwards in a history file ...
2
votes
2answers
105 views

How to add attribute table to new shapefile using OGR?

i have made a new shapefile from the original shapefile , and now i want to copy the attribute table from the original shapefile to the new select shapefile , but i don't know how to do that? import ...
2
votes
1answer
56 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 ...
2
votes
1answer
55 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 ...
2
votes
1answer
96 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
1answer
144 views

Loading layer from ComboBox in QGIS?

I made a plugin what has multiple combobox but i have problem with the information load from the second combobox it depends on the combobox 1st. In the first combo box, i can choose layers from the ...
2
votes
2answers
115 views

Seg Faults and Instantiation Errors while running PyQGIS on OS X

I'm having issues getting off the ground with running PyQGIS on my OS X. I'm frankly very confused as some errors occur sporadically while executing the same code. When I try the following: ...
2
votes
3answers
61 views

Keeping my own additional Python layer information for potential further usage in QGIS

I wrote a plugin that selectively loads simulation data to QGIS. That works fine, but the overhead to convert the data from my own format to QGIS takes a long time, as I have to generate an index and ...
2
votes
2answers
652 views

How to calculate the bounding box of a geojson object using python or javascript?

I have django app with leaflet on the frontend and I need to calculate the bbox of my geojson so that I can pass the coordinates to map.fitBounds() I have tried some libs as well as trying the ...
2
votes
1answer
271 views

Loading mod_spatialite using sqlite3 for Python in Windows

I have been successfully using the mod_spatialite extension for sqlite in Linux for a while now, but a client wants an application that relies on mod_spatialite to work in Windows. I have extracted ...
2
votes
1answer
194 views

Error memory on Viewshed Analysis plugin QGIS [duplicate]

My question is exactly the same as TTome! (Viewshed analysis plugin on QGIS keeps resulting in errors) "I've been trying to test the Viewshed analysis plugin on QGIS 2.10, but it keeps giving back ...
2
votes
2answers
166 views

Why is my EPSG:3068 to WGS84 projection not accurate?

I need to project EPSG:3068 (Soldner Berlin) to lat/long. It works fine with https://epsg.io/3068/map, but I'm looking for a way to do it with a Python script. I tried both pyproj and the epsg.io ...