Index: org.gvsig.projection.jcrs.lib/src/main/java/org/gvsig/crs/Proj4.java =================================================================== --- org.gvsig.projection.jcrs.lib/src/main/java/org/gvsig/crs/Proj4.java (revisione 256) +++ org.gvsig.projection.jcrs.lib/src/main/java/org/gvsig/crs/Proj4.java (copia locale) @@ -1675,19 +1675,19 @@ addProjectionName(count,"9804"); addProjectionName(count, "Mercator (1SP)"); addProjectionName(count, "Mercator_(1SP)"); - addProjectionName(count,"Mercator_(variant_A)"); + addProjectionName(count,"Mercator_(variant_A)"); String[] parameterName={"central_meridian"}; projectionParameterList.add(count,parameterName); addProjectionParameter(count,"latitude_of_origin"); // o latitude_origin - addProjectionParameter(count,"scale_factor"); // o latitude_origin + addProjectionParameter(count,"scale_factor"); addProjectionParameter(count,"false_easting"); addProjectionParameter(count,"false_northing"); String[] parameterAcronym={"lon_0"}; projectionParameterAcronymList.add(count,parameterAcronym); - addProjectionParameterAcronymList(count,"lat_ts"); // o lat_ts - addProjectionParameterAcronymList(count,"k"); // o lat_ts + addProjectionParameterAcronymList(count,"lat_ts"); + addProjectionParameterAcronymList(count,"k"); addProjectionParameterAcronymList(count,"x_0"); addProjectionParameterAcronymList(count,"y_0"); @@ -1723,6 +1723,7 @@ addProjectionName(count,"Mercator"); addProjectionName(count,"9805"); addProjectionName(count, "Mercator (2SP)"); + addProjectionName(count, "Mercator_(variant_B)"); String[] parameterName={"central_meridian"}; projectionParameterList.add(count,parameterName); @@ -1939,7 +1940,7 @@ addProjectionName(count,"Rectified_Skew_Orthomorphic_Center"); addProjectionName(count,"Hotine Oblique Mercator"); addProjectionName(count,"Hotine_Oblique_Mercator"); - addProjectionName(count,"Hotine_Oblique_Mercator_(variant_B)"); + addProjectionName(count,"Hotine_Oblique_Mercator_(variant_B)"); String[] parameterName={"latitude_of_center"}; projectionParameterList.add(count,parameterName); @@ -2785,10 +2786,9 @@ String[] projectionAcronym={"wintri"}; projectionAcronymList.add(count,projectionAcronym); } - - count++; - {// Popular_Visualisation_Pseudo_Mercator based Mercator_1SP + count++; + {// Popular_Visualisation_Pseudo_Mercator (based on Mercator_1SP) String[] projectionName={"Popular_Visualisation_Pseudo_Mercator"}; projectionNameList.add(count,projectionName); @@ -2795,7 +2795,7 @@ String[] parameterName={"central_meridian"}; projectionParameterList.add(count,parameterName); addProjectionParameter(count,"latitude_of_origin"); // o latitude_origin - addProjectionParameter(count,"scale_factor"); // o latitude_origin + addProjectionParameter(count,"scale_factor"); addProjectionParameter(count,"false_easting"); addProjectionParameter(count,"false_northing"); addProjectionParameter(count,"semi_major"); @@ -2803,8 +2803,8 @@ String[] parameterAcronym={"lon_0"}; projectionParameterAcronymList.add(count,parameterAcronym); - addProjectionParameterAcronymList(count,"lat_ts"); // o lat_ts - addProjectionParameterAcronymList(count,"k"); // o lat_ts + addProjectionParameterAcronymList(count,"lat_ts"); + addProjectionParameterAcronymList(count,"k"); addProjectionParameterAcronymList(count,"x_0"); addProjectionParameterAcronymList(count,"y_0"); addProjectionParameterAcronymList(count,"a"); @@ -2812,10 +2812,10 @@ String[] parameterDefaultValue={"0.0"}; projectionParameterDefaultValueList.add(count,parameterDefaultValue); - addProjectionParameterDefaultValue(count,"0.0"); // o 0.0 - addProjectionParameterDefaultValue(count,"1.0"); // o 0.0 addProjectionParameterDefaultValue(count,"0.0"); + addProjectionParameterDefaultValue(count,"1.0"); addProjectionParameterDefaultValue(count,"0.0"); + addProjectionParameterDefaultValue(count,"0.0"); addProjectionParameterDefaultValue(count,"6378137.0"); addProjectionParameterDefaultValue(count,"6378137.0"); @@ -3300,6 +3300,8 @@ if(projectionName.equals("Oblique_Mercator")) { isOmerc=true; + if (crs.getCode()==21781) + isSomerc=true; for(int j=0;j 90.0) { - throw new CrsException(new Exception("In proj4 projection 'Oblique_Mercator' not allow azimut close to 90")); + //throw new CrsException(new Exception("In proj4 projection 'Oblique_Mercator' not allow azimut close to 90")); + throw new CrsException(new Exception("In proj4 the 'Oblique_Mercator' projection doesn't allow azimut values > 90")); } if(Math.abs(valueAlpha-270.0)<0.0001) { - throw new CrsException(new Exception("In proj4 projection 'Oblique_Mercator' not allow azimut close to 270")); + throw new CrsException(new Exception("In proj4 the 'Oblique_Mercator' projection doesn't allow azimut close to 270")); } existsAlpha=true; } @@ -3336,7 +3340,7 @@ { if(Math.abs(valueAlpha-valueGamma)>0.00000001) { - throw new CrsException(new Exception("In proj4 projection 'Oblique_Mercator' not allow diferent azimut and spin axis")); + throw new CrsException(new Exception("In proj4 the 'Oblique_Mercator' projection doesn't allow different azimut and spin axis")); } } @@ -3415,7 +3419,7 @@ { if(value_sf!=1.0&&value_lo!=0.0) { - throw new CrsException(new Exception("In proj4 projection Mercator not allow scale factor and latitude of origin")); + throw new CrsException(new Exception("The 'Mercator' proj4 projection doesn't allow scale factor and latitude of origin.")); } else if(projectionName.equals("Mercator_1SP")) exists_lo=false; @@ -3428,6 +3432,9 @@ exists_sf=false; */ } + if(projectionName.equalsIgnoreCase("Popular_Visualisation_Pseudo_Mercator")) + value_sf=1.0; + exists_sf=true; } else if(projectionAcronym[0].equals("lcc")) { @@ -3627,8 +3634,10 @@ String elipName=crs.getCrsWkt().getSpheroid()[0]; a=Double.parseDouble(crs.getCrsWkt().getSpheroid()[1]); inv_f=Double.parseDouble(crs.getCrsWkt().getSpheroid()[2]); + if (crs.getCode() == 3857) + inv_f = Double.POSITIVE_INFINITY; String strEllipseAcronym=ellipseToProj4(a,inv_f); - String strEllipse=""; + String strEllipse=""; if(strEllipseAcronym.equals("")) { if (!Double.isInfinite(inv_f)) @@ -3638,8 +3647,10 @@ else strEllipse="+R="+a+" "; } + /* else strEllipse="+R="+a+" "; + */ } else { @@ -3915,6 +3926,9 @@ if(projectionName.equals("Oblique_Mercator")) { isOmerc=true; + // TODO Set isSomerc as true for EPSG:21781 + //if (crs.getCode()==21781) + // isSomerc=true; for(int j=0;j 90.0) { - throw new CrsException(new Exception("The proj4 projection 'Oblique Mercator' not allow azimut close to 90.")); + //throw new CrsException(new Exception("In proj4 projection 'Oblique_Mercator' not allow azimut close to 90")); + throw new CrsException(new Exception("In proj4 the 'Oblique_Mercator' projection doesn't allow azimut values > 90")); } if(Math.abs(valueAlpha-270.0)<0.0001) { - throw new CrsException(new Exception("The proj4 projection 'Oblique Mercator' not allow azimut close to 270.")); + throw new CrsException(new Exception("In proj4 the 'Oblique_Mercator' projection doesn't allow azimut close to 270.")); } existsAlpha=true; } @@ -4030,7 +4046,7 @@ { if(value_sf!=1.0&&value_lo!=0.0) { - throw new CrsException(new Exception("The proj4 projection 'Mercator' not allow scale factor and latitude of origin.")); + throw new CrsException(new Exception("The 'Mercator' proj4 projection doesn't allow scale factor and latitude of origin.")); } else if(projectionName.equals("Mercator_1SP")) exists_lo=false; @@ -4043,6 +4059,10 @@ exists_sf=false; */ } + if(projectionName.equalsIgnoreCase("Popular_Visualisation_Pseudo_Mercator")) + value_sf=1.0; + exists_sf=true; + inv_f = Double.POSITIVE_INFINITY; } else if(projectionAcronym[0].equals("lcc")) { @@ -4238,8 +4258,10 @@ else strEllipse="+R="+a+" "; } + /* else strEllipse="+R="+a+" "; + */ } else { @@ -4560,6 +4582,11 @@ { pszPROJ4Ellipse = "WGS84"; } + else if( Math.abs(dfSemiMajor-6378137.0) < 0.01 + && Double.isInfinite(dfInvFlattening) ) + { + pszPROJ4Ellipse = ""; /* Popular Visualisation Sphere */ + } /* else if( EQUAL(pszDatum,"North_American_Datum_1927") ) {