This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Geospatial analysis in Python

Project Description

Karta

Karta is a package for spatial analysis in Python. It simplifies geospatial data processing by providing efficient generic classes for vector and raster data sources, as well as a selection of analysis functions.

Vector data types

Data are represented as Point, Line, Polygon, Multipoint, Multiline, and Multipolygon instances.

All data contain a .crs member encoding coordinate reference information. All vector geometries possess a .properties dict containing free-form metadata. Multipart geometries additionally possess a .data member which is a simple typed table-like data structure.

Geometries implement methods for computing distances, directions, and spatial characteristics. Multipart geometries support fast spatial indexing through quadtrees and r-trees.

GeoJSON and ESRI shapefile formats are supported for reading and writing. Experimental support for GPX XML files is in the karta.vector.gpx submodule.

Vector geometries implement the Python `__geo_interface__ attribute <https://gist.github.com/sgillies/2217756>`__ for vector geometries. This permits data to be exchanged between Karta and external modules that also implement __geo_interface__ (e.g. shapely, fastkml).

Raster data types

The primary raster data type is the RegularGrid, which represents one or more 2-d arrays of pixels spaced via an affine transformation. RegularGrids are backed by one of several Band implementations, with the default implementation using the blosc compression library for efficient in-memory storage. There is experimental support for disk-backed storage via GDAL.

Grids may be queried, resampled, sliced, masked, and merged. Arbitrary array-based functions may be mapped to raster data with RegularGrid.apply(). Raster functions including slope, gradient, and hillshade are in the karta.raster.misc submodule.

GeoTIFF images are the primary supported format, however ESRI ASCII grids may also be used (with limitations due to the format).

Coordinate reference systems

Data in Karta is referenced to positions on earth via CRS objects that implement projection and geodetic methods. Coordinate reference systems may be either geographical or projected.

Geographical CRS objects return spatial relationships in terms of the true computed distances and azimuths on a spherical or ellipsoidal Earth.

Projected CRS objects (e.g. UTM, Polar Stereographic, and Web Mercator) return spatial relationships in terms of a flat plane, dependent on the projection.

Examples

Read or create vector geometries:

point = Point((-130.0, 52.0), crs=LonLatWGS84)
line = read_geojson("linedata.json")
polygon = Polygon([(-515005.78, -1301130.53),
                   (-579174.89, -1282271.94),
                   (-542977.83, -1221147.82),
                   (-437864.05, -1251641.55),
                   (-438160.72, -1252421.48),
                   (-437961.28, -1285314.00)],
                   crs=NSIDCNorth)

Perform simple queries:

point2 = Point((-25.0, 48.0), crs=LonLatWGS84)
point.distance(point2)          # Distance in geographical units
line.intersects(polygon)        # True or False
ch = polygon.convex_hull()      # Returns a new polygon
ch.to_shapefile("poly.shp")

Load and manipulate raster data:

grid = read_gtiff("landsat_scene.tif")  # Leverages GDAL
grid.profile(line)              # Collect data along a line
grid.resample(500.0, 500.0)     # Return a grid resampled at a new resolution

Installation

Karta currently supports Python 2.7 and Python 3.4+.

The easiest way to install is via pip. Installation requires a recent version of setuptools.

pip install -U setuptools
pip install karta

Building from source

Building from source requires Cython and a C99-compliant compiler:

pip install Cython

Then, clone the repository and install:

git clone https://github.com/fortyninemaps/karta.git karta
cd karta/
python setup.py build

Documentation

See the online manual, the tutorial, or read the API documentation.

Contributing

Bug reports, feature requests, and pull requests are welcome.

Run unit tests with python tests/runtests.py.

The manual is built using Sphinx and requires numpydoc.

Release History

Release History

This version
History Node

0.9.0

History Node

0.8.3

History Node

0.8.2

History Node

0.8.1

History Node

0.8.0

History Node

0.8b1

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7

History Node

0.7b1

History Node

0.6.1

History Node

0.6

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5.1.dev0

History Node

0.5.0

History Node

0.5.0b1

History Node

0.5.0a0

History Node

0.4.6

History Node

0.4.5

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2.4

History Node

0.4.2.3

History Node

0.4.2.2

History Node

0.4.2.1

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0.2

History Node

0.4.0.1

History Node

0.4.0

History Node

0.4.0b5

History Node

0.4.0b4

History Node

0.4.0b3

History Node

0.4.0b2

History Node

0.4.0b

History Node

0.3.0

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0.2

History Node

0.1.0.1

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
karta-0.9.0.tar.gz (1.1 MB) Copy SHA256 Checksum SHA256 Source Apr 25, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting