ThinkGeo.com    |     Documentation    |     Premium Support

Big issue with projection in x86/x64 mode

Hi,


With 3.0.331, vs2008, vista 64 bits, I'm using the following projection:



ProjectionToWGS84 =


new Proj4Projection( Proj4Projection.GetEpsgParametersString(27572),

Proj4Projection.GetEpsgParametersString(4326));



built in x64 I get the following projection result:


(486 792 ; 2 521 253) => (49°40'41''N ; 0°46'11''E)


built in x86 I get the following projection result:


(486 792 ; 2 521 253) => (49°40'41''N ; 1°34'35''E)


The difference between the 2 projections is more or less 167 km.


The result in x64 is correct.

The result in x86 is incorrect (more than 150 Km from the reality)


Please help, I need to have my program working on both 32 & 64 bits enviroment and I need to be able to run queries on shape file layers (which requiere x86 built for OLEDB for now).


Patrick.



 


 



Patrick, 
  
 We are starting to solve this problem, seems a very difficult one. 
  
 We can create your problem somehow, the two results are different. But In 32bit system, we get the different result with you two, can you double check that too? 
  
 X86:   “01º 34’ 4’‘W 49º 40’ 41’'N” 
  
 The difference is that we get ‘W’ instead of ‘E” as well as some number difference. 
  
  
 Thanks! 
  
 Any more questions just let me know. 
  
 Yale 


No problem here, just a translation issue 
 W in english = E in french. 
  
 So you are getting the same bad result than me 


Hello, 
  
 What is the status of this issue? 
 We were supposed to release our software on Monday and we are waiting for that fix. 
  
 Please keep me posted. 
  
 Patrick.

Patrick, 


This is a known issue in Proj4:
trac.osgeo.org/gdal/ticket/1940
 
We found a way to go around this problem, I think this is the only way we can do, try the following codes:
 

string internalStringX86 = "+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=2.3372291666985 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"; 
string internalStringX64 = "+proj=lcc+lat_1=46.8+lat_0=46.8+lon_0=0+k_0=0.99987742+x_0=600000+y_0=2200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs";

Proj4Projection ProjectionToWGS84 = null;
if (IntPtr.Size == 4)

   ProjectionToWGS84 = new Proj4Projection(internalStringX86, Proj4Projection.GetEpsgParametersString(4326));
}
else
{
   ProjectionToWGS84 = new Proj4Projection(internalStringX64, Proj4Projection.GetEpsgParametersString(4326));
}
ProjectionToWGS84.Open();
PointShape internalPointShape = (PointShape)ProjectionToWGS84.ConvertToExternalProjection(new PointShape(486792, 2521253));
string degreeString = DecimalDegreesHelper.GetDegreesMinutesSecondsStringFromDecimalDegreePoint(internalPointShape);
ProjectionToWGS84.Close();

 

Any more problems just let me know.
 
Thanks.
 
Yale


