Discussion:
AsTopoJSON fails with: "No function matches the given name and argument types."
Luca Morandini
2013-09-05 07:09:36 UTC
Permalink
Folks,

I have hard-upgraded a database to POstGIS 2.1 (on PostgreSQL 9.1), built a
topology with ToTopoGeom and obtained this nice table:

Table "abs_asgc.lga06aaustlines"
Column | Type | Modifiers

----------+--------------+----------------------------
gid | integer | not null default
nextval('abs_asgc.lga06aaustlines_gid_seq'::regclass)
ogc_fid | integer |
topology | topogeometry |
Indexes:
"lga06aaustlines_pkey" PRIMARY KEY, btree (gid)
Check constraints:
"check_topogeom_topology" CHECK ((topology).topology_id = 2 AND
(topology).layer_id = 1 AND (topology).type = 3)

But when I try to use the tpology column, like in:
select ST_AsTopoJSON(topology) from abs_asgc.lga06aaustlines;

It doesn't seem to like it :|

As far as I can see, topology is a TopoGeometry column, which is what this
function expects... so, What am I doing wrong ?

Regards,

Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Tom van Tilburg
2013-09-05 07:30:22 UTC
Permalink
Hi Luca,

The topology functions are not in the public schema so you have to add
the explicit schema 'path' to the function.
Also, you got the function name wrong, it should be 'AsTopoJson'.

Try this: select topology.AsTopoJSON(topology) from
abs_asgc.lga06aaustlines;

Chrs,
Tom
Post by Luca Morandini
select ST_AsTopoJSON(topology) from abs_asgc.lga06aaustlines;
Luca Morandini
2013-09-05 07:56:14 UTC
Permalink
The topology functions are not in the public schema so you have to add the
explicit schema 'path' to the function.
Also, you got the function name wrong, it should be 'AsTopoJson'.
Thanks for your suggestion, but it would not work ('ST_AsTopoJSON' is aliased as
'AsTopoJSON', and the 'topology' schema is in the search path).

Regards,

Luca Morandini

Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Tom van Tilburg
2013-09-05 08:02:44 UTC
Permalink
Luca,

Can you confirm that the function exists in the topology schema?
Post by Luca Morandini
The topology functions are not in the public schema so you have to add the
explicit schema 'path' to the function.
Also, you got the function name wrong, it should be 'AsTopoJson'.
Thanks for your suggestion, but it would not work ('ST_AsTopoJSON' is
aliased as 'AsTopoJSON', and the 'topology' schema is in the search
path).
Regards,
Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
_______________________________________________
postgis-users mailing list
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Luca Morandini
2013-09-05 08:15:45 UTC
Permalink
Post by Tom van Tilburg
Luca,
Can you confirm that the function exists in the topology schema?
Yep:
geo5=# \df AsTopoJSON

List of functions

Schema | Name | Result data type | Argument data types
| Type
----------+------------+------------------+----------------------------------------+--------
topology | astopojson | text | tg topogeometry, edgemaptable
regclass | normal
(1 row)

geo5=# SHOW search_path;
search_path
---------------------------
"$user", public, topology


I was wrong on the name of the function, though: it is "AsTopoJson", without any
"ST_AsTopoJson" alias.

Regards,

Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Luca Morandini
2013-09-06 00:05:56 UTC
Permalink
Post by Tom van Tilburg
Luca,
Can you confirm that the function exists in the topology schema?
Well, in the end I had just to add a null as second parameter, like in:

select AsTopoJSON(topology, null) from abs_asgc.lga06aaustlines;

Regards,

Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Sandro Santilli
2013-09-06 11:02:35 UTC
Permalink
Post by Luca Morandini
Post by Tom van Tilburg
Luca,
Can you confirm that the function exists in the topology schema?
select AsTopoJSON(topology, null) from abs_asgc.lga06aaustlines;
The problem with not passing a "visited" table is that your arc
indices will be the edge identifiers, which are possibly (likely?)
not consecutive, so not very good for use as an array offset
(required for the "arcs" element of the resulting TopoJSON).

That's the reason why it's discouraged (ie: the second argument
is not optional).

--strk;

Loading...