[GRASS-user] Unable to export vector data after upgrading to GRASS 8

Hi,
I tried to export a vector file to use it in another application. The module returns an error message that says “Unable to create OGR spatial reference”. The detailed output is here:

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT output=/home/amit/Documents/mdg_aoi2_.gpkg
ERROR 10: Pointer ‘hSRS’ is NULL in ‘OSRImportFromWkt’.
ERROR: Unable to create OGR spatial reference

Projection info

g.proj -p
-PROJ_INFO-------------------------------------------------
name : unknown
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
towgs84 : 0.000,0.000,0.000
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

I cannot figure out where I am wrong. Can you suggest an alternative?

Hello:

On 04/04/2022 13:38, Amit Ghosh wrote:

Hi,
I tried to export a vector file to use it in another application. The module returns an error message that says "Unable to create OGR spatial reference". The detailed output is here:

    v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT
    output=/home/amit/Documents/mdg_aoi2_.gpkg
    ERROR 10: Pointer 'hSRS' is NULL in 'OSRImportFromWkt'.
    ERROR: Unable to create OGR spatial reference

Projection info

    g.proj -p
    -PROJ_INFO-------------------------------------------------

I would guess that this is the problem:

    name : unknown
    datum : wgs84
    ellps : wgs84
    proj : aea
    lat_0 : 0
    lon_0 : 25
    lat_1 : 20
    lat_2 : -23
    x_0 : 0
    y_0 : 0
    no_defs : defined
    towgs84 : 0.000,0.000,0.000
    -PROJ_UNITS------------------------------------------------
    unit : meter
    units : meters
    meters : 1

I cannot figure out where I am wrong. Can you suggest an alternative?

How did you initially create the GRASS Location? Is the albers equal area projection described by a standard EPSG code? It appears to be this one:

https://epsg.io/102022

**IF** that's the correct projection, then you should be able to do:

echo "PROJCS["Africa_Albers_Equal_Area_Conic",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["longitude_of_center",25],PARAMETER["Standard_Parallel_1",20],PARAMETER["Standard_Parallel_2",-23],PARAMETER["latitude_of_center",0],UNIT["Meter",1],AUTHORITY["EPSG","102022"]]" | g.proj -c wkt=-

That long WKT string will reset the projection definition of the Location, then you should be able to export OK.

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

Dear Mr. Micha,
Yes, it is EPSG: 102022, I used the proj4 string to create the location.

Many thanks for the solution. It worked. However, the v.out.ogr module exports the file without the CRS.

Projection information updated
(Mon Apr 4 16:44:33 2022) Command finished (0 sec)
(Mon Apr 4 16:44:45 2022)
g.proj -p
-PROJ_INFO-------------------------------------------------
name : Africa_Albers_Equal_Area_Conic
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
-PROJ_SRID-------------------------------------------------
SRID : EPSG:102022
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT output=/home/amit/Documents/mdg_unsalb_east_mdg.gpkg format=GPKG
proj_create: crs not found
Exporting 7 areas (may take some time)…
v.out.ogr complete. 7 features (Polygon type) written to <MDG_UNSALB_admin3_selectionSN5> (GPKG format).
(Mon Apr 4 16:45:39 2022) Command finished (0 sec)

Kind regards,
Amit

On Mon, 4 Apr 2022 at 16:33, Micha Silver <tsvibar@gmail.com> wrote:

Hello:

On 04/04/2022 13:38, Amit Ghosh wrote:

Hi,
I tried to export a vector file to use it in another application. The
module returns an error message that says “Unable to create OGR
spatial reference”. The detailed output is here:

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT
output=/home/amit/Documents/mdg_aoi2_.gpkg
ERROR 10: Pointer ‘hSRS’ is NULL in ‘OSRImportFromWkt’.
ERROR: Unable to create OGR spatial reference

Projection info

g.proj -p
-PROJ_INFO-------------------------------------------------

I would guess that this is the problem:

name : unknown
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
towgs84 : 0.000,0.000,0.000
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

I cannot figure out where I am wrong. Can you suggest an alternative?

How did you initially create the GRASS Location? Is the albers equal
area projection described by a standard EPSG code? It appears to be this
one:

https://epsg.io/102022

IF that’s the correct projection, then you should be able to do:

