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

Coordinate Reference System dropped when GO.buffer() is used #214

Closed
BG-AIMS opened this issue Sep 20, 2024 · 2 comments · Fixed by #216
Closed

Coordinate Reference System dropped when GO.buffer() is used #214

BG-AIMS opened this issue Sep 20, 2024 · 2 comments · Fixed by #216
Assignees
Labels
bug Something isn't working

Comments

@BG-AIMS
Copy link

BG-AIMS commented Sep 20, 2024

The CRS attached to polygon1 appears to be removed in the resulting polygon from GO.buffer(polygon1, x).
Is there a way to attach a CRS back to the resulting polygon?

import GeoInterface as GI
import GeometryOps as GO
import GeoFormatTypes as GFT
using GLMakie
using LibGEOS

x = [-10, -10, 10, 10, -10]
y = [-10, 10, 10, -10, -10]
lines = GI.LineString(GI.Point.(zip(x,y)));

ring1 = GI.LinearRing(GI.getpoint(lines));
polygon1 = GI.Polygon([ring1]; crs=EPSG(3857));
GI.crs(polygon1)
GI.crs(GO.buffer(polygon1, 1))
@asinghvi17
Copy link
Member

Thanks for the issue! This looks like it was an oversight when I wrote buffer, since it calls out to LibGEOS which doesn't have the concept of a CRS.

For now, you can simply call tuples on the result and attach a CRS that way:

polygon2 = GO.tuples(GO.buffer(polygon1, 1); crs = GI.crs(polygon1))

but we should amend buffer to perform this itself.

@asinghvi17 asinghvi17 added the bug Something isn't working label Sep 20, 2024
@asinghvi17 asinghvi17 self-assigned this Sep 20, 2024
@asinghvi17
Copy link
Member

related: JuliaGeo/GeoInterface.jl#158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants