I attempted to select a city and/or districts by using the Point-data type in MySQL, using Laravel.
The query looks like:
SELECT id, bounding_box
FROM `districts`
WHERE ST_Contains(ST_GeomFromText('Point(-96.505144 41.322207)', 4326), bounding_box)
districts table
- id
- name
- bounding_box
This gives me an exception: Binary geometry function st_contains given two geometries of different srids: 4326 and 0, which should have been identical..
When I remove the SRID from ST_GeomFromText within the query, the exception gives me a reversed order of SRID in the exception:
Binary geometry function st_contains given two geometries of different srids: 0 and 4326, which should have been identical.
I used ST_GeomFromGeoJSON to parse my polygon. The MySQL documentation for ST_GeomFromGeoJSON() tells me the default SRID used is 4326.
Using ST_Transform() on my bounding_box gives me the exception: Transformation from SRID 0 is not supported., but I don't understand why it's SRID 0, when the default for importing is 4326.
How can I correctly use ST_Contains to query my table for districts based on a Point-data type? I get the same behaviour when using ST_Within.