Easier

Mateusz's post about marshaling geometries from hex-encoded WKB strings in C++ reminds me how easy this is in Python using built-in string methods and Shapely:

>>> from shapely.wkb import loads
>>> g = loads('01010000005839B4C876BEF33F83C0CAA145B61640'.decode('hex'))
>>> g.wkt
'POINT (1.2340000000000000 5.6779999999999999)'

My only regret about switching to dynamic languages for (almost) all my development is that I didn't go straight to Python. Last weekend I ran into a former co-worker at the Fort Collins downtown street festival and was reminded about the enormous Perl legacy I left behind at that shop.

Comments

Re: Easier

Author: Mateusz Loskot

Sean, Nice reply to my post. Yes, indeed Python language, or more accurately - framework, simplifies things a lot. And, Shapely makes geo-things yet more simpler. To explain my favorite programming language away ;-) I can only say that C++ language and standard library provides implementation of a basic set programming concepts and all the rest is left to a programmer :-)

Re: Easier

Author: Sean

Thanks for having a sense of humor about my Python enthusiasm, Mateusz.