[GRASS-dev] [GRASS GIS] #3332: v.proj - Error in pj_do_transform

#3332: v.proj - Error in pj_do_transform
---------------------------+-------------------------
Reporter: DmitryKolesov | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.1
Component: Default | Version: unspecified
Keywords: | CPU: Unspecified
Platform: Unspecified |
---------------------------+-------------------------
Create test data, test LOCATIONs, then run GRASS GIS:

{{{
# Create the first location:
grass -e -c EPSG:4326 $(pwd)/E4326

# Create test data:
cat > test.geojson << EOF
{
   "type": "FeatureCollection",
   "crs": {
     "type": "name",
     "properties": {
       "name": "urn:ogc:def:crs:EPSG::3857"
     }
   },
   "features": [
     {
       "type": "Feature",
       "properties": {"field2": "123"},
       "geometry": {
         "type": "Point",
         "coordinates": [
           15000823.76479647,
           5781643.081065576
         ]
       }
     },
     {
       "type": "Feature",
       "properties": {"field2": ""},
       "geometry": {
         "type": "Point",
         "coordinates": [
           15019270.955840966,
           5630930.639970958
         ]
       }
     },
     {
       "type": "Feature",
       "properties": {"field2": ""},
       "geometry": {
         "type": "Point",
         "coordinates": [
           15015891.673578057,
           5652388.555190046
         ]
       }
     }
   ]
}
EOF

# Create the second location using provided datafile
grass -e -c test.geojson $(pwd)/TEST

grass $(pwd)/TEST/PERMANENT
}}}

Then run in GRASS session:

{{{
v.in.ogr test.geojson out=test
g.mapset location=E4326 mapset=PERMANENT
v.proj location=TEST in=test
}}}

The result of the last command is the next error:
{{{
WARNING: pj_transform() failed: failed to load datum shift file
ERROR: Error in pj_do_transform
}}}

----

Sorry if I'm duplicating this issue: #1189. But that ticket was created
long ago and Windows-specific. So I decided to create new one.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332&gt;
GRASS GIS <https://grass.osgeo.org>

#3332: v.proj - Error in pj_do_transform
----------------------------+-------------------------
  Reporter: DmitryKolesov | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Default | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
----------------------------+-------------------------

Comment (by mlennert):

Sounds like a similar issues as discussed
[https://lists.osgeo.org/pipermail/grass-user/2016-August/074597.html
here].

Could you try creating your second location using the EPSG code instead of
the GeoJSON file and then attempt to reproject ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3332: v.proj - Error in pj_do_transform
----------------------------+-------------------------
  Reporter: DmitryKolesov | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Default | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
----------------------------+-------------------------

Comment (by DmitryKolesov):

Hm... If I create the second location using EPSG, then the error isn't
raised, import and reprojection became possible.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3332: v.proj - Error in pj_do_transform
---------------------------------+-------------------------
  Reporter: DmitryKolesov | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.0
Component: Projections/Datums | Version: 7.2.2
Resolution: | Keywords: v.proj
       CPU: Unspecified | Platform: Unspecified
---------------------------------+-------------------------
Changes (by neteler):

* keywords: => v.proj
* version: unspecified => 7.2.2
* component: Default => Projections/Datums
* milestone: 7.2.3 => 7.4.0

Comment:

Potentially good news: I have reproduced your perfectly reported test case
and it works in GRASS GIS 7.4.svn (to become 7.4.0):

{{{
# last step of test case:
GRASS 7.4.0svn (TEST):~/tmp > v.proj location=TEST in=test
Reprojecting primitives ...
Building topology for vector map <test@PERMANENT>...
Registering primitives...
3 primitives registered
3 vertices registered
Building areas...
  100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
  100%
Number of nodes: 0
Number of primitives: 3
Number of points: 3
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0

GRASS 7.4.0svn (TEST):~/tmp > v.info test -e
name=test
mapset=PERMANENT
location=E4326
database=/home/mneteler/tmp
title=
scale=1:1
creator=mneteler
organization=
source_date=Thu Jan 4 23:19:53 2018
timestamp=none
format=native
level=2
num_dblinks=1
attribute_layer_number=1
attribute_layer_name=OGRGeoJSON
attribute_database=/home/mneteler/tmp/E4326/PERMANENT/sqlite/sqlite.db
attribute_database_driver=sqlite
attribute_table=test
attribute_primary_key=cat
projection=Latitude-Longitude
digitization_threshold=0.000000
comment=
}}}

It finally looks as expected.

Could you please try with 7.4.0RC1 or, even better, the weekly source code
snapshot [1] (or SVN branch)?

[1] https://grass.osgeo.org/grass74/source/snapshot/

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3332: v.proj - Error in pj_do_transform
---------------------------------+-------------------------
  Reporter: DmitryKolesov | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.1
Component: Projections/Datums | Version: 7.2.2
Resolution: | Keywords: v.proj
       CPU: Unspecified | Platform: Unspecified
---------------------------------+-------------------------

Comment (by DmitryKolesov):

Thank you for the fixing,
the transformation works correctly, the error is not appear.

Should I close the issue?

PS Sorry for the delay with my answer.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#3332: v.proj - Error in pj_do_transform
---------------------------------+-------------------------
  Reporter: DmitryKolesov | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.1
Component: Projections/Datums | Version: 7.2.2
Resolution: | Keywords: v.proj
       CPU: Unspecified | Platform: Unspecified
---------------------------------+-------------------------

Comment (by martinl):

Replying to [comment:7 DmitryKolesov]:
> Thank you for the fixing,
> the transformation works correctly, the error is not appear.
>
> Should I close the issue?

yes, feel free to close.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>

#3332: v.proj - Error in pj_do_transform
---------------------------------+-------------------------
  Reporter: DmitryKolesov | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.4.1
Component: Projections/Datums | Version: 7.2.2
Resolution: fixed | Keywords: v.proj
       CPU: Unspecified | Platform: Unspecified
---------------------------------+-------------------------
Changes (by DmitryKolesov):

* status: new => closed
* resolution: => fixed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3332#comment:9&gt;
GRASS GIS <https://grass.osgeo.org>