<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Never seen that error before. Does your view reference any foreign tables in another database.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>My only guess is maybe some confusion with it reading the geometry table from another database.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Does a query like:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>SELECT P.latitude, P.longitude, P.altitude, ST_AsText(P.point) <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>FROM Phenomena_v AS P<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>LIMIT 10;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>If that doesn’t work what about<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>SELECT P.latitude, P.longitude, P.altitude<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>FROM Phenomena_v AS P<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>LIMIT 10;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>If you can provide the definition of that view, that would be great.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Regina<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>Jeffrey Peacock<br><b>Sent:</b> Wednesday, January 11, 2023 11:32 AM<br><b>To:</b> postgis-users@lists.osgeo.org<br><b>Subject:</b> [postgis-users] Help with ST_Within query issue...<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p>Looking for some insight into why this is happening (2 examples below).<o:p></o:p></p><p>For Postgresql 10:<o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p><span style='font-size:13.5pt;font-family:"Courier New"'>psql gsw<br>psql (14.6 (Ubuntu 14.6-1.pgdg20.04+1), server 10.23 (Ubuntu 10.23-1.pgdg20.04+1))<br>Type "help" for help.<br><br>gsw=# \dx<br> List of installed extensions<br> Name | Version | Schema | Description <br>------------------+---------+------------+---------------------------------------------------------------------<br> plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language<br> postgis | 3.2.1 | public | PostGIS geometry, geography, and raster spatial types and functions<br> postgis_raster | 3.2.1 | public | PostGIS raster types and functions<br> postgis_topology | 3.2.1 | topology | PostGIS topology spatial types and functions<br> postgres_fdw | 1.0 | public | foreign-data wrapper for remote PostgreSQL servers<br> tablefunc | 1.0 | public | functions that manipulate whole tables, including crosstab<br> uuid-ossp | 1.0 | public | generate universally unique identifiers (UUIDs)<br>(7 rows)<br><br>gsw=# \d Phenomena_v<br> View "public.phenomena_v"<br> Column | Type | Collation | Nullable | Default <br>----------------------+--------------------------+-----------+----------+---------<br> id_pk | bigint | | | <br> meta_data_fk | bigint | | | <br> station_id | character varying(256) | | | <br> sensor_id | character varying(256) | | | <br> acquisition_time | timestamp with time zone | | | <br> acquisition_duration | bigint | | | <br> acquisition_period | bigint | | | <br> point | geometry(Point,4326) | | | <br> latitude | double precision | | | <br> longitude | double precision | | | <br> altitude | double precision | | | <br> dimension_id | character varying(256) | | | <br> quantity | character varying(255) | | | <br> units_id | character varying(256) | | | <br> created | timestamp with time zone | | | <br> modified | timestamp with time zone | | | <br><br>gsw=# SELECT P.latitude, P.longitude, P.altitude, ST_AsText(P.point) FROM Phenomena_v AS P<br>gsw-# WHERE<br>gsw-# P.acquisition_time >= '2023-01-08T20:14:43-0700'<br>gsw-# AND P.acquisition_time <= '2023-01-09T20:14:43-0700'<br>gsw-# AND ST_Within(ST_Transform(P.Point, 4326), ST_GeomFromText('POLYGON((34.67010 -119.53618,<br>gsw'# 34.67010 -116.02055,<br>gsw'# 32.72798 -116.02055,<br>gsw'# 32.72798 -119.53618,<br>gsw'# 34.67010 -119.53618))',4326))<br>gsw-# = '1';<br>ERROR: Unknown geometry type: 1025 - Point<br>CONTEXT: parallel worker<br>gsw=#</span><span style='font-size:13.5pt'> </span><o:p></o:p></p></blockquote><p>Postgres 14 (There are points inside the polygon):<o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:13.5pt;font-family:"Courier New"'>psql gsw</span><br><span style='font-size:13.5pt;font-family:"Courier New"'>psql (14.6 (Ubuntu 14.6-1.pgdg22.04+1))</span><br><span style='font-size:13.5pt;font-family:"Courier New"'>Type "help" for help.</span><br><br><span style='font-size:13.5pt;font-family:"Courier New"'>gsw=# \dx</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> List of installed extensions</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> Name | Version | Schema | Description </span><br><span style='font-size:13.5pt;font-family:"Courier New"'>------------------+---------+------------+---------------------------------------------------------------------</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> adminpack | 2.1 | pg_catalog | administrative functions for PostgreSQL</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> pg_freespacemap | 1.2 | public | examine the free space map (FSM)</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> pgstattuple | 1.5 | public | show tuple-level statistics</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> postgis | 3.2.1 | public | PostGIS geometry, geography, and raster spatial types and functions</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> postgis_raster | 3.2.1 | public | PostGIS raster types and functions</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> postgis_topology | 3.2.1 | topology | PostGIS topology spatial types and functions</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> postgres_fdw | 1.1 | public | foreign-data wrapper for remote PostgreSQL servers</span><br><span style='font-size:13.5pt;font-family:"Courier New"'>(8 rows)</span><br><br><span style='font-size:13.5pt;font-family:"Courier New"'>gsw=# \d Phenomena_v</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> View "public.phenomena_v"</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> Column | Type | Collation | Nullable | Default </span><br><span style='font-size:13.5pt;font-family:"Courier New"'>----------------------+--------------------------+-----------+----------+---------</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> id_pk | bigint | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> meta_data_fk | bigint | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> station_id | character varying(256) | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> sensor_id | character varying(256) | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> acquisition_time | timestamp with time zone | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> acquisition_duration | bigint | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> acquisition_period | bigint | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> point | geometry(Point,4326) | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> latitude | double precision | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> longitude | double precision | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> altitude | double precision | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> dimension_id | character varying(256) | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> quantity | character varying(255) | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> units_id | character varying(256) | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> created | timestamp with time zone | | | </span><br><span style='font-size:13.5pt;font-family:"Courier New"'> modified | timestamp with time zone | | | </span><br><br><span style='font-size:13.5pt;font-family:"Courier New"'>gsw=# SELECT P.latitude, P.longitude, P.altitude, ST_AsText(P.point) FROM Phenomena_v AS P</span><br><span style='font-size:13.5pt;font-family:"Courier New"'>WHERE</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> P.acquisition_time >= '2023-01-08T20:14:43-0700'</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> AND P.acquisition_time <= '2023-01-09T20:14:43-0700'</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> AND ST_Within(ST_Transform(P.Point, 4326), ST_GeomFromText('POLYGON((34.67010 -119.53618,</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> 34.67010 -116.02055,</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> 32.72798 -116.02055,</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> 32.72798 -119.53618,</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> 34.67010 -119.53618))',4326))</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> = '1';</span><br><span style='font-size:13.5pt;font-family:"Courier New"'> latitude | longitude | altitude | st_astext </span><br><span style='font-size:13.5pt;font-family:"Courier New"'>----------+-----------+----------+-----------</span><br><span style='font-size:13.5pt;font-family:"Courier New"'>(0 rows)</span><br><br><span style='font-size:13.5pt;font-family:"Courier New"'>gsw=# </span><o:p></o:p></p></blockquote><p>Thanks in advance.<o:p></o:p></p><p>--J<o:p></o:p></p><p><o:p> </o:p></p></div></div></body></html>