简体   繁体   English

这个ST_CONTAINS语句PostGIS有什么问题-多边形中的查找点

[英]What is wrong with this ST_CONTAINS statement PostGIS - Find point in polygon

I'm trying the following: 我正在尝试以下方法:

Event.where('ST_Contains(?,ST_SetSRID(location, 4326)::geography)', search_polygon::geography)

add getting the error 添加获取错误

*** NoMethodError Exception: undefined method `geography' for *** NoMethodError异常:的未定义方法“地理位置”

but without that (::geography) I get a message telling me to cast, what do I do? 但是如果没有(:: geography),我会收到一条消息,告诉我进行投射,我该怎么办?

HINT: No function matches the given name and argument types. 提示:没有函数匹配给定的名称和参数类型。 You might need to add explicit type casts. 您可能需要添加显式类型转换。

It looks like you are trying to use ST_Contains on geography types, but that function only works on geometry types. 似乎您正在尝试对地理类型使用ST_Contains ,但是该功能仅对几何类型有效。

If you are OK with the intersects spatial relation (see DE-9IM ), then use ST_Intersects(geography, geography) . 如果您对相交的空间关系没问题(请参阅DE-9IM ),请使用ST_Intersects(geography,geography)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM