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 hex well known binary format support (.wkb) #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ninok
Copy link

@ninok ninok commented Jan 11, 2022

No description provided.

@RandomFractals
Copy link
Owner

@ninok These changes look good. So, this PR is for binary well known format support? https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

Could you link me to some public geo datasets in .wkb format I could use for testing and adding samples to ./data examples folder?

Thanks for contributing these changes!

@RandomFractals RandomFractals changed the title Add hex-WKB format support Add WKB format support Jan 12, 2022
@ninok ninok changed the title Add WKB format support Add hex well known binary format support (.wkb) Jan 12, 2022
@ninok
Copy link
Author

ninok commented Jan 12, 2022

Thanks for review @RandomFractals!

You are correct that these changes are for well known binary encoded in hex string (i.e. that's why I pass {hex: true} to wkbFormat.readFeatures).
I also updated the PR title to make it more clear.

This format is basically what you get from PostGIS when not converting the geometry to text, e.g.:

SELECT 'POLYGON((10.689 -25.092, 34.595 -20.170, 38.814 -35.639, 13.502 -39.155, 10.689 -25.092))'::geometry;

gives you

0103000000010000000500000054E3A59BC4602540643BDF4F8D1739C05C8FC2F5284C4140EC51B81E852B34C0D578E926316843406F1283C0CAD141C01B2FDD2406012B40A4703D0AD79343C054E3A59BC4602540643BDF4F8D1739C0

Is this enough for testing? I can also add this file to this PR.
Are there some automated test where this file would be used or is it just for quick mannual testing?

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

Successfully merging this pull request may close these issues.

None yet

2 participants