public static function GeometryBoundaryTrait::getGeometryBoundaryQueryFragment in Geolocation Field 8.3
Gets the query fragment for adding a boundary field to a query.
Parameters
string $table_name: The proximity table name.
string $field_id: The proximity field ID.
string $placeholder: Placeholder SQL.
Return value
string The fragment to enter to actual query.
2 calls to GeometryBoundaryTrait::getGeometryBoundaryQueryFragment()
- GeoBoundaryArgument::query in modules/
geolocation_geometry/ src/ Plugin/ views/ argument/ GeoBoundaryArgument.php - Set up the query for this argument.
- GeoBoundaryFilter::query in modules/
geolocation_geometry/ src/ Plugin/ views/ filter/ GeoBoundaryFilter.php - Add this filter to the query.
File
- modules/
geolocation_geometry/ src/ GeometryBoundaryTrait.php, line 23
Class
- GeometryBoundaryTrait
- Trait Geometry Boundary.
Namespace
Drupal\geolocation_geometryCode
public static function getGeometryBoundaryQueryFragment(string $table_name, string $field_id, string $placeholder) : string {
// Define the field name.
$field_point = "{$table_name}.{$field_id}_geometry";
/*
* Google Maps shows a map, not a globe. Therefore it will never flip over
* the poles, but it will move across -180°/+180° longitude.
* So latitude will always have north larger than south, but east not
* necessarily larger than west.
*/
return 'ST_Contains(
ST_GeomFromGeoJSON(' . $placeholder . '),
' . $field_point . '
)';
}