echo
“PROJCS[“Africa_Albers_Equal_Area_Conic”,GEOGCS[“GCS_WGS_1984”,DATUM[“WGS_1984”,SPHEROID[“WGS_1984”,6378137,298.257223563]],PRIMEM[“Greenwich”,0],UNIT[“Degree”,0.017453292519943295]],PROJECTION[“Albers_Conic_Equal_Area”],PARAMETER[“False_Easting”,0],PARAMETER[“False_Northing”,0],PARAMETER[“longitude_of_center”,25],PARAMETER[“Standard_Parallel_1”,20],PARAMETER[“Standard_Parallel_2”,-23],PARAMETER[“latitude_of_center”,0],UNIT[“Meter”,1],AUTHORITY[“EPSG”,“102022”]]”
| g.proj -c wkt=-

That long WKT string will reset the projection definition of the
Location, then you should be able to export OK.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

···

On 04/04/2022 14:29, Amit Ghosh wrote:

Dear Mr. Micha,
Yes, it is EPSG: 102022, I used the proj4 string to create the location.

Many thanks for the solution. It worked. However, the v.out.ogr module exports the file without the CRS.

What does v.info MDG_UNSALB_admin3_selectionSN5 show ??

Projection information updated
(Mon Apr 4 16:44:33 2022) Command finished (0 sec)
(Mon Apr 4 16:44:45 2022)
g.proj -p
-PROJ_INFO-------------------------------------------------
name : Africa_Albers_Equal_Area_Conic
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
-PROJ_SRID-------------------------------------------------
SRID : EPSG:102022
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT output=/home/amit/Documents/mdg_unsalb_east_mdg.gpkg format=GPKG
proj_create: crs not found
Exporting 7 areas (may take some time)…
v.out.ogr complete. 7 features (Polygon type) written to <MDG_UNSALB_admin3_selectionSN5> (GPKG format).
(Mon Apr 4 16:45:39 2022) Command finished (0 sec)

Kind regards,
Amit

On Mon, 4 Apr 2022 at 16:33, Micha Silver <tsvibar@gmail.com> wrote:

Hello:

On 04/04/2022 13:38, Amit Ghosh wrote:

Hi,
I tried to export a vector file to use it in another application. The
module returns an error message that says “Unable to create OGR
spatial reference”. The detailed output is here:

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT
output=/home/amit/Documents/mdg_aoi2_.gpkg
ERROR 10: Pointer ‘hSRS’ is NULL in ‘OSRImportFromWkt’.
ERROR: Unable to create OGR spatial reference

Projection info

g.proj -p
-PROJ_INFO-------------------------------------------------

I would guess that this is the problem:

name : unknown
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
towgs84 : 0.000,0.000,0.000
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

I cannot figure out where I am wrong. Can you suggest an alternative?

How did you initially create the GRASS Location? Is the albers equal
area projection described by a standard EPSG code? It appears to be this
one:

https://epsg.io/102022

IF that’s the correct projection, then you should be able to do:

echo
“PROJCS[“Africa_Albers_Equal_Area_Conic”,GEOGCS[“GCS_WGS_1984”,DATUM[“WGS_1984”,SPHEROID[“WGS_1984”,6378137,298.257223563]],PRIMEM[“Greenwich”,0],UNIT[“Degree”,0.017453292519943295]],PROJECTION[“Albers_Conic_Equal_Area”],PARAMETER[“False_Easting”,0],PARAMETER[“False_Northing”,0],PARAMETER[“longitude_of_center”,25],PARAMETER[“Standard_Parallel_1”,20],PARAMETER[“Standard_Parallel_2”,-23],PARAMETER[“latitude_of_center”,0],UNIT[“Meter”,1],AUTHORITY[“EPSG”,“102022”]]”
| g.proj -c wkt=-

That long WKT string will reset the projection definition of the
Location, then you should be able to export OK.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

It shows:

v.info MDG_UNSALB_admin3_selectionSN5@PERMANENT
±---------------------------------------------------------------------------+
| Name: MDG_UNSALB_admin3_selectionSN5 |
| Mapset: PERMANENT |
| Location: southern_africa_grass |
| Database: /run/media/amit/InternalHD/FAO/country |
| Title: |
| Map scale: 1:1 |
| Name of creator: amit |
| Organization: |
| Source date: Tue Mar 22 17:47:24 2022 |

