postgraphile-plugin-connection-filter-postgis icon indicating copy to clipboard operation
postgraphile-plugin-connection-filter-postgis copied to clipboard

filter returns empty result (possible issue with SRID)

Open andilabs opened this issue 5 years ago • 1 comments

image

the postgraphile query:

query findNearby($point: GeoJSON) {
      allApiDjtinderusers (
        filter: {
          lastLocation: { equals: $point }
        }) {
        nodes {
          id
          lastLocation {
        		geojson
        		srid
        		y
        		x
      		}
        }
      }
    }

the variable:

{
  "point": {
    "type":"Point",
    "coordinates":[20.9800552409116,52.2724808126503],
    "crs": {"type": "name", "properties": {"name": "EPSG:4326"}}

  }
}

the result:

{
  "data": {
    "allApiDjtinderusers": {
      "nodes": []
    }
  }
}

There exist record with given 20.9800552409116,52.2724808126503 coordinates, so I would expect getting it in result of equals query.

Additional info for reference:

the postgres table:

postgres=# \d api_djtinderuser+
                                         Table "public.api_djtinderuser"
      Column       |          Type          | Collation | Nullable |                   Default
-------------------+------------------------+-----------+----------+----------------------------------------------
 id                | integer                |           | not null | nextval('api_djtinderuser_id_seq'::regclass)
 last_location     | geometry(Point,4326)   |           |          |

Indexes:
    "api_djtinderuser_pkey" PRIMARY KEY, btree (id)
    "api_djtinderuser_last_location_id" gist (last_location)

PG version:

postgres=# SELECT version();
                                                             version
----------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 11.2 (Debian 11.2-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
(1 row)

POSTGIS version:

postgres=# \dx
                                     List of installed extensions
  Name   | Version |   Schema   |                             Description
---------+---------+------------+---------------------------------------------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis | 2.5.2   | public     | PostGIS geometry, geography, and raster spatial types and functions
(2 rows)

graphile

[email protected]
`-- [email protected]

inside the graphql container I installed following npm packages:

RUN npm install -g postgraphile
RUN npm install -g @graphile/postgis
RUN npm install -g postgraphile-plugin-connection-filter
RUN npm install -g postgraphile-plugin-connection-filter-postgis

andilabs avatar Jun 25 '20 12:06 andilabs

2020-09-15 11-34-41 的屏幕截图 I first created a point, and then used equals query, got the correct result @andilabs

gqians avatar Sep 15 '20 03:09 gqians