This query returns the IDs of all those points:
WITH chosen AS (SELECT * FROM ST_SetSRID (ST_MakePoint ($1, $2), 4326)) SELECT mypoints.id FROM mypoints, chosen WHERE ST_DWithin (mypoints.location::geography, chosen.ST_SetSRID::geography, $3);
The ::geography casts are needed here to use meters as measurement unit instead of degrees. $1,$2 is lon,lat, $3 is the chosen distance in meters.
Clientside, only the markers resulting from the query receive full opacity and I also display a google.maps.Circle with the chosen distance as radius. As you can see on the picture below, some markers that should be highlighted if you trust the red circle are not returned by my query. The difference also only seems to occur on the X-axis.
Now what is wrong here?
Is the circle shape from the GMaps JS API inaccurate for my region (Germany)?
Or am I missing something in my query?
So far, i really think that martin_f is right about the distortion. There are multiple coordinate systems involved here: https://stackoverflow.com/questions/15015946/google-map-api-v3-projection