Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting constructor for multiple arguments #23

Closed
bkuhl opened this issue Jul 24, 2016 · 1 comment
Closed

Adjusting constructor for multiple arguments #23

bkuhl opened this issue Jul 24, 2016 · 1 comment

Comments

@bkuhl
Copy link

bkuhl commented Jul 24, 2016

The code in Point seems more complicated than necessary. It may be good to modify the constructor so that it's more clear how to structure data going into the class. For instance:

    public function __construct(
        $latitude,
        $longitude,
        CoordinateReferenceSystem $crs = null,
        BoundingBox $box = null
    ) {
        $this->coordinates = [
            $latitude,
            $longitude
        ];
@jmikola
Copy link
Owner

jmikola commented Apr 1, 2022

For context, this issue was originally reported against the 1.0.x branch. That code was heavily refactored in #33, which is now released as 1.1.0.

Changing the constructor signature to accept latitude and longitude separately would be a BC break and would also limit the ability to accept a third coordinate. Quoting the GeoJSON spec (RFC7946 3.1.1):

A position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation MAY be included as an optional third element.

Since Point is also used by various other constructors (all of which accept coordinate n-tuples), I don't think this is something we could feasible change.

@jmikola jmikola closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants