cldfgeojson


Namecldfgeojson JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/cldf/cldfgeojson
SummaryFunctionality to access and curate GeoJSON in CLDF datasets
upload_time2024-11-23 10:40:25
maintainerNone
docs_urlNone
authorRobert Forkel
requires_python>=3.9
licenseApache 2.0
keywords linguistics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cldfgeojson

[![Build Status](https://github.com/cldf/cldfgeojson/workflows/tests/badge.svg)](https://github.com/cldf/cldfgeojson/actions?query=workflow%3Atests)
[![PyPI](https://img.shields.io/pypi/v/cldfgeojson.svg)](https://pypi.org/project/cldfgeojson)

`cldfgeojson` provides tools to work with geographic data structures encoded as [GeoJSON](https://geojson.org)
in the context of [CLDF](https://cldf.clld.org) datasets.


## Install

```shell
pip install cldfgeojson
```


## Creating CLDF datasets with speaker area data in GeoJSON

The functionality in [`cldfgeojson.create`](src/cldfgeojson/create.py) helps adding speaker area
information when creating CLDF datasets (e.g. with [`cldfbench`](https://github.com/cldf/cldfbench)).


## Working around [Antimeridian problems](https://antimeridian.readthedocs.io/en/stable/)

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.

```python
>>> 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`](src/cldfgeojson/geotiff.py) module provides functionality related to
images in [GeoTIFF](https://en.wikipedia.org/wiki/GeoTIFF) format.


## Commandline interface

`cldfgeojson` also provides [`cldfbench` sub-commands](https://github.com/cldf/cldfbench?tab=readme-ov-file#commands):

- [`geojson.webmercator`](src/cldfgeojson/commands/webmercator.py)
- [`geojson.overlay`](src/cldfgeojson/commands/overlay.py)


## `leaflet.draw`

This package contains the [`leaflet.draw`](https://github.com/Leaflet/Leaflet.draw) plugin in the form of `data://` URLs in 
[a mako template](src/cldfgeojson/commands/templates/leaflet.draw.mako). `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.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cldf/cldfgeojson",
    "name": "cldfgeojson",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "linguistics",
    "author": "Robert Forkel",
    "author_email": "dlce.rdm@eva.mpg.de",
    "download_url": "https://files.pythonhosted.org/packages/bf/fc/9bcfb8cce0608357736890f6dfe5c3e9edbb14685bcec136455a2d22770a/cldfgeojson-1.1.0.tar.gz",
    "platform": "any",
    "description": "# cldfgeojson\n\n[![Build Status](https://github.com/cldf/cldfgeojson/workflows/tests/badge.svg)](https://github.com/cldf/cldfgeojson/actions?query=workflow%3Atests)\n[![PyPI](https://img.shields.io/pypi/v/cldfgeojson.svg)](https://pypi.org/project/cldfgeojson)\n\n`cldfgeojson` provides tools to work with geographic data structures encoded as [GeoJSON](https://geojson.org)\nin the context of [CLDF](https://cldf.clld.org) datasets.\n\n\n## Install\n\n```shell\npip install cldfgeojson\n```\n\n\n## Creating CLDF datasets with speaker area data in GeoJSON\n\nThe functionality in [`cldfgeojson.create`](src/cldfgeojson/create.py) helps adding speaker area\ninformation when creating CLDF datasets (e.g. with [`cldfbench`](https://github.com/cldf/cldfbench)).\n\n\n## Working around [Antimeridian problems](https://antimeridian.readthedocs.io/en/stable/)\n\nTools like `shapely` allow doing geometry with shapes derived from GeoJSON, e.g. computing\nintersections or centroids. But `shapely` considers coordinates to be in the cartesian plane rather\nthan on the surface of the earth. While this works generally well enough close to the equator, it\nfails for geometries crossing the antimeridian. To prepare GeoJSON objects for investigation with\n`shapely`, we provide a function that \"moves\" objects on a - somewhat linguistically informed -\npacific-centered cartesian plane: longitudes less than 26\u00b0W are adapted by adding 360\u00b0, basically\nmoving the interval of valid longitudes from -180\u00b0..180\u00b0 to -26\u00b0..334\u00b0. While this just moves the\nantimeridian problems to 26\u00b0W, it's still useful because most spatial data about languages does not\ncross 26\u00b0W - which cannot be said for 180\u00b0E because this longitude is crosssed by the speaker area\nof the Austronesian family.\n\n```python\n>>> from cldfgeojson.geojson import pacific_centered\n>>> from shapely.geometry import shape\n>>> p1 = shape({\"type\": \"Point\", \"coordinates\": [179, 0]})\n>>> p2 = shape({\"type\": \"Point\", \"coordinates\": [-179, 0]})\n>>> p1.distance(p2)\n358.0\n>>> p1 = shape(pacific_centered({\"type\": \"Point\", \"coordinates\": [179, 0]}))\n>>> p2 = shape(pacific_centered({\"type\": \"Point\", \"coordinates\": [-179, 0]}))\n>>> p1.distance(p2)\n2.0\n```\n\n\n## Manipulating geo-referenced images in GeoTIFF format\n\nThe [`cldfgeojson.geotiff`](src/cldfgeojson/geotiff.py) module provides functionality related to\nimages in [GeoTIFF](https://en.wikipedia.org/wiki/GeoTIFF) format.\n\n\n## Commandline interface\n\n`cldfgeojson` also provides [`cldfbench` sub-commands](https://github.com/cldf/cldfbench?tab=readme-ov-file#commands):\n\n- [`geojson.webmercator`](src/cldfgeojson/commands/webmercator.py)\n- [`geojson.overlay`](src/cldfgeojson/commands/overlay.py)\n\n\n## `leaflet.draw`\n\nThis package contains the [`leaflet.draw`](https://github.com/Leaflet/Leaflet.draw) plugin in the form of `data://` URLs in \n[a mako template](src/cldfgeojson/commands/templates/leaflet.draw.mako). `leaflet.draw` is\ndistributed under a MIT license:\n\n> Copyright 2012-2017 Jon West, Jacob Toye, and Leaflet\n> \n> 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:\n> \n> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Functionality to access and curate GeoJSON in CLDF datasets",
    "version": "1.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/cldf/cldfgeojson/issues",
        "Homepage": "https://github.com/cldf/cldfgeojson"
    },
    "split_keywords": [
        "linguistics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "969e68b93c2118e02ad9cc86a3e96fd9e1284c996042d9dd1c827790d390513e",
                "md5": "3d51bd395fe2f1690bc4d31976e9e0bb",
                "sha256": "8b652d485659a36f942f3b33daf3cff4dafb8f3bc39dbe9c4a745244a03e30dc"
            },
            "downloads": -1,
            "filename": "cldfgeojson-1.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d51bd395fe2f1690bc4d31976e9e0bb",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.9",
            "size": 80881,
            "upload_time": "2024-11-23T10:40:22",
            "upload_time_iso_8601": "2024-11-23T10:40:22.011454Z",
            "url": "https://files.pythonhosted.org/packages/96/9e/68b93c2118e02ad9cc86a3e96fd9e1284c996042d9dd1c827790d390513e/cldfgeojson-1.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bffc9bcfb8cce0608357736890f6dfe5c3e9edbb14685bcec136455a2d22770a",
                "md5": "960274a5ddeaa683dfac2970d8588414",
                "sha256": "53999483cf447508ec0d2837870c2b5ca4b655f14574568918568b46db5a7ea6"
            },
            "downloads": -1,
            "filename": "cldfgeojson-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "960274a5ddeaa683dfac2970d8588414",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 83907,
            "upload_time": "2024-11-23T10:40:25",
            "upload_time_iso_8601": "2024-11-23T10:40:25.308109Z",
            "url": "https://files.pythonhosted.org/packages/bf/fc/9bcfb8cce0608357736890f6dfe5c3e9edbb14685bcec136455a2d22770a/cldfgeojson-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-23 10:40:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cldf",
    "github_project": "cldfgeojson",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "cldfgeojson"
}
        
Elapsed time: 0.40107s