Hello Andrea-    I have attached an updated copy of the CylindricalEqualArea 
class along with a test script. The CylindricalEqualArea class supports 2 
"alias" projections: 

- World Behrmann (ESRI:54017)- Lambert Cylindrical Equal Area

You will need to add 3 lines to the 
org.geotools.referencing.operation.MathTransformProvider for it to work:

   org.geotools.referencing.operation.projection.CylindricalEqualArea$Provider
   
org.geotools.referencing.operation.projection.CylindricalEqualArea$BehrmannProvider
   
org.geotools.referencing.operation.projection.CylindricalEqualArea$LambertCylindricalEqualAreaProvider

The CylindricalEqualArea class is supposed to support both spheriods and 
ellipsoids. I have verified that the ellipsoidal calculations are correct using 
the Behrmann projection (ESRI:54017) which uses the WGS84 ellipsoid. 

Unfortunately, there appears to be something wrong with the spherical datums 
like the one used by NSIDC EASE-Grid Global (EPSG:3410) which uses the 1924 
Authalic Sphere. cs2cs reports that the coordinates in the x axis are correct 
but the y axis is off. I have checked my code against the proj4 and proj4j 
projects and I don't see what I'm doing wrong. 

I am hesitant to put in a pull request because of this issue. 


Options:
(1) Have someone from the GeoTools dev team review my code with the latest 
version on GeoTools. Note that I am using an older version of GeoTools (10.x) 
and an unknown build of proj4 (cs2cs utility) so the anomaly I am seeing with 
spherical datums may be just a misconfiguration on my end.
(2) Comment out support for spherical datums.

Please let me know how you would like to proceed.

Thanks,Peter
      From: Andrea Aime <andrea.a...@geo-solutions.it>
 To: Peter Borissow <peter.boris...@yahoo.com> 
Cc: Geotools-Devel list <geotools-devel@lists.sourceforge.net> 
 Sent: Sunday, March 29, 2015 10:13 AM
 Subject: Re: [Geotools-devel] Cylindrical Equal Area Projection
   
On Sun, Mar 29, 2015 at 2:39 PM, Peter Borissow <peter.boris...@yahoo.com> 
wrote:

I have attached a first cut of the CylindricalEqualArea projection. 


You will need to add 2 lines to the 
org.geotools.referencing.operation.MathTransformProvider for it to work:   
org.geotools.referencing.operation.projection.CylindricalEqualArea$Provider   
org.geotools.referencing.operation.projection.CylindricalEqualArea$BehrmannProvider

Hi Peter,normally we ask for a pull request to be made, could you create one? 
There are instructions 
here:http://docs.geotools.org/latest/developer/procedures/contribute.html#code-contributions
 


I don't know how to test it. 

You have to write a script test, see the two commits I've linked for 
examples.It's basically just getting some reference results from cs2cs and 
build the script file that contains them, with tolerances.

 
Visually it looks ok. I used the following code which generated a map that 
looks a lot like 
this:http://mathworld.wolfram.com/BehrmannCylindricalEqual-AreaProjection.html

        CoordinateReferenceSystem crs = CRS.decode("EPSG:54017");
        MapContent map = new MapContent();
        MapViewport vp = map.getViewport();
        vp.setCoordinateReferenceSystem(crs);
        map.addLayer(getPoliticalBoundaries());
        map.addLayer(getGraticules());



I used code from Proj4j[1] which is almost identical to Proj4[2].
The only thing I'm not sure about is the "trueScaleLatitude" variable in the 
constructor. In proj4, this maps to "tlat_ts". I have no idea what the 
equivalent is in GeoTools. 


I don't know what that is either. CheersAndrea

-- 
==GeoServer Professional Services from the experts! Visithttp://goo.gl/NWWaa2 
for more information.==

Ing. Andrea Aime 
@geowolfTechnical Lead

  

Attachment: CylindricalEqualArea.java
Description: Binary data

// Test script for Cylindrical Equal Area projections


//WGS84 Ellipsoid
set _WGS84_  = GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563 ] ], PRIMEM["Greenwich",0.0], 
UNIT["degree",0.01745329251994328 ]]

