Skip to main content

Fixes 180 degree crossing issue for vector geodata

Project description

problem180meridian

Python module to fix 180 degree crossing issue for vector geodata

Take care of topology errors on the 180th meridian

Having vector geodata with lines/polygons crossing 180th meridian, their geometry is likely to be displayed wrongly in geographic CRS like EPSG:4326. This module helps to modify the original Linestring, Multilinestring, Polygon, or Multipolygon geometry to be correctly represented in a geographic CRS.

Install

The module is available from PyPi, one may install it using pip:

pip install problem180meridian

To use it from Python console one may use:

import problem180meridian

Usage

The module contains the following functions (version 0.1.4):

check180(coordinates) - checks if any segment in a pair of coordinates crosses 180th meridian and returns a tuple of two values. The first one is False if no crossing was found, and True if at least one was found. Without any crossing, the second value is None, otherwise it's an array of bool values where True marks the 180th meridian crossing and False means no crossing.

cross180(coord1, coord2, lon_buffer=0) - takes a pair of point coordinates a line between which is supposed to cross the 180th meridian and returns a pair of point coordinates on the crossing between this line and the meridian, or at a distance from it equal to lon_buffer parameter (in longitude degrees).

split180_coordinates(coordinates, check, lon_buffer=0) - splits coordinates in a list by the 180th meridian creating new coordinate chains and returns another list with new point coordinates

split180_multilinestring(coordinates, lon_buffer=0) - splits linestring/multilinestring geometry coordinates by the 180th meridian and returns ogr.Geometry Multilinestring

split180_multipolygon(coordinates, lon_buffer=0) - splits polygon/multipolygon geometry coordinates by the 180th meridian and returns ogr.Geometry Multipolygon

split180_geometry(geometry, lon_buffer=0) - splits ogr.Geometry by the 180th meridian and returns another ogr.Geometry. Supported geometry types: Linestring, Multilinestring, Polygon, Multipolygon. Point and Multipoint objects wouldn't be changed; other types cause Warning Exception

Development

Plans for the module development:

  • pole points processing
  • backward algorithm to unite geometry separated by the 180th meridian for correct representation in projected CRS, like UTM
  • reprojection function to reproject geometry and check 180th meridian crossing, if necessary
  • further testing functions to check different geometry shapes, coordinate formats, and complex geometries

Author

Made by Sergei Sadkov (@sergsadkov)

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

problem180meridian-0.1.4.tar.gz (12.6 kB view details)

Uploaded Source

File details

Details for the file problem180meridian-0.1.4.tar.gz.

File metadata

  • Download URL: problem180meridian-0.1.4.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for problem180meridian-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e34e17156e2bf1aeee3a497e7871846a2cec9c6bbc21744d393abb1e3b47a2f5
MD5 9e921c1ba26bd9d5f6118f4e5c931902
BLAKE2b-256 32242fcdd14995bf58d88af6c9cee4263297683179c024844473dfc7723a4504

See more details on using hashes here.

Supported by

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