geo-data-viewer icon indicating copy to clipboard operation
geo-data-viewer copied to clipboard

Add hex well known binary format support (.wkb)

Open ninok opened this issue 3 years ago β€’ 4 comments

ninok avatar Jan 11 '22 19:01 ninok

@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 avatar Jan 12 '22 12:01 RandomFractals

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?

ninok avatar Jan 12 '22 12:01 ninok