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

learn more… | top users | synonyms

0
votes
0answers
10 views

How to open a shapefile using ArgParse in Python?

I am trying to open a folder of shapefiles along with their associated files (i.e. '.prj, .cpg' etc) using Argparse in Python. I'm not sure if the code below is a good place to start: parser = ...
2
votes
1answer
22 views

Convert CSV file format to Breakline CSV format file [on hold]

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 ...
3
votes
0answers
25 views

Merge RGB band using python

I need to merge the RGB bands of three TIFF images. I'm trying to use a PIL library (Python Imaging Library), but this execution error happens: Traceback (most recent call last): File ...
4
votes
1answer
54 views

Problem Editing a Vector Layer QGIS

I have a vector layer which I need to load and edit (add several attribute columns). I am doing this without opening QGIS, so within a python script. I have the following piece of code for the layer ...
1
vote
1answer
13 views

Unable to call otbApplication from python

I have been tryng to use some of OTB functions from python, but i am unable to import the module (otbApplication), even after to adding the PYTHONPATH to my basrc file. I am working in Ubuntu14.04, ...
9
votes
5answers
11k views

How to change feature class and field aliases in bulk?

I have over a hundred FCs, each with 10 or 20 attributes to add or change the aliases for, two or more times a year. Needless to say, this is not something I'm going to grunt my way through. How can I ...
5
votes
1answer
38 views

Stacking Vector Layers in TileStache

I am serving several vector tile layers of different geometries (point, line & polygon) in TileStache using VecTiles:Provider, with this cfgfile: { "cache": { "name": "DISK", ...
1
vote
1answer
41 views

How to see the 'example provider' in processing toolbox of QGIS?

I would like to create my own provider with the processing toolbox. I see the example provider in my folder C:\QgisWien\bin...\algs\ExampleProvider. It seems to be a good start but unfortunately, I ...
1
vote
2answers
212 views

How can I read MrSID files in Python (using gdal)?

I have to read a large number of MrSID images and process them in Python. I usually access GIS file formats using the gdal application and the gdal Python library. However, the gdal package for Python ...
-4
votes
0answers
39 views

Need help on this piece of Python code [on hold]

why this code doesn't work? It work if I replace R6G to G and m[0:3] to m[2]. def n(m): if "R6G" in str(m[0:3]): return '60_Green' else: return 'No Match'
0
votes
0answers
42 views

How to read shapefile faster using python basemap (and pickle)?

I am trying to plot a simple 'merc' map with boundary from shape file. The total size of the shape file ne_10m_admin_0_countries_lakes.shp is just 8mb. The simple mslp surface plot from GFS data took ...
0
votes
1answer
23 views

Problem with read_shp() in NetworkX

I'm trying to convert a shapefile of only line geometry (a street network) to a NetworkX graph to run some connectivity algorithms on it. I'm running into this issue: File ...
1
vote
2answers
87 views

How to use rsgislib python binds in windows environment

I am right now would like to use rsgislib to create a simplify remote sensing image processing application based on python. However I have no idea about how to use rsgislib in windows. Perhaps ...
2
votes
6answers
637 views

How to export attribute table with start and end coordinates of lines to Excel?

I am working in QGIS. I have a georeferenced line layer and I want to export the attribute table and the coordinates of start and end points of my lines to Excel. Can I do this with QGIS?
2
votes
0answers
44 views

ArcGis' python library (arcpy) are imported so long

python -c import time; t1 = time.clock(); import arcpy; print('{0} seconds'.format(time.clock() - t1)) 3.60283379862 seconds It takes this long each time i launch my script or test. Is there any ...
10
votes
1answer
2k views

Creating table containing all filenames (and possibly metadata) in File Geodatabase?

I need to create a metadata-table for all files in a File Geodatabase or Spatial Database. It would be awesome if it were possible to automatically be updated with new filenames, and possibly even ...
1
vote
1answer
17 views

GDAL Python: how to extract a cutline from VRT file in world coordinates?

I'm trying to extract the world coordinates of a cutline (clipping polygon) in a GDAL VRT file. Unfortunately, the cutline is stored in image coordinates (pixels), and i could not find the right ...
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
1answer
25 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 ...
0
votes
0answers
25 views

Choosing the right region of interest [on hold]

I am using this code in order to track the dog in this video. At first it seems to work but then window cannot follow the dog. I think the problem is the region of the window. I set the variables ...
2
votes
1answer
29 views

How to calculate a curve distance between two xyz points?

I have a curve surface (example is attached). Each node has its own coordinate in geographic system (longitude,latitude and depth). I want to calculate a distance between two nodes (from the one on ...
1
vote
1answer
37 views

Cut a linear feature according to the directions or azimuths

I have a shapefile linear that contains a single items as in the image and I want to divide it into several section respecting the azimuth and the line direction. i have this code : import os ...
3
votes
2answers
3k views

OGR Layer Intersection

I am using what I would describe as the most primitive method of doing intersection with OGR. The short script below describes how I do it. Is there a best way of doing this? from osgeo import ...
4
votes
4answers
3k views

Bulk convert DBF to CSV in a folder ArcGIS 10.1 using Python

I would like to convert 1000 dbf files to CSV. All dbf files are in one folder and they have sequential names (S:\output_tables\tcb1.dbf, S:\output_tables\tcb2.dbf, S:\output_tables\tcb3.dbf, up to ...
1
vote
1answer
37 views

Building QGIS 2.8.6 on Win 7 32bit?

I'm trying to build QGIS 2.8.6 on Windows 7 32 bit using MSVC Express 10. The build process completes without errors, but with a bunch of warnings. When I run the qgis.exe after installation, it only ...
2
votes
2answers
1k views

Automatically download Modis image using python script

I need download Modis imagery automatically from the website: https://earthdata.nasa.gov/. I found this link: http://gis-techniques.blogspot.com/2010/06/getting-modis-image-automatically-from.html ...
1
vote
1answer
86 views

Dose pyModis work with “ModisSwathTool” too?

I am going to use pyModis to work with MODIS data, Since I am quite new to Python, before starting to learn and use pyModis, I have a question for those who are familiar and using pyModis, right ...
3
votes
1answer
100 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 ...
1
vote
2answers
68 views

Cannot access MODIS Download from FTP using Python

I tried to access the FTP site of MODIS data using Python ftplib module but always fail to connect. I am connecting using: ftp = ftplib.FTP("e4ftl01.cr.usgs.gov") here is the error: A connection ...
0
votes
0answers
6 views

Extracting GDB files from zips - If exist, rename and move: If not, just move. Python [migrated]

Currently trying to develop a catch all script that when pointed to a folder it will look through all of the subfolders and anything that is a .gdb will be moved to a new folder, if the GDB files have ...
1
vote
1answer
36 views

Calculate Field throws an error when parsing python with backslashes

I have an FTP I need to access through a python script. It works fine with forward slashes, but I don't need it to be read as an html. Below are both sets of code: Working: ...
1
vote
1answer
260 views

GDAL and Python: How to “pad the extent” or otherwise handle band.ReadRaster() for area falling slightly outside the image bounds?

In a nutshell, I'm trying to create a bare-metal tiling utility using GDAL and Python. As you can see in the graphic below, which shows the perimeter of a raster and the OSM-structured tile index, ...
1
vote
1answer
79 views

Getting netCDF data into PostGIS database using Python?

I can read the netCDF file data with netCDF-python or with gdalinfo, but I am unsure of the easiest way to get it into a PostGIS database. It would be really easy if I could convert the netCDF file ...
1
vote
1answer
8k views

Find and replace, field calculator

Can someone show me a very simple find and replace in field calculator for just one or two characters in a field based hyperlink?
6
votes
5answers
2k views

Is there a way to disable code autocomplete in the Python window in ArcGIS 10.0

Autocomplete slows down my workflow in the Python window, especially if I am remoted into a machine. Is there a way to disable this? Alternatively, a way to disable this and then invoke as needed ...
1
vote
1answer
57 views

Can't write decimal data into shape (shp) attribute table with Python

I am trying to create a shapefile with Python GDAL/OGR library. I add to it a real number field, but when I write into it doesn't appear as it should but rounded. I will explain better with the code: ...
5
votes
1answer
411 views

Select and copy attributes features in ArcMap using Python add-in tool?

I'm trying to add a tool to an add-in toolbar to select features from an existing feature class and copy attributes to another feature class,from point to point. TopoHeight_Field_Name='Comment' def ...
1
vote
1answer
47 views

Moving file geodatabases in python without ArcPy

Please find my script below currently all i'm wanting to do is iterate through a folder and any subfolders extracting anything that is a .gdb directory + its contents to a new folder. import shutil, ...
41
votes
3answers
7k views

How to smooth the polygons in a contour map

Here is a contour map for which all the polygons of levels are available. Let ask how to smooth the polygons keeping all vertices preserved in their exact locations? Indeed the contour is made on ...
2
votes
1answer
30 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 = ...
8
votes
1answer
117 views

Mapnik failing through a webstack

I've inherited a pretty large / complex (internal) web portal (run under python 2.6.6), which has some mapping capabilities, using Mapnik 2.2.0. The web service has recently started throwing 500 ...
2
votes
0answers
43 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
31 views

Lookup Projection Name from EPSG with pyproj

Is it possible to programmatically lookup a projection's name (e.g. Albers Equal-Area) from its EPSG using pyproj? I see pyproj.pj_list, but it does not contain a mapping to the EPSG. Thanks.
0
votes
1answer
39 views

Analyze height data using a digital elevation map

i ran the following code on python 2.7: import sys, struct from osgeo import gdal from osgeo import gdalconst minLat = -48 maxLat = -33 minLong = 165 maxLong = 179 dataset = ...
-1
votes
0answers
12 views

analysing height data using dem [duplicate]

i ran the following code on python 2.7: import sys, struct from osgeo import gdal from osgeo import gdalconst minLat = -48 maxLat = -33 minLong = 165 maxLong = 179 dataset = ...
0
votes
1answer
26 views

TopoToRaster Tool Execute problem in ArcGIS

I am trying to execute TopoToRaster tool (ArcToolbox>3D Aanalyst Tool>Raster Interpolation>Topo To Raster) in arcGis 10.0 with .NET. Topo to Raster Input But get exceptions. My code is here : ...
0
votes
1answer
25 views

How to delete features/records in ArcGIS Online hosted service using Python

How to delete features/records in ArcGIS Online hosted service using Python? I need to delete some features using Python from a feature services hosted in ArcGIS Online. I read a similar post that ...
0
votes
1answer
19 views

GRASS parser() error

I'm trying to use GRASS on python 2.7, but I'm having some problems at setting my script on IDLE, then I'm getting an error at parser() function: Here is my script: import os import sys gisbase = ...
0
votes
1answer
170 views

Can't get the correct version of GDAL installed to use ReadAsArray without getting error in Python

Using the instructions here . . . https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/ I downloaded the following files: GDAL-1.11.1.win-amd64-py2.7.msi ...
2
votes
0answers
9 views

Qt TextLineEdit: Retrieve string instead of QString [migrated]

I am using Qt and want to get string from text field. I found below solution but it returns a QString. I just want to avoid writing extra code to extract string further. Can anyone suggest a simple ...