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

Reading/writing 3D coordinates #15

Closed
treinar opened this issue Oct 10, 2016 · 2 comments
Closed

Reading/writing 3D coordinates #15

treinar opened this issue Oct 10, 2016 · 2 comments
Assignees

Comments

@treinar
Copy link
Contributor

treinar commented Oct 10, 2016

The current versions of GeoJSONReader and GEOJSONWriter don't handle 3D coordinates. I propose the following changes:

GeoJSONWriter:

double[] convert(Coordinate coordinate) {
        if(Double.isNaN( coordinate.z )) {
            return new double[] { coordinate.x, coordinate.y };
        }
        else {
            return new double[] { coordinate.x, coordinate.y, coordinate.z };
        }
    }

GeoJSONReader:

Coordinate convert(double[] c) {
        if(c.length == 2){
            return new Coordinate(c[0], c[1]);
        }
        else{
            return new Coordinate(c[0], c[1], c[2]);
        }
    }

Thanks for a useful library, btw!

@bjornharrtell bjornharrtell self-assigned this Oct 15, 2016
@bjornharrtell
Copy link
Owner

Thanks, seems like a good idea. Can you make it a pull request?

@bjornharrtell
Copy link
Owner

Fixed by #16.

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