Timestamp (first layer): none
Map format: native
----------------------------------------------------------------------------
Type of map: vector (level: 2)
Number of points: 0 Number of centroids: 7
Number of lines: 0 Number of boundaries: 27
Number of areas: 7 Number of islands: 2
Map is 3D: No
Number of dblinks: 1
Projection: Africa_Albers_Equal_Area_Conic
N: -2374864.5344628 S: -2811333.16032851
E: 2422280.61532197 W: 2266547.34604055
Digitization threshold: 0
Comment:
±---------------------------------------------------------------------------+

On Mon, 4 Apr 2022 at 17:20, Micha Silver <tsvibar@gmail.com> wrote:

On 04/04/2022 14:29, Amit Ghosh wrote:

Dear Mr. Micha,
Yes, it is EPSG: 102022, I used the proj4 string to create the location.

Many thanks for the solution. It worked. However, the v.out.ogr module exports the file without the CRS.

What does v.info MDG_UNSALB_admin3_selectionSN5 show ??

Projection information updated
(Mon Apr 4 16:44:33 2022) Command finished (0 sec)
(Mon Apr 4 16:44:45 2022)
g.proj -p
-PROJ_INFO-------------------------------------------------
name : Africa_Albers_Equal_Area_Conic
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
-PROJ_SRID-------------------------------------------------
SRID : EPSG:102022
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT output=/home/amit/Documents/mdg_unsalb_east_mdg.gpkg format=GPKG
proj_create: crs not found
Exporting 7 areas (may take some time)…
v.out.ogr complete. 7 features (Polygon type) written to <MDG_UNSALB_admin3_selectionSN5> (GPKG format).
(Mon Apr 4 16:45:39 2022) Command finished (0 sec)

Kind regards,
Amit

On Mon, 4 Apr 2022 at 16:33, Micha Silver <tsvibar@gmail.com> wrote:

Hello:

On 04/04/2022 13:38, Amit Ghosh wrote:

Hi,
I tried to export a vector file to use it in another application. The
module returns an error message that says “Unable to create OGR
spatial reference”. The detailed output is here:

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT
output=/home/amit/Documents/mdg_aoi2_.gpkg
ERROR 10: Pointer ‘hSRS’ is NULL in ‘OSRImportFromWkt’.
ERROR: Unable to create OGR spatial reference

Projection info

g.proj -p
-PROJ_INFO-------------------------------------------------

I would guess that this is the problem:

name : unknown
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
towgs84 : 0.000,0.000,0.000
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

I cannot figure out where I am wrong. Can you suggest an alternative?

How did you initially create the GRASS Location? Is the albers equal
area projection described by a standard EPSG code? It appears to be this
one:

https://epsg.io/102022

IF that’s the correct projection, then you should be able to do:

echo
“PROJCS[“Africa_Albers_Equal_Area_Conic”,GEOGCS[“GCS_WGS_1984”,DATUM[“WGS_1984”,SPHEROID[“WGS_1984”,6378137,298.257223563]],PRIMEM[“Greenwich”,0],UNIT[“Degree”,0.017453292519943295]],PROJECTION[“Albers_Conic_Equal_Area”],PARAMETER[“False_Easting”,0],PARAMETER[“False_Northing”,0],PARAMETER[“longitude_of_center”,25],PARAMETER[“Standard_Parallel_1”,20],PARAMETER[“Standard_Parallel_2”,-23],PARAMETER[“latitude_of_center”,0],UNIT[“Meter”,1],AUTHORITY[“EPSG”,“102022”]]”
| g.proj -c wkt=-

That long WKT string will reset the projection definition of the
Location, then you should be able to export OK.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

If you can retrace your steps from scratch, and reproduce the same error, it would be helpful to file a bug report.

Here’s a similar issue:

https://github.com/OSGeo/grass/issues/2187

If you have a github account, would you add details of your setup, the procedure and the error result there?

Regards,

Micha

···

On 04/04/2022 15:08, Amit Ghosh wrote:

It shows:

