<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>depending on the parameters you defined in spatial_ref_sys,
PostGIS decides how to process the transformation, see
<a class="moz-txt-link-freetext" href="https://blog.cleverelephant.ca/2019/02/proj4-postgis.html">https://blog.cleverelephant.ca/2019/02/proj4-postgis.html</a><br>
Try to define proj4text only:<br>
</p>
<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9,0pt;"><span style="color:#0033b3;">insert into </span><span style="color:#000000;">
public</span>.<span style="color:#000000;">spatial_ref_sys </span>(<span style="color:#871094;">srid</span>, <span style="color:#871094;">proj4text</span>)
<span style="color:#0033b3;"> select </span><span style="color:#1750eb;">93004</span>, <span style="color:#871094;">proj4text </span><span style="color:#0033b3;">from </span><span style="color:#000000;">spatial_ref_sys </span><span style="color:#0033b3;">where </span><span style="color:#871094;">srid </span>= <span style="color:#1750eb;">3004</span>;
<span style="color:#0033b3;">
update </span><span style="color:#000000;">spatial_ref_sys
</span><span style="color:#0033b3;"> set </span><span style="color:#871094;">proj4text </span>= <span style="color:#067d17;">'+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 +ellps=intl +nadgrids= +units=m +no_defs'
</span><span style="color:#0033b3;">where </span><span style="color:#871094;">srid </span>= <span style="color:#1750eb;">93004;
<font color="#000000">Florian</font>
</span></pre>
<div class="moz-cite-prefix">Am 16.12.2021 um 10:57 schrieb andy:<br>
</div>
<blockquote type="cite"
cite="mid:CAHEdGZN7=NJ0AAsUv_nwZG0SRWf2AO6f7gi1=fCtJM=meJtPpQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi,
<div>I have a NTV2 file, and it works properly if I hardcode the
parameters in the query:</div>
<div><br>
</div>
<div>SELECT ST_AsText(<br>
ST_Transform(<br>
ST_GeomFromText('POINT(13.335462
41.132282)',4326),3004<br>
)<br>
) AS not_corrected,<br>
ST_AsText(<br>
ST_Transform(<br>
ST_GeomFromText('POINT(13.335462
41.132282)',4326),<br>
'+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000<br>
+y_0=0 +ellps=intl<br>
+nadgrids=40441123_43581445_R40_F00.gsb +units=m +no_defs'<br>
)<br>
) AS corrected;<br>
</div>
<div><br>
</div>
<div>The output is:</div>
<div><br>
</div>
<div>- POINT(2380292.276247742 4554785.392090227)</div>
<div>- POINT(2380294.3337390865 4554784.22045453)</div>
<div><br>
</div>
<div>If I insert it in PostGIS</div>
<div><br>
</div>
<div>-- create new record</div>
<div>insert into public.spatial_ref_sys (srid, auth_name,
auth_srid, srtext, proj4text) select 93004 , auth_name,
auth_srid, srtext, proj4text from spatial_ref_sys where srid =
3004;<br>
<br>
-- update it<br>
update spatial_ref_sys set proj4text = '+proj=tmerc +lat_0=0
+lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 +ellps=intl
+nadgrids=40441123_43581445_R40_F00.gsb +units=m +no_defs'
where srid = 93004<br>
</div>
<div><br>
</div>
<div>and then I run</div>
<div><br>
</div>
<div>SELECT ST_AsText(<br>
ST_Transform(<br>
ST_GeomFromText('POINT(13.335462
41.132282)',4326),3004<br>
)<br>
) AS not_corrected,<br>
ST_AsText(<br>
ST_Transform(<br>
ST_GeomFromText('POINT(13.335462
41.132282)',4326),93004<br>
)<br>
) AS corrected;<br>
</div>
<div><br>
</div>
<div>I obtain two equal results, as if it did not apply what was
read in the proj string in spatial_ref_sys:</div>
<div><br>
</div>
<div>- POINT(2380292.276247742 4554785.392090227)</div>
<div>- POINT(2380292.276247742 4554785.392090227)</div>
<div><br>
</div>
<div>I'm using PostgreSQL 13.5, compiled by Visual C++ build
1914, 64-bit, 3.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1</div>
<div><br>
</div>
<div>I can't figure out what the problem could be. Why does it
work hardcoded and not via spatial_ref_sys?</div>
<div><br>
</div>
<div>Thank you<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr"><span
style="font-size:small">___________________</span><br>
</div>
<div dir="ltr"><span
style="font-size:small"><br>
</span></div>
<div dir="ltr">Andrea Borruso<br>
website: <a
href="https://medium.com/tantotanto"
target="_blank"
moz-do-not-send="true"
class="moz-txt-link-freetext">https://medium.com/tantotanto</a><br>
38° 7' 48" N, 13° 21' 9" E,
EPSG:4326<br>
<span style="font-size:small">___________________</span><br>
<br>
"cercare e saper riconoscere chi e
cosa,<br>
in mezzo all’inferno, non è
inferno, <br>
e farlo durare, e dargli spazio"<br>
<br>
Italo Calvino<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/postgis-users">https://lists.osgeo.org/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
CYBERTEC PostgreSQL International GmbH
Römerstraße 19, A-2752 Wöllersdorf
Web: <a class="moz-txt-link-freetext" href="https://www.cybertec-postgresql.com">https://www.cybertec-postgresql.com</a></pre>
</body>
</html>