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

Direct WKB <-> WKT conversion functions? #60

Open
tomplex opened this issue Apr 18, 2020 · 2 comments
Open

Direct WKB <-> WKT conversion functions? #60

tomplex opened this issue Apr 18, 2020 · 2 comments

Comments

@tomplex
Copy link
Member

tomplex commented Apr 18, 2020

What do you think about adding a package with some small wrapper functions which convert directly from WKB <-> WKT (and perhaps GPKG)? They're easy enough for any user to implement, but it might be nice to include them as shortcuts in the package.

@achapkowski
Copy link
Contributor

It would greatly improve functionality for those who do not need GeoJSON, it saves a step.

@larsbutler
Copy link
Member

@tomplex I think this is worthwhile to add. Do you have some ideas about the interface? Were you thinking a basic module/function interface (as an extension to the existing library functions), or a more OO-type interface? I could see benefits of both.

I can take a stab at that, but I'm of course open to other ideas. Here are some initial thoughts:

from geomet import wkt
wkt.to_wkb('POINT(1 2)', big_endian=False)  # similar interface to geomet.wkb.dumps
from geomet import wkt
x = wkt.WKT('POINT(1 2)')
x.wkb.dumps()
with open('my.file', 'w') as fp:
  x.geopackage.dump(fp)
# This implies the creation of some new classes, including geomet.wkt.WKT, geomet.wkb.WKB, geomet.geopackage.GeoPackage, etc.
# Each one will have a property which returns an object of each other type.

Do any of these approaches appeal to you?

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

3 participants