Questions tagged [python]

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

Filter by
Sorted by
Tagged with
130
votes
5answers
24k views

Accessing ArcObjects from Python?

I would like to be able to script some things that are not exposed via arcgisscripting or ArcPy. How do I access ArcObjects from Python?
91
votes
13answers
106k views

Installing GDAL with Python on windows?

Can anyone explain how to install GDAL/OGR with Python on Windows? I have Windows Vista and I have tried following the information on the website and it does not seem to bind the exe files for me. ...
69
votes
11answers
11k views

Alternatives to using Arcpy

I seem to use ESRI's Arcpy site package for virtually all of my python geoprocessing. To ESRI's credit, these are an incredible suite of tools that can help accomplish a great deal. However, I would ...
63
votes
22answers
74k views

Python GDAL package missing header file when installing via pip

I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too. I'm trying to install gdal from pip pip install gdal inside a ...
52
votes
3answers
17k views

Smoothing polygons in 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 ...
49
votes
17answers
35k views

Learning Python programming with generic GIS goals in mind?

In your opinion, what is the best book/site to learn Python with GIS goals in mind? By "best", I mean: not very long (book) easy to understand (book/site) good practical examples (book/site) For ...
47
votes
8answers
84k views

Converting 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 ...
44
votes
1answer
23k views

Getting pixel value of GDAL raster under OGR point without NumPy?

I am working on a computational model of the abundance of wild pollinators across a landscape. The model itself is complete, and I am now struggling with a post-processing step. I have my GDAL ...
40
votes
3answers
23k views

Is it possible to look at the contents of Shapefile using Python without an ArcMap license?

I wondered if it is possible to look at the contents of a shapefile using Python without having and ArcMap license. The situation is that you can create shapefiles from many different applications, ...
40
votes
5answers
34k views

How to call gdal_translate from Python code?

Is it possible to use some gdal API to call gdal_translate from Python code? I do not mean simply executing the gdal_translate.exe from the file system, but rather call it somehow in code so I do not ...
37
votes
4answers
24k views

Simple thematic mapping of shapefile using Python?

I wish to visualize geographical data in Python, without using ArcGIS/ArcPy, and make a map. On the internet I found how to make a thematic map using Python: Here is some code that I tried: ...
36
votes
7answers
18k views

Nearest neighbor between point layer and line layer? [closed]

I've asked this question several times on stackoverflow and irc between #qgis and #postgis and I also tried to code it or implement it my self in postgis with no real answer. Using programming (most ...
33
votes
10answers
6k views

How to easily shift all features in a vector dataset?

Let's say that I put together a Shapefile and all the features have their vertices shifted by a constant amount. What's the easiest way of shifting all the features (hence the (x,y) position of their ...
33
votes
4answers
37k views

Python Script examples for geoprocessing shapefiles without using arcpy

I would like to use a Python script that is not based on arcpy to do things like query a shapefile by attributes, create new layer from selection, and calculate areas of a polygon and convert ...
33
votes
3answers
23k views

What is the proper syntax and usage for ArcGIS “in_memory” workspace?

I am unclear how best to use the in_memory workspace in ArcGIS. The best resource I have found on the subject is from ESRI on Using in-memory workspace. Unfortunately, the help section is not very ...
31
votes
10answers
15k views

Seeking Python tools/modules/add-ins for GIS?

With ArcGIS 10, Python has become the de-facto scripting language for ESRI. While leading Open source software like QGIS, GeoServer, PostGIS all supports Python. Thus it became important to know/learn ...
30
votes
10answers
16k views

How do I develop my GIS programming skills?

I would like to develop my GIS programming skills, where do I start? People say learn C++ or Python but where can I learn this in a geographic context? Tutorials or anything would be very helpful, as ...
30
votes
5answers
7k views

OpenSource Remote Sensing Tools for Classifying Roofs

with envi image processing and classification tools, you can get roofs from images with some spectral value and then you can convert it some vector data for your app. in python with OpenCV which have ...
29
votes
5answers
32k views

Writing numpy array to raster file

I'm new to GIS. I have some code that converts infrared images of Mars into thermal inertia maps, which are then stored as 2D numpy arrays. I've been saving these maps as hdf5 files but I'd really ...
29
votes
9answers
3k views

Value of a Python programming course

I am considering upping my programming skills by taking a python geoprocessing course through ESRI. Before I part with the hefty registration fee, I would like to get your opinion on the value of 24 ...
29
votes
9answers
27k views

Generate points that lie inside polygon

I have polygon feature and want to be able to generate points inside it. I need this for one classification task. Generating random points until one is inside the polygon wouldn't work because it's ...
29
votes
4answers
25k views

How to get raster corner coordinates using Python GDAL bindings?

Is there a way to get the corner coordinates (in degrees lat/long) from a raster file using gdal's Python bindings? A few searches online have convinced me that there is not, so I have developed a ...
28
votes
7answers
27k views

How to set all pixels with value <= 0 to “nodata” in DEM raster?

I have a DEM raster with pixel values between about 3000 and -0.0003. I need to set all pixel with a value of 0 and smaler (<=0) to "nodata" (for later raster calculations and to reduce the ...
28
votes
6answers
18k views

Installing QGIS3 on Mac?

Kyngchaos installer is not finding python3. I installed python3 using HomeBrew and is not located at /usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/bin/python3.6 How do I ...
28
votes
6answers
3k views

How to buffer raster pixels by their values?

The pixels to the left represent tree locations and their associated crown radii (i.e. pixel values ranging from 2 - 5). I would like to buffer these raster pixels by their crown radius value. The ...
28
votes
2answers
5k views

Using OGR and Shapely more efficiently? [closed]

I'm looking for some suggestions about how to make my python code more efficient. Normally efficiency doesn't matter for me but I am now working with a text file of US locations with over 1.5 million ...
26
votes
4answers
37k views

How to fully load a raster into a numpy array?

I have been trying to check my filters on DEM raster for pattern recognition and it is always resulting in missing last rows and columns(like..20). I have tried with PIL library, image load. Then with ...
26
votes
3answers
27k views

Clipping raster with vector layer using GDAL

I have installed GDAL using the Osgeo installer. How can I clip a raster layer with a vector layer programmatically? Is there any GDAL API available which can help me with this? I am using Python.
25
votes
4answers
35k views

How to write Shapely geometries to shapefiles?

Can someone demonstrate a simple way to write geometry data-structures from shapely into shapefiles? I am particularly interested in polygons with holes and linestrings. It would also be beneficial to ...
24
votes
4answers
2k views

Recommend topics to be included in a Computer Science for Geospatial Technologies course

I will be instructing a course at the local university titled Computer Science for Geospatial Technologies. This is an introductory course meant to introduce computer science concepts to geospatial ...
24
votes
1answer
3k views

Creating sector lights in QGIS?

I'm using QGIS 2.18. I need to create sector lights for navigational purposes on a map. I have the light sector data as fields giving becon_id, start degree, end degree and color in a shapefile with ...
24
votes
4answers
38k views

Why is Shapely not installing correctly?

I am trying to run Shapely on a new machine, and tried both installing it from source, using the installer on its webpage, and using pip install shapely. Every reference I try to make from the library ...
24
votes
5answers
22k views

How to add attribute field to existing Shapefile via Python without ArcGIS?

I have a Python script that adds an attribute field to a Shapefile if doesn't exist. This is easy to do with ArcGIS (graphically or via Python), but I'm looking for something that doesn't depend on ...
24
votes
1answer
2k views

What does the adoption of Python by NVIDIA for GPGPU mean for GIS?

Today NVIDIA announced support for the Python language on its flavor of GPGPU (CUDA). Manifold GIS uses CUDA to enable some accelerated raster operations but it is not a programmable environment and ...
23
votes
3answers
13k views

Transforming Shapely Polygon and MultiPolygon objects

Is there an easy way of transforming Shapely objects (namely, Polygons and MultiPolygons) from one projection to another without having to dig around and extract coordinates by hand? In fact, I don'...
23
votes
2answers
773 views

Can qgis_core work with external python distribution (such as Anaconda)?

I've built a python application that has its own GUI. I am trying to use qgis.core/PyQGIS as map display only. Specifically, I have anaconda 2.3 and its python distribution (2.7.11). After research ...
22
votes
6answers
17k views

What LiDAR processing tools are available in Python?

I have been using FUSION and the command line FUSION Lidar Toolkit (LTK) to process LiDAR data. A broad Google search ("Lidar Python") yielded libLAS and pyLAS as Python LiDAR libraries, however, ...
21
votes
3answers
30k views

Converting GeoJSON to Python objects? [closed]

New to the site, and to geoJSON, and to python. My goal is to read in a file with geoJSON data, and use it to generate shapes to be used in an application that is using python scripting. Python ...
21
votes
3answers
10k views

Is it possible to get the EPSG value from an OSR SpatialReference class using the OGR Python API?

When reading a layer from a OGR PostGIS connection I can get the SpatialReference of the layer, but is it possible to get the EPSG value? Is there any documentation on this? For example: lyr = conn....
21
votes
3answers
9k views

How to access feature classes in file geodatabases with Python and GDAL?

I am trying to access a vector dataset in a ESRI File Geodatabase using Python + GDAL. I have successfully compiled GDAL with the file geodatabase API. The FileGDB driver is working correctly since ...
21
votes
6answers
664 views

Python for GIS on a thumb-drive

I'm looking at putting together a light Python install on a thumb drive that I can take to client offices and do some basic GIS processing. I'm thinking of installing the following: PyScripter Python ...
20
votes
4answers
6k views

The best language to program with GDAL

I'm going to start to create programs to handle geographical data from a PostGIS server, and going to use GDAL. According to your experience, with the best language to program with it? I can program ...
20
votes
4answers
19k views

Using ogr2ogr to convert GML to shapefile in Python?

I am trying to convert a GML to an ESRI shapefile using ogr2ogr utility in a python script. I have successfully installed the GDAL/OGR package via osgeo but I am now struggling to find/understand ...
20
votes
3answers
8k views

Smoothing/interpolating raster in Python using GDAL?

I am developing in Python and using GDAL from OSGEO to manipulate and interact with rasters and shapefiles. I want to take a shapefile that has point features and interpolate it into a surface raster....
20
votes
6answers
13k views

What tools in Python are available for doing great circle distance + line creation?

I need to use Python to create a great circle distance -- both a number, and preferably some kind of 'curve' that I can use to draw in a client-side map. I don't care about the format of the curve -- ...
19
votes
4answers
13k views

What python web-mapping framework to use? [closed]

I am interested in developing a web-mapping application. I am relatively familiar with Python and so i'm looking for a python framework. What are my options? what are the pros and cons of each option? ...
19
votes
1answer
11k views

Replicating result of gdalwarp using gdal Python bindings

I am trying to re-project/resample with the GDAL python bindings, but am getting slightly different results compared to those from the command line utility gdalwarp. See update below for shorter ...
19
votes
2answers
5k views

Link QGIS to Anaconda Python Distribution: Spyder, iPython Notebook, pip, scikit-learn

I have Anaconda as my primary Python distro, and want to route Python related QGIS scripts through it. With Anaconda, I have Spyder, can easily install packages with pip, and can launch a iPython ...
18
votes
8answers
74k views

Installing GDAL and OGR for Python?

I am developing some code in Python, and I want to use the GDAL/OGR python bindings. What is the minimum I need to install in order to use the GDAL and OGR python bindings? What is the easiest way to ...
18
votes
1answer
24k views

GDAL/Python: How do I get coordinate system name from SpatialReference?

In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows: wkt = dataset.GetProjection() # wkt is 'PROJCS["GDA_1994_Transverse_Mercator",GEOGCS["GDA_1994",DATUM["GDA_1994"...