4

Im trying to run the query below in postgresql/postgis:

SELECT ST_AsText(pgr_pointsAsPolygon('SELECT id::int4, ST_X(geo)::float8 AS x, ST_Y(geo)::float8 as y FROM junction WHERE id IN ( 1050062040,.. ) UNION ALL SELECT 0::int4, 80.9475631713867::float8 as x, 26.8484115600586::float8 AS y  ')) ;

But getting following error:

ERROR:  function pgr_pointsaspolygon(unknown) does not exist
LINE 1: SELECT ST_AsText(pgr_pointsAsPolygon('SELECT id::int4, ST_X(...
                         ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Have installed postgis and have pgrouting extension also. Any help ?

5
  • which version of pgrouting are you using?
    – JGH
    Commented Dec 3, 2019 at 12:57
  • what do you get if you do \df pgr_pointsAsPolygon
    – JGH
    Commented Dec 3, 2019 at 12:59
  • As said, check your postgres and pg-routing version, and maybe try to cast the text with ::text ? (you may also have a quote somewhere in your original query?) Commented Dec 3, 2019 at 13:04
  • @JGH thanks for response.. pgrouting version is 3.0.0-beta and if I do \df pgr_pointsAsPolygon getting nothing...its blank
    – user154537
    Commented Dec 4, 2019 at 4:50
  • @robinloche postgres version is 11.6
    – user154537
    Commented Dec 4, 2019 at 4:53

2 Answers 2

3

As Dmitry Abt said, it seems that in pg_routing 3.0 it's no longer a function. Not sure what you're trying to do, and I never used this function, but maybe ST_ConcaveHull (or eventually ST_ConvexHull) could do the same job? Or you still have pgr_alphaShape in 3.0, wich seems to be the core function for alpha shapes.

Edit: as JGH said, the signature of the pgr_alphaShape changed, so I edited the link

1
  • 2
    The AlphaShape signature has changed for v3. It is the function replacing pgr_pointsaspolygon
    – JGH
    Commented Dec 4, 2019 at 14:15
2

I encountered the same problem - after installing the extension, I did not find this function. PgRouting version is 3.0.

> postgres=# SELECT pgr_version();  pgr_version 
> -------------
>  3.0.0-beta (1 row)

It can be seen that there really is no function.

postgres=# \df pgr_pointsAsPolygon
                       List of functions
 Schema | Name | Result data type | Argument data types | Type 
--------+------+------------------+---------------------+------
(0 rows)

It says here that this function is moved to legacy. And here about this function...

Maybe you should try installing a different version of the extension?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.