//1924 Authalic Sphere
set _AuthalicSphere_ = GEOGCS["Unspecified datum based upon the International 
1924 Authalic 
Sphere",DATUM["Not_specified_based_on_International_1924_Authalic_Sphere",SPHEROID["International
 1924 Authalic Sphere",6371228,0, 
AUTHORITY["EPSG","7057"]],AUTHORITY["EPSG","6053"]], PRIMEM["Greenwich",0, 
AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, 
AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4053"]]


//NSIDC EASE-Grid Global (EPSG:3410)
set _NSIDCGlobal_ = PROJCS["NSIDC EASE-Grid 
Global",_AuthalicSphere_,UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Cylindrical_Equal_Area"],PARAMETER["standard_parallel_1",30],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3410"],AXIS["X",EAST],AXIS["Y",NORTH]]


//World Behrmann (ESRI:54017)
set _Behrmann_ = PROJCS["World_Behrmann",_WGS84_,PROJECTION["Behrmann"], 
PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1],AUTHORITY["EPSG","54017"]]


// -------------------------------------------------------------------------- //
// WGS84 to Behrmann (ESRI:54017)
// cs2cs -v +datum=WGS84 +proj=lonlat +to +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 
+y_0=0 +datum=WGS84 +units=m +no_defs
// -------------------------------------------------------------------------- //

source crs = _WGS84_
target crs = _Behrmann_

test tolerance = (0.001, 0.01)

source pt = (0, 0)
target pt = (0, 0)

source pt = (10, 10)
target pt = (964862.80, 1269436.74)

source pt = (-50, -50)
target pt = (-4824314.01, -5614050.10)

// precision change with for higher lon values
test tolerance = (0.01, 0.001)

source pt = (130, 0)
target pt = (12543216.43, 0.00)

source pt = (130, 60)
target pt = (12543216.43, 6351420.00)


// -------------------------------------------------------------------------- //
// Behrmann (ESRI:54017) to WGS84
// cs2cs -v +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +units=m 
+no_defs +to +datum=WGS84 +proj=lonlat
// -------------------------------------------------------------------------- //
source crs = _Behrmann_
target crs = _WGS84_

test tolerance = (0.0001, 0.0001)

source pt = (0, 0)
target pt = (0, 0)

source pt = (964862.80, 1269436.74)
target pt = (10, 10)

source pt = (-4824314.01, -5614050.10)
target pt = (-50, -50)

source pt = (12543216.43, 0.00)
target pt = (130, 0)

source pt = (12543216.43, 6351420.00)
target pt = (130, 60)



// -------------------------------------------------------------------------- //
// WGS84 to NSIDC EASE-Grid Global (EPSG:3410)
// cs2cs -v +datum=WGS84 +proj=lonlat +to +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 
+y_0=0 +a=6371228 +b=6371228 +units=m +no_defs
// -------------------------------------------------------------------------- //

source crs = _WGS84_
target crs = _NSIDCGlobal_

test tolerance = (0.001, 0.01)

source pt = (0, 0)
target pt = (0, 0)

source pt = (10, 10)
target pt = (963010.77, 1277505.40)

source pt = (-50, -50)
target pt = (-4815053.87, -5635682.03)

// precision change with for higher lon values
test tolerance = (0.01, 0.001)

source pt = (130, 0)
target pt = (12519140.07, 0.00)

source pt = (130, 60)
target pt = (12519140.07, 6371228.00)


// -------------------------------------------------------------------------- //
// NSIDC EASE-Grid Global (EPSG:3410) to WGS84
// cs2cs +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 
+units=m +no_defs +to -v +datum=WGS84 +proj=lonlat
// -------------------------------------------------------------------------- //

source crs = _NSIDCGlobal_
target crs = _WGS84_

test tolerance = (0.0001, 0.0001)

source pt = (0, 0)
target pt = (0, 0)

source pt = (12519140.07, 6371228.00)
target pt = (130, 60)

source pt = (12519140.07, 0.00)
target pt = (130, 0)

source pt = (-4815053.87, -5635682.03)
target pt = (-50, -50)
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to