<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=us-ascii">
<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:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
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="NO-BOK" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi Donovan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Did you try the suggestion from the error message to use the -o flag?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">That overwrites the projection check and should link the data assuming the projection of your GRASS mapset.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Cheers<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Stefan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> grass-user <grass-user-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Donovan Cameron<br>
<b>Sent:</b> tirsdag 17. august 2021 07:06<br>
<b>To:</b> grass-user@lists.osgeo.org<br>
<b>Subject:</b> Re: [GRASS-user] v.external, postgis materialized views and projection<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 2021-08-16 12:18 p.m., Phillip Allen wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">I am not sure about GRASS's quirks in respect to this problem but I do see in QGIS that in my views I often have to specifically CAST my geometries so QGIS can see the Z & M values:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">example: SELECT b. sample_id, b. au_ppm, b. as_ppm, b. cu_ppm, ST_TRANSFORM(b.geom, 32718 )::geometry(LineStringZM,32718) FROM bore_hole b;<o:p></o:p></p>
</div>
</div>
</blockquote>
<p>Tested on a new set of polygons and casted but it didn't make a difference. GRASS doesn't like ST_Transform on materialized views it looks like.<o:p></o:p></p>
<p>All the views are opening in QGIS fine and with their correct projection and geometry type (with and without casting to a specific type).<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Aug 16, 2021 at 1:10 PM Saulteau Don <<a href="mailto:sault.don@gmail.com">sault.don@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">When I use v.external to load a postgis materialized view it says the projection mismatches the Location but they are actually the same.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">% v.external input="PG:host=localhost dbname=database" layer=table_1 output=t
</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">ERROR: Projection of dataset does not appear to match current location.
</span><o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span style="font-family:"Courier New"">      Location PROJ_INFO is:</span><br>
<span style="font-family:"Courier New"">      name: NAD83 / UTM zone 10N</span><br>
<span style="font-family:"Courier New"">      datum: nad83</span><br>
<span style="font-family:"Courier New"">      ellps: grs80</span><br>
<span style="font-family:"Courier New"">      proj: utm</span><br>
<span style="font-family:"Courier New"">      zone: 10</span><br>
<span style="font-family:"Courier New"">      no_defs: defined</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">      init: EPSG:26910
</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-family:"Courier New""><br>
      Dataset PROJ_INFO is:</span><br>
<span style="font-family:"Courier New"">      name: NAD83 / BC Albers</span><br>
<span style="font-family:"Courier New"">      datum: nad83</span><br>
<span style="font-family:"Courier New"">      ellps: grs80</span><br>
<span style="font-family:"Courier New"">      proj: aea</span><br>
<span style="font-family:"Courier New"">      lat_0: 45</span><br>
<span style="font-family:"Courier New"">      lon_0: -126</span><br>
<span style="font-family:"Courier New"">      lat_1: 50</span><br>
<span style="font-family:"Courier New"">      lat_2: 58.5</span><br>
<span style="font-family:"Courier New"">      x_0: 1000000</span><br>
<span style="font-family:"Courier New"">      y_0: 0</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">      no_defs: defined
</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""><br>
      Difference in: proj <br>
<br>
      In case of no significant differences in the projection definitions, <br>
      use the -o flag to ignore them and use current location definition. <br>
      Consider generating a new location from the input dataset using the <br>
      'location' parameter.</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It looks like GRASS sees the projection from the source table used for the materialized view instead of the materialized views projection that was set in postgis using ST_Transform().<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Is this normal for grass to see materialized views like this?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Donovan<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgrass-user&data=04%7C01%7C%7C542dd240835b472f88ae08d9613cb730%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637647736003704409%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=xICdQBainNrRKS0F3Efppf67CgX%2FugCL9uSsgKIIph8%3D&reserved=0" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><o:p></o:p></p>
</blockquote>
</div>
</blockquote>
</div>
</body>
</html>