title: How to find all points within polygon in postgis?
body: <p>I have locations stored in location_table (point_location geometry), now i draw a polygon on google map and pass that polygon (geometry) to backend, I want to find all the locations that are within that polygon.</p>
  
  <pre><code>SELECT POINT_LOCATION 
  FROM LOCATIONS_TABLW 
  WHERE ST_Contains(GeomFromEWKT(?), POINT_LOCATION);
  </code></pre>
  
  <p>This is giving me random results when I pass the polygon from google maps to backend. Its not giving me all points that are exactly within the polygon. It gives me points that are even outside the polygon.</p>
  
  <p>What is the correct way to find all points within polygon in postgis with accuracy (including border cases also)</p>
  
  <p>Update :
  we tried with st_intersects() it did not work as well.<a href="https://i.stack.imgur.com/6DL6m.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/6DL6m.jpg" alt="enter image description here"></a></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Please find below queries</p>
  
  <p>SRID=4326;POLYGON((-103.30549637500008 20.852735681153252,-103.08103481249998 20.612974162085475,-101.6261045 20.537532106266806,-99.83567868749998 20.395877027062447,-99.80306537500002 22.0572706994358,-99.64994812500004 28.918636198451633,-121.1212769375 8.69559423007209,-103.30549637500008 20.852735681153252))
  SRID=4326;POINT(-103.496956 20.722446)
  SRID=4326;POINT(-103.4955 20.723544)</p>
  
  <p>select ST_Intersects(GeomFromEWKT('SRID=4326;POINT(-103.496956 20.722446)'), GeomFromEWKT('SRID=4326;POLYGON((-103.30549637500008 20.852735681153252,-10
  3.08103481249998 20.612974162085475,-101.6261045 20.537532106266806,-99.83567868749998 20.395877027062447,-99.80306537500002 22.0572706994358,-99.64994812500004 28.918
  636198451633,-121.1212769375 8.69559423007209,-103.30549637500008 20.852735681153252))'));
  This Should Return False, but it's returning true.</p>