Giter VIP home page Giter VIP logo

gis-tools's People

Contributors

jessecrocker avatar sena-mike avatar trasch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gis-tools's Issues

GeoJSON Antimeridian Cutting

From the specification: https://tools.ietf.org/html/rfc7946

3.1.9. Antimeridian Cutting

In representing Features that cross the antimeridian,
interoperability is improved by modifying their geometry.  Any
geometry that crosses the antimeridian SHOULD be represented by
cutting it in two such that neither part's representation crosses the
antimeridian.

For example, a line extending from 45 degrees N, 170 degrees E across
the antimeridian to 45 degrees N, 170 degrees W should be cut in two
and represented as a MultiLineString.

{
    "type": "MultiLineString",
    "coordinates": [
    [
    [170.0, 45.0], [180.0, 45.0]
    ], [
    [-180.0, 45.0], [-170.0, 45.0]
    ]
    ]
}

A rectangle extending from 40 degrees N, 170 degrees E across the
antimeridian to 50 degrees N, 170 degrees W should be cut in two and
represented as a MultiPolygon.

{
    "type": "MultiPolygon",
    "coordinates": [
    [
    [
    [180.0, 40.0], [180.0, 50.0], [170.0, 50.0],
    [170.0, 40.0], [180.0, 40.0]
    ]
    ],
    [
    [
    [-170.0, 40.0], [-170.0, 50.0], [-180.0, 50.0],
    [-180.0, 40.0], [-170.0, 40.0]
    ]
    ]
    ]
}

Bug in Polygon.area

The area of a polygon should IMO be the area of the outer ring minus the area of the union of the inner rings.

Needs #24

Also add tests...

Update the README

Antimeridian Cutting for Bounding Boxes

From the specification: https://tools.ietf.org/html/rfc7946

  1. Bounding Box
Example of a 3D bbox member with a depth of 100 meters:

{
    "type": "FeatureCollection",
    "bbox": [100.0, 0.0, -100.0, 105.0, 1.0, 0.0],
    "features": [
    //...
    ]
}

A rectangle extending from 40 degrees N, 170 degrees E across the
antimeridian to 50 degrees N, 170 degrees W should be cut in two and
represented as a MultiPolygon.

{
    "type": "MultiPolygon",
    "coordinates": [
    [
    [
    [180.0, 40.0], [180.0, 50.0], [170.0, 50.0],
    [170.0, 40.0], [180.0, 40.0]
    ]
    ],
    [
    [
    [-170.0, 40.0], [-170.0, 50.0], [-180.0, 50.0],
    [-180.0, 40.0], [-170.0, 40.0]
    ]
    ]
    ]
}

5.3. The Poles

A bounding box that contains the North Pole extends from a southwest
corner of "minlat" degrees N, 180 degrees W to a northeast corner of
90 degrees N, 180 degrees E.  Viewed on a globe, this bounding box
approximates a spherical cap bounded by the "minlat" circle of
latitude.

"bbox": [-180.0, minlat, 180.0, 90.0]

A bounding box that contains the South Pole extends from a southwest
corner of 90 degrees S, 180 degrees W to a northeast corner of
"maxlat" degrees S, 180 degrees E.

"bbox": [-180.0, -90.0, 180.0, maxlat]

A bounding box that just touches the North Pole and forms a slice of
an approximate spherical cap when viewed on a globe extends from a
southwest corner of "minlat" degrees N and "westlon" degrees E to a
northeast corner of 90 degrees N and "eastlon" degrees E.

"bbox": [westlon, minlat, eastlon, 90.0]

Similarly, a bounding box that just touches the South Pole and forms
a slice of an approximate spherical cap when viewed on a globe has
the following representation in GeoJSON.

"bbox": [westlon, -90.0, eastlon, maxlat]

Implementers MUST NOT use latitude values greater than 90 or less
than -90 to imply an extent that is not a spherical cap.

Add (internal) support for projections

The GeoJSON spec doesn't (officially) allow different projections, but that doesn't meant that there aren't any usecases where you want to keep things simple and just use the coordinates that you have.

Expample: Loading data from Postgis via WKB that is originally in EPSG:3857 will currently be reprojected to EPSG:4326. This is unnecessary if you need the data in the original projection later on.

Many/most/all of the algorithms won't work with anything but lat/long coordinates, so this must be checked. Either bail out when the input has the wrong projection, or reproject on the fly.

Todos:

  • Update the README
  • Add projection support to Coordinate3D
  • Add projection support to BoundingBox
  • Add projection support to all GeoJSON objects
  • Remove CoordinateXY
  • Remove ProjectedCoordinate and ProjectedBoundingBox
  • Projection support to WKB and WKT (convert from/to)
  • Make BoundingBox.intersection() projection-aware
  • Check each algorithm that it uses the right projection

The implementation of Codable for geometry types is not compatible with swift data

The implementation of Codable for geometry types is not compatible with SwiftData. Saving a model with a LineString as a property produces the following error:

SwiftData/ModelCoders.swift:286: Fatal error: Composite Coder only supports Keyed Container

I have an branch that fixes this, but I think it changes how things are serialized, so it does not serve as a drop in replacement for the current version(or maybe it does, I'm not sure). I think it is possible to make a version that would be a drop in replacement(but maybe it isn't), at the expense or somewhat more repeated code.

Is this a change you would be interested in? If so I can work on preparing a PR. But i also understand if you are not, as this seems like a somewhat niche use.

Codable Support

Was there an intentional decision to avoid using Codable for the GeoJSON support?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.