FME Community Answers
FMEpedia
FME Community Answers
Error
This content is not currently supported on this browser.
AGAG 

Why the PythonCall local polyconic reproject on LL27 gives incorrect results, but WGS84 give correct ones

I have a pythoncaller that does a local polyconic reprojection. The orgin point  is (sur_long, sur_lat,z) = (-87.9960175,28.6407318,0.0) and the point to be reprojected to (lat,long,z)  is (xoffset,yoffset,zoffset) = (0.0,0.0,0.0).  Here is the pythoncaller code:

class myPythonFactory(object):
    def __init__(self):
        self.count_features = 0
        self.logger = pyfme.FMELogfile()
       
    def input(self,feature):
        uwi = str(feature.getAttribute('WELL_ID'))
        surf_lat = float(feature.getAttribute('SURF_LAT'))
        surf_long = float(feature.getAttribute('SURF_LONG'))
        x_offset = float(feature.getAttribute('XOFFSET'))
        y_offset = float(feature.getAttribute('YOFFSET'))
        z_depth = float(feature.getAttribute('TVD'))
          
        #myCSMan = pyfme.FMECoordSysManager() defined in startup python
        fmeParams['PARM1'] = str(surf_long)
        fmeParams['ORG_LAT'] = str(surf_lat)
          
        myfmeCS = myCSMan.defineCoordSys(fmeParams, "myfmeCS")
           
        pointF = pyfme.FMEFeature()
        pointF.resetCoords()
       
        pointF.setDimension(3)
        pointF.addCoordinates([x_offset], [y_offset], [z_depth])
        pointF.setGeometryType(pyfme.FME_GEOM_POINT)
        pointF.performFunction("@Reproject(" + myfmeCS + ",LL27)")
           
        myCoords = pointF.getCoordinates()
        ll = myCoords[0]
        long = float(ll[0])
        lat = float(ll[1])
        z = float(ll[2])
       
        self.logger.log("surf_lat = " + str(surf_lat) + " surf_long = " + str(surf_long) +
                      " x_offset = " + str(x_offset) + " y_offset = " + str(y_offset) +
                      " z_depth = " + str(z_depth) + " lat = " + str(lat) +
                      " long = " + str(long) + " z = " + str(z))
                          
        #set lat/long
        feature.setAttribute('LATITUDE',str(lat))
        feature.setAttribute('LONGITUDE',str(long))   
                        
        #self.logger.log('Processing uwi: ' + uwi)
        self.pyoutput(feature)
       
    def close(self):
        self.logger.log('Total features processed: ' + str(self.count_features))

I would expect for this point, the result (long,lat) would be equal to (surf_long,surf_lat). But it is not. The results is

surf_lat = 28.6407318 surf_long = -87.9960175 x_offset = 0.0 y_offset = 0.0 z_depth = 0.0 lat = 28.6404917546 long = -87.9960290212 z = 0.0
 which is about 180 feett off what it should be. I also tried LL27-48 et al, the results are the same as LL27.

However, if I change LL27 to LL-WGS84, the resulting (long,lat) will be the exactly the same as (surf_long,surf_lat):
surf_lat = 28.6407318 surf_long = -87.9960175 x_offset = 0.0 y_offset = 0.0 z_depth = 0.0 lat = 28.6407318 long = -87.9960175 z = 0.0.

What I need to do to make LL27 reprojection correct?

Allen Guan
Nexen USA
AGAG
BTW, here are the actual results running with LL27. Look like a complex process which involved a shift:


........
FME Configuration: Using FME Reprojection Engine

Reprojector: Using datum conversion type `Wgs84ToNad83' when reprojecting from myfmeCS0 to LL27

Reprojector: Using datum conversion type `Nad83ToNad27' when reprojecting from myfmeCS0 to LL27

Reprojector:`Nad83ToNad27' will use the following grid shift files:

Reprojector: .\GridData\Canada\ntv2_0.gsb,,,0.5

Reprojector: NADCON grid shift files for the US and its territories

Reprojector: The following fallback datum will be used `NAD27-48'

surf_lat = 28.6407318 surf_long = -87.9960175 x_offset = 0.0 y_offset = 0.0 z_depth = 0.0 lat = 28.6404917546 long = -87.9960290212 z = 0.0

.......

AGAG
I did more tests: if I transform the source (surf_long,surf_lat)  from LL27 to LL-WGS84 before it goes into the PythonCall reprojection, and then after the Pythoncaller reprojection, transform it back to LL27. The results are very close to to original (long,lat). I am happy with the results, but I wish I don't need to use these two extra AttributeReprojectors.

Allen Guan
Nexen USA