[postgis-devel] Z-order implementation from PostgreSQL

Darafei "Komяpa" Praliaskouski me at komzpa.net
Wed Jun 2 09:13:49 PDT 2021


Hello,

The z order curve implementation is available already in PostGIS 2.4
branch. You can take it from there and benchmark:
https://github.com/postgis/postgis/blob/stable-2.4/liblwgeom/g_serialized.c#L294:5


On Wed, Jun 2, 2021 at 6:35 PM Han Wang <hanwgeek at gmail.com> wrote:

> Hi Darafei,
>
> Thanks for your reply.
>
> I noticed that it is a well-done Hillbert implementation. However, in the
> SoC project, I need to complete another Z-order one for further research
> and performance testing.
> So maybe it is a good way to refer to your Hillbert implementation.
>
> Best regards,
> Han
>
> On Wed, Jun 2, 2021 at 11:11 PM Darafei "Komяpa" Praliaskouski <
> me at komzpa.net> wrote:
>
>> Hello,
>>
>> The correct way to implement that would be to borrow the compare function
>> that already exists in postgis (
>> https://github.com/postgis/postgis/blob/master/liblwgeom/gserialized.c#L313:5)
>> and already sorts everything in a nice Hilbert curve. All of the type
>> punning is already there.
>>
>> On Wed, Jun 2, 2021 at 6:04 PM Han Wang <hanwgeek at gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I am currently working on the GSoC project of `*Implementating a
>>> pre-sorting methods before GiST index building*` and now try to borrow
>>> some ideas from z-order implementation
>>> <https://github.com/postgres/postgres/blob/master/src/backend/access/gist/gistproc.c#L1761>
>>> in Postgres.
>>> I am wondering, however, if I should use lower level postgres functions
>>> like `*point_zorder_internal
>>> <https://github.com/postgres/postgres/blob/master/src/backend/access/gist/gistproc.c#L1576>*`
>>> and `*ieee_float32_to_uint32*
>>> <https://github.com/postgres/postgres/blob/master/src/backend/access/gist/gistproc.c#L1604>`
>>> and data structure like `*BOX
>>> <https://github.com/postgres/postgres/blob/master/src/include/utils/geo_decls.h#L140>*
>>> `.
>>> What's more, I don't know if it is necessary to implement a util
>>> function `*ieee_float32_to_uint32*` in lwgeom.
>>>
>>> I appreciate your ideas and suggestions. Feel free to talk to me.
>>>
>>> Best regards,
>>> Han
>>> _______________________________________________
>>> postgis-devel mailing list
>>> postgis-devel at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/postgis-devel
>>>
>>
>>
>> --
>> Darafei "Komяpa" Praliaskouski
>> OSM BY Team - http://openstreetmap.by/
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-devel
>>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
>


-- 
Darafei "Komяpa" Praliaskouski
OSM BY Team - http://openstreetmap.by/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20210602/94315838/attachment-0001.html>


More information about the postgis-devel mailing list