0

I consider myself quite good with SQL but I am just stumped on how to even begin to perform this type of search.

It seems like quite a simple scenario - I have a MariaDB database already populated with several records with their location point stored in a POINT data field ("POINT NOT NULL"). I then want to query the database for all entities that are within a given lat/lng. For example, the latitude and longitude for New York City is 40.730610 and -73.935242.

I assume I should be using ST_within() but I have no idea how I would create the query... in that example, it uses ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))') but I have no idea as to how I would construct the POLYGON or if that is even the solution I am looking for.

If anyone can help or point in the direction of a resource explaining it, I would be very grateful.

U4EA
  • 832
  • 1
  • 12
  • 27
  • 1
    A pair of lat/long coordinates mark a point, not an area. No other point can fall within a point. You either have to get NY City area as a polygon or you have to make an assumption that points within X miles/kms radius from the lat/long coordinates fall within NYC. – Shadow Feb 28 '20 at 20:14
  • 1
    But perhaps not so good with google? ;-) – Strawberry Feb 28 '20 at 21:27

0 Answers0