[gdal-dev] TypeError Wrong number or type of arguments for overloaded function 'CoordinateTransformation_TransformPoint'.

zerovirus123 briansia93 at gmail.com
Tue Jun 15 21:41:21 PDT 2021


I am trying to run some GDAL operations inside my Anaconda environment.
However once I upgraded my gdal and other packages the program crashed.

Environment: Anaconda

Package               Version                  Channel
GDAL                   3.3.0                      pipwin
fiona                     1.8.20                    pipwin
geopandas           0.9.0                      pipwin
shapely                1.7.1                      pipwin
pyproj                   2.6.1.post1            py37hcfa1391_1

Here is the offending code.

crsGeo = osgeo.osr.SpatialReference()
crsGeo.ImportFromEPSG(int(proj_type))
t = osgeo.osr.CoordinateTransformation(crs, crsGeo)
(lat, long, z) = t.TransformPoint(posX, posY)<-------------------
srs = osgeo.osr.SpatialReference(wkt=prj)  

And the raster's metadata.
/proj:  GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AXIS["Latitude",NORTH],
    AXIS["Longitude",EAST],
    AUTHORITY["EPSG","4326"]]
proj type:  4326/

The code threw the following error.

*ERROR 1: PROJ: proj_create_from_database:
C:\Users\Deployment\.conda\envs\sw_py37_cv45\Library\share\proj\proj.db
lacks DATABASE.LAYOUT.VERSION.MAJOR / DATABASE.LAYOUT.VERSION.MINOR
metadata. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create_from_database:
C:\Users\Deployment\.conda\envs\sw_py37_cv45\Library\share\proj\proj.db
lacks DATABASE.LAYOUT.VERSION.MAJOR / DATABASE.LAYOUT.VERSION.MINOR
metadata. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create: unrecognized format / unknown name
ERROR 6: Cannot find coordinate operations from `GEOGCRS["WGS
84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS
84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["latitude",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["longitude",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]'
to `'
Could not calculate crsGeo spatial reference.
F:\Sliding_Windows\GeoTiff.py, line 402: TypeError Wrong number or type of
arguments for overloaded function 'CoordinateTransformation_TransformPoint'.
  Possible C/C++ prototypes are:
    OSRCoordinateTransformationShadow::TransformPoint(double [3])
    OSRCoordinateTransformationShadow::TransformPoint(double [4])
    OSRCoordinateTransformationShadow::TransformPoint(double
[3],double,double,double)
    OSRCoordinateTransformationShadow::TransformPoint(double
[4],double,double,double,double)*

Based on previous posts, it seems that proj.dll is missing from some PATH
variable. My environment only has a proj_6_2.dll, and even with that added
to my system's PATH, the error persists.

I have tried to put posX and posY inside tuples/list as well, but that did
not help.

Is this a package mismatch issue? Missing dependencies issue? Or was there a
change in how TransformPoint should be called?


        



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list