Created
October 26, 2016 17:01
-
-
Save mousebird/233072e3086e4da489b7eb121cbad28d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public CoordSystem MakeBNGCoordSystem(Activity activity, boolean displayVersion) | |
{ | |
String projStr = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs"; | |
Proj4CoordSystem coordSys = new Proj4CoordSystem(projStr); | |
// Set the bounding box for validity. It assumes it can go everywhere by default | |
Mbr bbox = new Mbr(); | |
bbox.addPoint(new Point2d(1393.0196,13494.9764)); | |
bbox.addPoint(new Point2d(671196.3657,1230275.0454)); | |
// Now expand it out so we can see the whole of the UK | |
if (displayVersion) | |
{ | |
// Make the bounds a little bigger to give the user room | |
double spanX = bbox.ur.getX() - bbox.ll.getX(); | |
double spanY = bbox.ur.getY() - bbox.ll.getY(); | |
double extra = 1.5; | |
bbox.addPoint(new Point2d(-extra*spanX,-extra*spanY)); | |
bbox.addPoint(new Point2d(extra*spanX,extra*spanY)); | |
} | |
coordSys.setBounds(bbox); | |
return coordSys; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment