Karta simplifies management of in- and out-of-memory digital elevation models, satellite imagery, and land classification maps.
Regularly-spaced grids are represented by
RegularGrid
,
which can be created from Numpy ndarrays and spatial reference
information. Grid data is then stored in a chunked and compressed
in-memory array for space efficiency, or a simple Numpy ndarray for
speed. Grids may also use GeoTiff-backed files for large on-disk
data.
Grids can be clipped, resampled, queried at geographical points, and read or written to ESRI ASCII files or to GeoTiff via GDAL. Functions are provided for computing DEM properties such as slope, aspect, and hillshade.
# Read a grid and resample grid = karta.read_gtiff("region_dem_UTM.tif").resize(bbox) grid_100m = grid.resample(100, 100) hs = karta.raster.hillshade(grid_100m)
# Create and manipulate 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) print(polygon.area) polygon.convex_hull().to_shapefile("poly_hull.shp")
Karta provides Point
,
Line
, and
Polygon
classes and corresponding multipart collections, Multipoint
,
Multiline
, and
Multipolygon
.
All geometry objects can contain a reference to a coordinate reference system, and metadata, with multi-part collections additionally containing table data. Methods of geometry objects handle basic queries about geometry properties such as perimeter, area, and convex hull, and relationships such as distance, intersections, and membership. Fast quadtree and R-tree datastructures are automatically constructed to enable efficient queries on multi-part collections.
GeoJSON I/O is handled natively while ESRI
shapefile access is via OGR. Geometries implement
the __geo_interface__
attribute, permitting
interchange with other libraries such as Shapely.
A given project may involve GPS measurements in WGS84 spherical coordinates, survey data on a UTM grid, and public roads data in a local Albers projection. Karta is coordinate-system aware and tracks the reference system associated with grids and geometries.
Geometries and grids are referenced to
instances of karta.crs.CRS
that provide information about the geographical projection and
geodetic relationships between positions.
For performing accurate calculations, geodetic operations rely on the algorithms from geographiclib, while projection and datum transformations leverage pyproj.