geoprojection.projectionparam return false

Feb 28, 2012 at 3:47 PM

hI,

before merging two shapefiles I'm testing their projections, they can be diffenrent but equivalent so I tried the following code, but projectionparam always retern false. GeogCSParam works fine. I'm using VB6

    Dim pVal1 As Double, pVal2 As Double
    Dim succ As Boolean
    If Not sf1.GeoProjection.IsProjected = sf2.GeoProjection.IsProjected Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
    If Not Round(sf1.GeoProjection.SemiMajor, 0) = Round(sf2.GeoProjection.SemiMajor, 0) Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
    If Not Round(sf1.GeoProjection.SemiMinor, 0) = Round(sf2.GeoProjection.SemiMinor, 0) Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
    pVal1 = 0: pVal2 = 0
    succ = sf1.GeoProjection.GeogCSParam(PrimeMeridian, pVal1)
    succ = sf2.GeoProjection.GeogCSParam(PrimeMeridian, pVal2)
    If Not pVal1 = pVal2 Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
     pVal1 = 0: pVal2 = 0
    succ = sf1.GeoProjection.GeogCSParam(InverseFlattening, pVal1)
    succ = sf2.GeoProjection.GeogCSParam(InverseFlattening, pVal2)
    If Not Round(pVal1, 1) = Round(pVal2, 1) Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
    If sf1.GeoProjection.IsProjected Then
        pVal1 = 0: pVal2 = 0
        succ = sf1.GeoProjection.ProjectionParam(CentralMeridian, pVal1)
        succ = sf2.GeoProjection.ProjectionParam(CentralMeridian, pVal2)
        If Not pVal1 = pVal2 Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
        pVal1 = 0: pVal2 = 0
        succ = sf1.GeoProjection.ProjectionParam(FalseEasting, pVal1)
        succ = sf2.GeoProjection.ProjectionParam(FalseEasting, pVal2)
        If Not pVal1 = pVal2 Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
        pVal1 = 0: pVal2 = 0
        succ = sf1.GeoProjection.ProjectionParam(FalseNorthing, pVal1)
        succ = sf2.GeoProjection.ProjectionParam(FalseNorthing, pVal2)
        If Not pVal1 = pVal2 Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
        pVal1 = 0: pVal2 = 0
        succ = sf1.GeoProjection.ProjectionParam(LatitudeOfOrigin, pVal1)
        succ = sf2.GeoProjection.ProjectionParam(LatitudeOfOrigin, pVal2)
        If Not pVal1 = pVal2 Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
        pVal1 = 0: pVal2 = 0
        succ = sf1.GeoProjection.ProjectionParam(LongitudeOfOrigin, pVal1)
        succ = sf2.GeoProjection.ProjectionParam(LongitudeOfOrigin, pVal2)
        If Not pVal1 = pVal2 Then MsgBox "les deux inventaires n'ont pas le m�me syst�me de projection", vbCritical, "op�ration annul�e": Me.Height = 3000: GoTo cancel
        pVal1 = 0: pVal2 = 0
        succ = sf1.GeoProjection.ProjectionParam(ScaleFactor, pVal1)
        succ = sf2.GeoProjection.ProjectionParam(ScaleFactor, pVal2)
       
    End If

 

the two shapefiles have valid prj files :

PROJCS["NTF_Lambert_II_étendu",GEOGCS["GCS_NTF",DATUM["D_NTF",SPHEROID["Clarke_1880_IGN",6378249.2,293.46602]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",600000.0],PARAMETER["False_Northing",2200000.0],PARAMETER["Central_Meridian",2.3372291667],PARAMETER["Standard_Parallel_1",45.8989188889],PARAMETER["Standard_Parallel_2",47.6960144444],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",46.8],UNIT["Meter",1.0]]

PROJCS["Lambert II Carto, Méridien de Paris",GEOGCS["NTF-PM",DATUM["D_NTF-PM",SPHEROID["Clarke_1880",6378249.145,293.4650060791175]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",45.898918964419],PARAMETER["standard_parallel_2",47.696014502038],PARAMETER["latitude_of_origin",46.8],PARAMETER["central_meridian",2.337229104484],PARAMETER["false_easting",600000],PARAMETER["false_northing",2200000],UNIT["Meter",1]]

 

PROJCS["Lambert II Carto, Méridien de Paris",GEOGCS["NTF-PM",DATUM["D_NTF-PM",SPHEROID["Clarke_1880",6378249.145,293.4650060791175]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",45.898918964419],PARAMETER["standard_parallel_2",47.696014502038],PARAMETER["latitude_of_origin",46.8],PARAMETER["central_meridian",2.337229104484],PARAMETER["false_easting",600000],PARAMETER["false_northing",2200000],UNIT["Meter",1]]