我使用ST_DISTANCE
来获取每个点的最近多边形,并使用此代码就像魅力一样:
$neighborhoods = $this->_em
->createQueryBuilder()
->select('Region')
->addSelect('ST_Distance(
GeomFromText(\'POINT(' . $point . ')\'),
Region.regionPolygon
) as distance')
->from($this->entityClass, 'Region')
->where('ST_Distance(
GeomFromText(\'POINT(' . $point . ')\'),
Region.regionPolygon
) > 0')
->getQuery()
->execute();
现在,我希望获得每个点的最西端(或最北端)。我怎么能这样做?