Search code examples
postgresqlpostgis

Why is there no ST_GeographyFromWKB() function?


I'm developing a GIS library for PHP, that delegates GIS calculations to the database.

I'm currently using the ST_GeomFromText() and ST_GeomFromWKB() functions to convert PHP objects to database objects.

I'd now like to add support for PostGIS Geographies, so I thought I'd use ST_GeographyFromText() and ST_GeographyFromWKB(), but to my surprise, the latter does not exist.

Is there any reason why ST_GeographyFromWKB() does not exist?

As far as I understand it, there is no reason why a WKB with the standard format and bounds in [-180 -90, 180 90] could not be imported as a Geography.

Did I miss something?


Solution

  • The function exists and is called ST_GeogFromWKB:

    SELECT 
      ST_AsText(
    ST_GeogFromWKB('\x0101000020e6100000000000000000f03f0000000000000040'));
    
    st_astext  
    ------------
     POINT(1 2)
    (1 Zeile)