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

Add LineString constructors based on Points and LineStrings #104

Open
mathieu17g opened this issue Mar 5, 2022 · 2 comments
Open

Add LineString constructors based on Points and LineStrings #104

mathieu17g opened this issue Mar 5, 2022 · 2 comments

Comments

@mathieu17g
Copy link
Contributor

@visr what about adding LineString constructors based on Points and LineStrings?

It could look like:

LineString(ls::LineString, pt::Point) = LineString([coordinates(ls); [coordinates(pt)]])
LineString(ls::LineString, pt1::Point, pt2::Point, pts::Vararg{Point}) = LineString(LineString(ls, pt1), pt2, pts...)
LineString(pt1::Point, pt2::Point) = LineString([coordinates(pt1), coordinates(pt2)])
LineString(pt1::Point, pt2::Point, pt3::Point, pts::Vararg{Point}) = LineString(LineString(pt1, pt2), pt3, pts...)

This may be extended to other geometry types

@mathieu17g mathieu17g changed the title Add LineString constructors based on Points and LineStrings Add LineString constructors based on Points and LineStrings Mar 5, 2022
@nxiangg
Copy link

nxiangg commented Jul 21, 2023

Hi,

Following up on this question, could we create a LineString out of say 2 points now? Thank you very much!

@visr
Copy link
Member

visr commented Sep 18, 2023

Yes that works if you supply the points as a vector.

https://github.com/JuliaGeo/LibGEOS.jl/blob/v0.8.5/src/geos_types.jl#L107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants