drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Jezak <Krzysztof.Je...@everbridge.com>
Subject geospatial queries?
Date Tue, 10 May 2016 20:18:39 GMT
Hi,

I am trying to join data in MongoDB with data in PostGIS.
Everything works great until I will use geospatial queries.
I was hoping that maybe you can help how can I make these queries work:

Test 1
Show geo data: returns null:
SELECT ST_AsText(current_location) FROM postgis.public.device_location ;
+--------+
| EXPR$0 |
+--------+
| null   |
+--------+

The same query funs fine in Postgis:
SELECT ST_AsText(current_location) FROM postgis.public.device_location ;


Test 2:
I am having geospatial query that uses only Postgis database: returns empty set:
SELECT *
FROM postgis.public.device_location
WHERE
   ST_Within(
   current_location,
   ST_GeomFromText( 'POLYGON((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0))', 4326)
);

However, if I run the following query in Postgis, everything is fine (it returns some results):
SELECT *
FROM device_location
WHERE
   ST_Within(
   current_location,
   ST_GeomFromText( 'POLYGON((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0))', 4326)
);

Test 3:
Ideally, I would like to run the following query, but it returns empty set:
SELECT count(*)
FROM mongo.test.contacts c, postgis.public.device d, postgis.public.device_location dl
WHERE c.contact_id = d.contact_id
AND c.name = 'name_99'
AND d.id = dl.device_id
AND ST_Within(
   dl.current_location,
   ST_GeomFromText( 'POLYGON((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0))', 4326) )
;


Regards,
Krzysztof jezak

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message