How to find all a PostGIS GEOMETRY Points by radius in Sequelize?

Viewed 983

How to find all a PostGIS GEOMETRY Points by radius in Sequelize?

I tried this:

Model.findAll({
  where: {
    $or: [{
      geom: { $contains: { $point: [0, 1] } },
      // ST_Within( ST_MakePoint(1,0), `table`.`geom` )
    }, {
      geom: { $contains: { $point: [0, 1], $fuzziness: 10 } }, // or maybe `$distance`
      // ST_DWithin( ST_MakePoint(1,0), `table`.`geom`, 10 )
    }, {
      point: { $inside: { $col: 'geom' } },
      // ST_Within( `table`.`point`, `table`.`geom` )
    }, {
      point: { $inside: { $polygon: [/* some coordinates */] } },
      // ST_Within( `table`.`point`, ST_GeomFromGeoJSON({type: 'Polygon'...}) )
    }],
  },
});

and other examples from Support for geometry, but it didn't work.

The errors were:

First: SequelizeDatabaseError: operator does not exist: geometry @> geometry

Second: SequelizeDatabaseError: unknown GeoJSON type

Can somebody give the example how to find all model's points by radius in Sequelize?

Thanks, Michael.

0 Answers
Related