Skip to main content

Functionality to access and curate GeoJSON in CLDF datasets

Project description

cldfgeojson

Build Status PyPI

cldfgeojson provides tools to work with geographic data structures encoded as GeoJSON in the context of CLDF datasets.

Install

pip install cldfgeojson

Creating CLDF datasets with speaker area data in GeoJSON

The functionality in cldfgeojson.create helps adding speaker area information when creating CLDF datasets (e.g. with cldfbench).

Working around Antimeridian problems

Tools like shapely allow doing geometry with shapes derived from GeoJSON, e.g. computing intersections or centroids. But shapely considers coordinates to be in the cartesian plane rather than on the surface of the earth. While this works generally well enough close to the equator, it fails for geometries crossing the antimeridian. To prepare GeoJSON objects for investigation with shapely, we provide a function that "moves" objects on a - somewhat linguistically informed - pacific-centered cartesian plane: longitudes less than 26°W are adapted by adding 360°, basically moving the interval of valid longitudes from -180°..180° to -26°..334°. While this just moves the antimeridian problems to 26°W, it's still useful because most spatial data about languages does not cross 26°W - which cannot be said for 180°E because this longitude is crosssed by the speaker area of the Austronesian family.

>>> from cldfgeojson.geojson import pacific_centered
>>> from shapely.geometry import shape
>>> p1 = shape({"type": "Point", "coordinates": [179, 0]})
>>> p2 = shape({"type": "Point", "coordinates": [-179, 0]})
>>> p1.distance(p2)
358.0
>>> p1 = shape(pacific_centered({"type": "Point", "coordinates": [179, 0]}))
>>> p2 = shape(pacific_centered({"type": "Point", "coordinates": [-179, 0]}))
>>> p1.distance(p2)
2.0

Manipulating geo-referenced images in GeoTIFF format

The cldfgeojson.geotiff module provides functionality related to images in GeoTIFF format.

Commandline interface

cldfgeojson also provides cldfbench sub-commands:

leaflet.draw

This package contains the leaflet.draw plugin in the form of data:// URLs in a mako template. leaflet.draw is distributed under a MIT license:

Copyright 2012-2017 Jon West, Jacob Toye, and Leaflet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Project details


Download files

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

Source Distribution

cldfgeojson-1.1.0.tar.gz (83.9 kB view details)

Uploaded Source

Built Distribution

cldfgeojson-1.1.0-py2.py3-none-any.whl (80.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cldfgeojson-1.1.0.tar.gz.

File metadata

  • Download URL: cldfgeojson-1.1.0.tar.gz
  • Upload date:
  • Size: 83.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for cldfgeojson-1.1.0.tar.gz
Algorithm Hash digest
SHA256 53999483cf447508ec0d2837870c2b5ca4b655f14574568918568b46db5a7ea6
MD5 960274a5ddeaa683dfac2970d8588414
BLAKE2b-256 bffc9bcfb8cce0608357736890f6dfe5c3e9edbb14685bcec136455a2d22770a

See more details on using hashes here.

File details

Details for the file cldfgeojson-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cldfgeojson-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8b652d485659a36f942f3b33daf3cff4dafb8f3bc39dbe9c4a745244a03e30dc
MD5 3d51bd395fe2f1690bc4d31976e9e0bb
BLAKE2b-256 969e68b93c2118e02ad9cc86a3e96fd9e1284c996042d9dd1c827790d390513e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page