apache / apache/age

Using geographic objects as properties with PostGIS

Open
#48 5 comments 0 reactions 1 assignee Claimed by @jrgemignani View on GitHub
bug
Dominant language
C
Stars
4.8k
Forks
523
Avg merge
1d 2h
Merged PRs (30d)
9

Description

Is there a way to add PostGis data as property to a node (e.g., a [point geometry](https://postgis.net/docs/ST_MakePoint.html))?

I've tried:
```
SELECT * FROM cypher('testgraph', $$
CREATE (n:Test {id: 1, location: ST_SetSRID(ST_MakePoint(-71.10, 42.32),4326)}) return n
$$) as (a agtype);
ERROR: function ag_catalog.age_st_makepoint(agtype, agtype) does not exist
LINE 2: ... (n:Test {id: 1, location: ST_SetSRID(ST_MakePoint(-71.10, 4...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

SELECT * FROM cypher('testgraph', $$
CREATE (n:Test {id: 1, location: public.ST_SetSRID(public.ST_MakePoint(-71.10, 42.32),4326)}) return n
$$) as (a agtype);
ERROR: function public.ST_MakePoint(agtype, agtype) does not exist
LINE 2: ...1, location: public.ST_SetSRID(public.ST_MakePoint(-71.10, 4...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

SELECT * FROM cypher('testgraph', $$
CREATE (n:Test {id: 1, location: public.ST_SetSRID(public.ST_MakePoint(-71.10::float, 42.32::float),4326)}) return n
$$) as (a agtype);
ERROR: ag function does not exist
LINE 1: SELECT * FROM cypher('testgraph', $$
^
DETAIL: agtype_typecast_float(1)

SELECT * FROM cypher('testgraph', $$
CREATE (n:Test {id: 1, location: public.ST_GeomFromText('POINT(-71.10, 42.32)', 4326)}) return n
$$) as (a agtype);
ERROR: function public.ST_GeomFromText(agtype, agtype) does not exist
LINE 2: ...E (n:Test {id: 1, location: public.ST_GeomFromText('POINT(-7...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

SELECT * FROM cypher('testgraph', $$
CREATE (n:Test {id: 1, location: public.ST_GeomFromText('POINT(-71.10, 42.32)'::text, 4326)}) return n
$$) as (a agtype);
ERROR: typecast 'text' not supported
LINE 1: SELECT * FROM cypher('testgraph', $$
^
```

Additional information: the indivial extensions (age, postgis) do work:
```
SELECT * FROM cypher('testgraph', $$
CREATE (n:Test {id: 1}) return n
$$) as (a agtype);
a
----------------------------------------------------------------------------
{"id": 1688849860263978, "label": "Test", "properties": {"id": 1}}::vertex
(1 row)

SELECT ST_SetSRID(ST_MakePoint(-71.10, 42.31),4326) as location;
location
----------------------------------------------------
0101000020E61000006666666666C651C048E17A14AE274540
(1 row)

SELECT PostGIS_Version();
postgis_version
---------------------------------------
2.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.