in reply to Re: Solved! (was: Re^10: Geo Package files)
in thread Geo Package files

It would be useful to have a generalised WKB reader (and writer) on CPAN

This has been swirling around in my mind for a little while now...certainly happy to have a stab at creating a WKB reader - not sure about the writer as that seems to be a whole extra layer or three of complexity.

What I cannot envision is what sort of output a WKB reader would provide. In other words, what sort of Perl data structure would it read a WKB-encoded file into?

Would an array of GEO::Point objects be the output one might expect?

  • Comment on WKB Reader (was: Re^2: Solved! (was: Re^10: Geo Package files))

Replies are listed 'Best First'.
Re: WKB Reader (was: Re^2: Solved! (was: Re^10: Geo Package files))
by swl (Prior) on Dec 24, 2023 at 00:21 UTC

    I have not checked closely but Geo::Point seems to be for geographic coordinates, so latitude and longitude and not projected coordinates such as UTM. (Edit: actually it does but it uses proj4 which is long deprecated). It also seems not to handle Z and M coordinates, and neither does the parent Geo::Shape class.

    For a single part polygon or polyline one just needs an array of coordinates (vertices), so an array of arrays would do. Maybe each vertex could be blessed into an array based object if that makes other things easier.

    Multipart features are collections of polygons, polylines and points (one type per feature) so would be a different object class.

    Then there are geometry collections which can be a mix of feature types. e.g. http://postgis.net/workshops/postgis-intro/geometries.html