Thank you yale, it’s working for this particular project. 
  
 However, we are using a lot of projection here and until the bug is fixed, we need the same workaround for the other projection used. 
  
 Here is the list of projection we are using: 
  
 public static String getParameterString(D3EProjectionEnum source) 
     { 
       switch (source) 
       { 
         case D3EProjectionEnum.LambertI: 
           return Proj4Projection.GetEpsgParametersString(27561); 
  
         case D3EProjectionEnum.LambertICarto: 
           return Proj4Projection.GetEpsgParametersString(27571); 
  
         case D3EProjectionEnum.LambertII: 
           return Proj4Projection.GetEpsgParametersString(27562); 
  
         case D3EProjectionEnum.LambertIIe: 
           // 
           //return Proj4Projection.GetEpsgParametersString(27572); 
 // 
           string internalStringX86 = “+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=2.3372291666985 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs”; 
           string internalStringX64 = “+proj=lcc+lat_1=46.8+lat_0=46.8+lon_0=0+k_0=0.99987742+x_0=600000+y_0=2200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs”; 
  
           if (IntPtr.Size == 4) 
             return internalStringX86; 
           else 
             return internalStringX64; 
           break; 
  
         case D3EProjectionEnum.LambertIII: 
           return Proj4Projection.GetEpsgParametersString(27563); 
  
         case D3EProjectionEnum.LambertIIICarto: 
           return Proj4Projection.GetEpsgParametersString(27573); 
  
         case D3EProjectionEnum.LambertIV: 
           return Proj4Projection.GetEpsgParametersString(27564); 
  
         case D3EProjectionEnum.LambertIVCarto: 
           return Proj4Projection.GetEpsgParametersString(27574); 
  
         case D3EProjectionEnum.Lambert93: 
           return Proj4Projection.GetEpsgParametersString(2154); 
  
         case D3EProjectionEnum.CC42: 
           return Proj4Projection.GetEpsgParametersString(3942); 
  
         case D3EProjectionEnum.CC43: 
           return Proj4Projection.GetEpsgParametersString(3943); 
  
         case D3EProjectionEnum.CC44: 
           return Proj4Projection.GetEpsgParametersString(3944); 
  
         case D3EProjectionEnum.CC45: 
           return Proj4Projection.GetEpsgParametersString(3945); 
  
         case D3EProjectionEnum.CC46: 
           return Proj4Projection.GetEpsgParametersString(3946); 
  
         case D3EProjectionEnum.CC47: 
           return Proj4Projection.GetEpsgParametersString(3947); 
  
         case D3EProjectionEnum.CC48: 
           return Proj4Projection.GetEpsgParametersString(3948); 
  
         case D3EProjectionEnum.CC49: 
           return Proj4Projection.GetEpsgParametersString(3949); 
  
         case D3EProjectionEnum.CC50: 
           return Proj4Projection.GetEpsgParametersString(3950); 
  
         case D3EProjectionEnum.WGS84: 
           return Proj4Projection.GetEpsgParametersString(4326); 
  
         case D3EProjectionEnum.UTM83_1N: 
           return Proj4Projection.GetEpsgParametersString(26901); 
  
         case D3EProjectionEnum.UTM83_2N: 
           return Proj4Projection.GetEpsgParametersString(26902); 
  
         case D3EProjectionEnum.UTM83_3N: 
           return Proj4Projection.GetEpsgParametersString(26903); 
  
         case D3EProjectionEnum.UTM83_4N: 
           return Proj4Projection.GetEpsgParametersString(26904); 
  
         case D3EProjectionEnum.UTM83_5N: 
           return Proj4Projection.GetEpsgParametersString(26905); 
  
         case D3EProjectionEnum.UTM83_6N: 
           return Proj4Projection.GetEpsgParametersString(26906); 
  
         case D3EProjectionEnum.UTM83_7N: 
           return Proj4Projection.GetEpsgParametersString(26907); 
  
         case D3EProjectionEnum.UTM83_8N: 
           return Proj4Projection.GetEpsgParametersString(26908); 
  
         case D3EProjectionEnum.UTM83_9N: 
           return Proj4Projection.GetEpsgParametersString(26909); 
  
         case D3EProjectionEnum.UTM83_10N: 
           return Proj4Projection.GetEpsgParametersString(26910); 
  
         case D3EProjectionEnum.UTM83_11N: 
           return Proj4Projection.GetEpsgParametersString(26911); 
  
         case D3EProjectionEnum.UTM83_12N: 
           return Proj4Projection.GetEpsgParametersString(26912); 
  
         case D3EProjectionEnum.UTM83_13N: 
           return Proj4Projection.GetEpsgParametersString(26913); 
  
         case D3EProjectionEnum.UTM83_14N: 
           return Proj4Projection.GetEpsgParametersString(26914); 
  
         case D3EProjectionEnum.UTM83_15N: 
           return Proj4Projection.GetEpsgParametersString(26915); 
  
         case D3EProjectionEnum.UTM83_16N: 
           return Proj4Projection.GetEpsgParametersString(26916); 
  
         case D3EProjectionEnum.UTM83_17N: 
           return Proj4Projection.GetEpsgParametersString(26917); 
  
         case D3EProjectionEnum.UTM83_18N: 
           return Proj4Projection.GetEpsgParametersString(26918); 
  
         case D3EProjectionEnum.UTM83_19N: 
           return Proj4Projection.GetEpsgParametersString(26919); 
  
         case D3EProjectionEnum.UTM83_20N: 
           return Proj4Projection.GetEpsgParametersString(26920); 
  
         case D3EProjectionEnum.UTM83_21N: 
           return Proj4Projection.GetEpsgParametersString(26921); 
  
         case D3EProjectionEnum.UTM83_22N: 
           return Proj4Projection.GetEpsgParametersString(26922); 
  
         case D3EProjectionEnum.UTM83_23N: 
           return Proj4Projection.GetEpsgParametersString(26923); 
  
 Thank you for your help. 
 Patrick.

 


Patrick,
 
We did some investigations on the projection list provided in your previous post!
 
First, some projection srids are not supported Proj4. We did find a search in Google and find nothing about them. So PLEASE make sure you want to use those projections, can you provides the projection strings for them instead of srids?
srid 3942
srid 3943
srid 3944
srid 3945
srid 3946
srid 3947
srid 3948
srid 3949
 
 
Second, we did find we should use different projection strings for x86 and x64 OS, the reason is the same as first talked about. Following is the string you probably take a reference.
 
27561:
X64: 
+proj=lcc+lat_1=49.50000000000001+lat_0=49.50000000000001+lon_0=0+k_0=0.999877341+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
X86:
+proj=lcc+lat_1=49.50000000000001+lat_0=49.50000000000001+lon_0=2.3372291666985+k_0=0.999877341+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
27571:
X64: 
+proj=lcc+lat_1=49.50000000000001+lat_0=49.50000000000001+lon_0=0+k_0=0.999877341+x_0=600000+y_0=1200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
X86:
+proj=lcc+lat_1=49.50000000000001+lat_0=49.50000000000001+lon_0=2.3372291666985+k_0=0.999877341+x_0=600000+y_0=1200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
27562:
X64:
+proj=lcc+lat_1=46.8+lat_0=46.8+lon_0=0+k_0=0.99987742+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
X86:
+proj=lcc+lat_1=46.8+lat_0=46.8+lon_0=2.3372291666985+k_0=0.99987742+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
27563:
X64:
+proj=lcc+lat_1=44.10000000000001+lat_0=44.10000000000001+lon_0=0+k_0=0.999877499+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
X86:
+proj=lcc+lat_1=44.10000000000001+lat_0=44.10000000000001+lon_0=2.3372291666985+k_0=0.999877499+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
27573:
X64:
+proj=lcc+lat_1=44.10000000000001+lat_0=44.10000000000001+lon_0=0+k_0=0.999877499+x_0=600000+y_0=3200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
X86:
+proj=lcc+lat_1=44.10000000000001+lat_0=44.10000000000001+lon_0=2.3372291666985+k_0=0.999877499+x_0=600000+y_0=3200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
27564:
X64:
+proj=lcc+lat_1=42.16500000000001+lat_0=42.16500000000001+lon_0=0+k_0=0.99994471+x_0=234.358+y_0=185861.369+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
X86:
+proj=lcc+lat_1=42.16500000000001+lat_0=42.16500000000001+lon_0=2.3372291666985+k_0=0.99994471+x_0=234.358+y_0=185861.369+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
27574;
X64:
+proj=lcc+lat_1=42.16500000000001+lat_0=42.16500000000001+lon_0=0+k_0=0.99994471+x_0=234.358+y_0=4185861.369+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
X86:
+proj=lcc+lat_1=42.16500000000001+lat_0=42.16500000000001+lon_0=2.3372291666985+k_0=0.99994471+x_0=234.358+y_0=4185861.369+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs
 
 
Any more questions just let me know.
 
Thanks.
 
Yale

Yale, 
  
 Thank you for the workaround. 
  
 The 9 missing EPSG 3942 to 3950 are the french actual official projection zones. 
 Named RGF93 CC 01 to RGF93 CC 09 
  
 Here are the strings, you can find them on both Proj4 (trac.osgeo.org/proj/changeset/1444) and you were also providing them within MS 3.0.113. 
  
 3942 : <RGF93CC42> +title=Projection conique conforme Zone 1 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=42.000000000 +lon_0=3.000000000 +lat_1=41.250000000 +lat_2=42.750000000 +x_0=1700000.000 +y_0=1200000.000 +units=m +no_defs <>   
  
 3943 :  <RGF93CC43> +title=Projection conique conforme Zone 2 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=43.000000000 +lon_0=3.000000000 +lat_1=42.250000000 +lat_2=43.750000000 +x_0=1700000.000 +y_0=2200000.000 +units=m +no_defs <>   
  
 3944 : <RGF93CC44> +title=Projection conique conforme Zone 3 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=44.000000000 +lon_0=3.000000000 +lat_1=43.250000000 +lat_2=44.750000000 +x_0=1700000.000 +y_0=3200000.000 +units=m +no_defs <>   
  
 3945 : <RGF93CC45> +title=Projection conique conforme Zone 4 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=45.000000000 +lon_0=3.000000000 +lat_1=44.250000000 +lat_2=45.750000000 +x_0=1700000.000 +y_0=4200000.000 +units=m +no_defs <>   
  
 3946 : <RGF93CC46> +title=Projection conique conforme Zone 5 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=46.000000000 +lon_0=3.000000000 +lat_1=45.250000000 +lat_2=46.750000000 +x_0=1700000.000 +y_0=5200000.000 +units=m +no_defs <>   
  
 3947 : <RGF93CC47> +title=Projection conique conforme Zone 6 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=47.000000000 +lon_0=3.000000000 +lat_1=46.250000000 +lat_2=47.750000000 +x_0=1700000.000 +y_0=6200000.000 +units=m +no_defs <>   
  
 3948 : <RGF93CC48> +title=Projection conique conforme Zone 7 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=48.000000000 +lon_0=3.000000000 +lat_1=47.250000000 +lat_2=48.750000000 +x_0=1700000.000 +y_0=7200000.000 +units=m +no_defs <>   
  
 3949 : <RGF93CC49> +title=Projection conique conforme Zone 8 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=49.000000000 +lon_0=3.000000000 +lat_1=48.250000000 +lat_2=49.750000000 +x_0=1700000.000 +y_0=8200000.000 +units=m +no_defs <>   
  
 3950 : <RGF93CC50> +title=Projection conique conforme Zone 9 +proj=lcc +towgs84=0.0000,0.0000,0.0000 +a=6378137.0000 +rf=298.2572221010000 +lat_0=50.000000000 +lon_0=3.000000000 +lat_1=49.250000000 +lat_2=50.750000000 +x_0=1700000.000 +y_0=9200000.000 +units=m +no_defs <>   
  
 I’ll need the same workaround for this, please. 
  
 Patrick.

Patrick, 
  
 We tested the projections you pasted above. In x86 and x84 OS system, it behaviours the same . so just use the same projection strings for all of them above. 
  
 Let me know if any more problems. 
  
 Thanks. 
  
 Yale

Hello, 
  
 Any progress with this bug ? 
 I understand that you are rewriting Proj4 in managed code, it would be nice if this could work without Yale’s workaround. 
  
 Regards 
 Patrick.

Patrick, 
  
 Thanks for your reminding. 
  
 I will report this to our Proj4 manged version develop team to see it will be fixed, I am not sure for now. 
  
 Any more news will let you know as soon as possible. 
  
 Thanks. 
  
 Yale 


Patrick, 
  
 We are working on the rewriting but it’s too early to have the last word now that we can fix this issue in the first version.  I think in managed code, the result between X86 and X64 should be identical though. We will keep you updated here and try to release the managed version of PROJ4 ASAP. Hopefully we will have something at the beginning of next month. 
  
 Thanks, 
  
 Ben