Skip to main content

Fixes 180 degree crossing issue for vector geodata

Reason this release was yanked:

critical error found

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.1):

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.1.tar.gz (10.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: problem180meridian-0.1.1.tar.gz
  • Upload date:
  • Size: 10.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.1.tar.gz
Algorithm Hash digest
SHA256 c4d9ebf95f2922a83b05c085575557963fdbfa20458a13edea54fdc53be2897b
MD5 20ba812812fae701bcdbc8fde6e6919e
BLAKE2b-256 37b4d9f05b99e3f69236a4a7fa77b0f0ceb64bc864bb4a5681545a8fc01da9d2

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