v.info MDG_UNSALB_admin3_selectionSN5@PERMANENT
±---------------------------------------------------------------------------+
| Name: MDG_UNSALB_admin3_selectionSN5 |
| Mapset: PERMANENT |
| Location: southern_africa_grass |
| Database: /run/media/amit/InternalHD/FAO/country |
| Title: |
| Map scale: 1:1 |
| Name of creator: amit |
| Organization: |
| Source date: Tue Mar 22 17:47:24 2022 |

Timestamp (first layer): none
Map format: native
----------------------------------------------------------------------------
Type of map: vector (level: 2)
Number of points: 0 Number of centroids: 7
Number of lines: 0 Number of boundaries: 27
Number of areas: 7 Number of islands: 2
Map is 3D: No
Number of dblinks: 1
Projection: Africa_Albers_Equal_Area_Conic
N: -2374864.5344628 S: -2811333.16032851
E: 2422280.61532197 W: 2266547.34604055
Digitization threshold: 0
Comment:
±---------------------------------------------------------------------------+

On Mon, 4 Apr 2022 at 17:20, Micha Silver <tsvibar@gmail.com> wrote:

On 04/04/2022 14:29, Amit Ghosh wrote:

Dear Mr. Micha,
Yes, it is EPSG: 102022, I used the proj4 string to create the location.

Many thanks for the solution. It worked. However, the v.out.ogr module exports the file without the CRS.

What does v.info MDG_UNSALB_admin3_selectionSN5 show ??

Projection information updated
(Mon Apr 4 16:44:33 2022) Command finished (0 sec)
(Mon Apr 4 16:44:45 2022)
g.proj -p
-PROJ_INFO-------------------------------------------------
name : Africa_Albers_Equal_Area_Conic
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
-PROJ_SRID-------------------------------------------------
SRID : EPSG:102022
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT output=/home/amit/Documents/mdg_unsalb_east_mdg.gpkg format=GPKG
proj_create: crs not found
Exporting 7 areas (may take some time)…
v.out.ogr complete. 7 features (Polygon type) written to <MDG_UNSALB_admin3_selectionSN5> (GPKG format).
(Mon Apr 4 16:45:39 2022) Command finished (0 sec)

Kind regards,
Amit

On Mon, 4 Apr 2022 at 16:33, Micha Silver <tsvibar@gmail.com> wrote:

Hello:

On 04/04/2022 13:38, Amit Ghosh wrote:

Hi,
I tried to export a vector file to use it in another application. The
module returns an error message that says “Unable to create OGR
spatial reference”. The detailed output is here:

v.out.ogr input=MDG_UNSALB_admin3_selectionSN5@PERMANENT
output=/home/amit/Documents/mdg_aoi2_.gpkg
ERROR 10: Pointer ‘hSRS’ is NULL in ‘OSRImportFromWkt’.
ERROR: Unable to create OGR spatial reference

Projection info

g.proj -p
-PROJ_INFO-------------------------------------------------

I would guess that this is the problem:

name : unknown
datum : wgs84
ellps : wgs84
proj : aea
lat_0 : 0
lon_0 : 25
lat_1 : 20
lat_2 : -23
x_0 : 0
y_0 : 0
no_defs : defined
towgs84 : 0.000,0.000,0.000
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1

I cannot figure out where I am wrong. Can you suggest an alternative?

How did you initially create the GRASS Location? Is the albers equal
area projection described by a standard EPSG code? It appears to be this
one:

https://epsg.io/102022

IF that’s the correct projection, then you should be able to do:

echo
“PROJCS[“Africa_Albers_Equal_Area_Conic”,GEOGCS[“GCS_WGS_1984”,DATUM[“WGS_1984”,SPHEROID[“WGS_1984”,6378137,298.257223563]],PRIMEM[“Greenwich”,0],UNIT[“Degree”,0.017453292519943295]],PROJECTION[“Albers_Conic_Equal_Area”],PARAMETER[“False_Easting”,0],PARAMETER[“False_Northing”,0],PARAMETER[“longitude_of_center”,25],PARAMETER[“Standard_Parallel_1”,20],PARAMETER[“Standard_Parallel_2”,-23],PARAMETER[“latitude_of_center”,0],UNIT[“Meter”,1],AUTHORITY[“EPSG”,“102022”]]”
| g.proj -c wkt=-

That long WKT string will reset the projection definition of the
Location, then you should be able to export OK.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918