1

When running the following code to reproject a epsg:4326 countries file to orthographic:

newCRS = CRS.decode("AUTO:42003,1,-100,45");
mapFrame.getMapContent().getViewport().setCoordinateReferenceSystem(newCRS);

The following error occurs: WARNING: Possible use of "Orthographic" projection outside its valid area. Latitude 112°43.8'S is out of range (±90°).

Does anyone know how to get the orthographic projection to work?

  • you probably have your latitude and longitude switched, but we'd need to see the value of getViewPort's bbox before you transform it – Ian Turton Oct 23 '18 at 15:37
  • Bounds before reprojection: ReferencedEnvelope[-180.0 : 180.00000190734863, -90.0 : 83.57026863098145]. After: ReferencedEnvelope[-180.0 : 180.00000190734858, -112.73017238719122 : 106.30044101817266] – ccarlow Oct 23 '18 at 16:02
  • looks like a long/lat box but should probably be a lat/long one - need to see the WKT of the original CRS to be sure – Ian Turton Oct 23 '18 at 16:09
  • GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]]ReferencedEnvelope[-180.0 : 180.00000190734858, -112.73017238719122 : 106.30044101817266] – ccarlow Oct 23 '18 at 16:19
  • To: PROJCS["WGS 84 / Auto Orthographic", GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]], PROJECTION["Orthographic"], PARAMETER["central_meridian", 0.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH]] – ccarlow Oct 23 '18 at 16:19
1

An Orthographic Projection is of a hemisphere so if you try to display the whole world (as you seem to be) it will throw a ProjectionExcpetion (Point outside of hemisphere of projection) at least in recent versions.

But you seem to be hitting an earlier issue that your input bounding box is almost square (-180.0 : 180.00000190734858, -112.73017238719122 : 106.30044101817266) and GeoTools is complaining that the Earth isn't that tall (-112 is clearly below the South Pole (-90)) and so throws an earlier error than I'm seeing. With a smaller dataset your code works fine.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.