<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Luca,<div class=""><br class=""></div><div class="">My guess is that by using ST_Within() you expect to find points that are <i class="">inside</i> a line (!) and you don't find any.  The doc says ST_Within() "... returns TRUE if geometry A is completely inside geometry B".</div><div class="">So either you use another function (like ST_DWithin), or you make a buffer of your lines ->  AND ST_Within(reporting_point_ec.coords::geometry, ST_Buffer(way, 1)) .  Whatever alternative you choose you will have to decide what distance you expect your points to be from a line (here I put 1 m), and you might have points that are close enough from more than one line, which would probably be a problem as well.  </div><div class=""><br class=""></div><div class="">HTH,</div><div class="">Didier</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">Le 7 avr. 2022 à 14:55, Luca Bertoncello <<a href="mailto:lucabert@lucabert.de" class="">lucabert@lucabert.de</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi list!<br class=""><br class="">I have a little think error and I'm not sure how to solve my problem...<br class=""><br class="">So, I have a table:<br class=""><br class="">gis=# \d reporting_point_ec<br class="">                      Tabelle »public.reporting_point_ec«<br class="">  Spalte   |          Typ          | Sortierfolge | NULL erlaubt? | Vorgabewert<br class="">-----------+-----------------------+--------------+---------------+-------------<br class=""> name      | text                  |              |               |<br class=""> coords    | geography(Point,4326) |              |               |<br class=""> latitude  | numeric(16,13)        |              |               |<br class=""> longitude | numeric(16,13)        |              |               |<br class="">Indexe:<br class="">    "idx_reportingpoint" btree (coords)<br class=""><br class="">this contains the reportings point in Europe.<br class="">I want to join it with planet_osm_roads in order to create a new table where all the reporting points have a column with the country.<br class="">So my query:<br class=""><br class="">CREATE TABLE ifr_reportingpoints (name, country, country_code, latitude, longitude) AS<br class="">  SELECT<br class="">    reporting_point_ec.name AS reppoint, planet_osm_roads.name AS country, planet_osm_roads.tags->'ISO3166-1' AS country_code,<br class="">    reporting_point_ec.latitude, reporting_point_ec.longitude<br class="">  FROM planet_osm_roads, reporting_point_ec<br class="">  WHERE planet_osm_roads.boundary = 'administrative'<br class="">    AND planet_osm_roads.admin_level = '2'<br class="">    AND planet_osm_roads.osm_id < 0<br class="">    AND ST_Within(reporting_point_ec.coords::geometry, way);<br class=""><br class="">Unfortunately it does not work... :(<br class="">No error, but no data given, too...<br class=""><br class="">I'm pretty sure, the problem is the last condition (ST_Within...).<br class="">Can someone help me?<br class=""><br class="">Thanks a lot<br class="">Luca Bertoncello<br class="">(<a href="mailto:lucabert@lucabert.de" class="">lucabert@lucabert.de</a>)<br class="">_______________________________________________<br class="">postgis-users mailing list<br class=""><a href="mailto:postgis-users@lists.osgeo.org" class="">postgis-users@lists.osgeo.org</a><br class="">https://lists.osgeo.org/mailman/listinfo/postgis-users<br class=""></div></div></blockquote></div><br class=""></div></body></html>