Using Projector Grids
How to use the class SpaProjectorGrids to create optimized bounding polygons.
Definitions
- Bounding Box - rectangular box that surrounds spatial data. Typical format is an array of: [XMin,YMin,XMax,YMax]
- Bounding Polygon - a non rectangular polygon specified either as [Xs,Ys] or a shapely geometry
- Projection Bounding Polygon - a bounding polygon specified with the projection (not used?)
- Projection Bounding Box- bounding box specified with the projection.
- Geographic Projection Bounding Polygon (GPBP) - bounding box specified with the projection method in geographic coordinates
- Geographic Projection Bounding Box (GPBP) - bounding box specified with the projection method in geographic coordinates
- Shifted Geographic Projection Bounding Boxes - projection boxes after being shifted to move Longitude Of Origin to 0
- Projected Projection Bounding Polygon (PPBP) - bounding box specified with the projection method in projected coordinates
- Projected Bounding Box (PPBP) - bounding box for the projected coordinates
- Optimzed Bounding Polygon - a polygon that has been optimzed for a specified set of parameters
- Optimzed Bounding Box - the bounding box for an Optimzed Bounding Polygon
- Geographic Optimzed Bounding Polygon (GOBP)
- Projected Optimzed Bounding Polygon (POBP)
- Projected Optimzed Bounding Box (POBP) - bounding box for the Optimized Bounding Polygon in projected coordinates
- Specified Bounding Box
- Specified Boudning Polygon
- Specified Lonitude of Origin
- Shifted Bounding Boxes
Settings
Projection Settings
- FullName: Full name of the projection (e.g. Albers Equal Area of North America)
- GeographicBoundingBox (BB): Bounding box to limit the geographic space. Defined as: [LonMin,LatMin,LonMax,LatMax]
- GraticuleInterval: Used for both lat and lon
- LongitudeShift: Shifts longitude of origin from 0
- LongitudeWestPad (LWP): Maximum value for the longitudes used to compute the easting grid (i.e. maximum longitude is 180-LongitudeWestPad)
- LongitudeEastPad (LEP): Minimum value for the longitudes used to compute the easting grid (i.e. minimum longitude is -180+LongitudeWestPad)
- The following are all bounds on the distortion that will be allowed before an outside will be allowed to become inside the Optimzed Boudning Polygon:
- AreaDistortionMax (ADMax)
- AreaDistortionMin (ADMin)
- DistanceDistortionMax (DDMax)
- DistanceDistortionMax (DDMin)
- AdjacentAreaDistortionChangeMin (AADCMin): Minimum change in the distortion proportion between a cell that is inside and a cell that is outside
- AdjacentAreaDistortionChangeMax (AADCMax): Maximum change in the distortion proportion between a cell that is inside and a cell that is outside
- SegmentInersectionEndPointTolerance (SIEPT): If the end points of two segments are within this tolerance, they will not be defined as intersecting. This needs to be slightly larger than zero to allow for coordinates at ajacent cells to be treated as the same coordinate.
- DistanceToCombinePolarCoordinates (DTCPC): Polar coordinates that are within this distance will be combined together to have exactly the same coordinate
- DensifyDistanceInDegrees (DDID): maximum segment distance for spatial data and other rendered items. Not currently used.
- Debugging (Debugging): true to output debugging information to the console
- DumpCellsAsAdded (DCAA): If true, images of the geographic and projected grids will be written to the debugging folder
ProjSettings
Proj settings as documented in proj.org. These are sent directly to the proj projection engine with three exceptions:
Drawing Settings
- BoundingBoxType
can be one of three settings:
- BOUNDS_GLOBAL: [-180,-90,180,90] will be used
- BOUNDS_PROJECTION_BOUNDING_BOX: the bounding box specified in the projection settings
- BOUNDS_OPTIMIZED_BOUNDING_BOX: the bounding box determined by computing the GOBP
- DrawProjectionBoundBox - draw the bounds before a spatial grid was applied to find a more defined bounding polygon
- DrawGraticulesInProjectionBoundingBox
- FillCountries
- OutlineCountries
- ClipCountries
- DensifyDistanceInDegrees - Maximum segment distance applied to spatial data before projecting
- DrawOptimizedBoundingPolygon
- DrawGraticulesInOptimizedBoundingPolygon
- DrawOrigins
- ColorPalettePath
- DrawAreaDistortion
- DrawParallelDistanceDistortions
- DrawMeridianDistanceDistortions
Notes:
- Make NewPole Lat/Lon an array?
Using The Pre-Created Files
Proj parameters:
/Archive/2020/ProjectionGrids/aea/
/Archive/2020/ProjectionGrids/aea/ for now
File names and paths cannot be greater than 255 characters
- lat_0=20
- o_lat_p=60 (lat new pole)
Grid parameters:
BB=-180_-90_180_90
Using the Web Service
Usng the Libraires
1. Create the SpaProjectorGrids() object
TheProjectorGrids=SpaProjectorGrids()
2. Get the default projector settings from SpaProjectorGrids
ProjectorGridSettings=TheProjectorGrids.GetDefaultSettings()
3. Modify the settings as desired
4. Set the settings into the SpaProjectorGrids object
TheProjectorGrids.SetSettings(SpaProjectorGrids,ProjectorGridSettings)
5. Setup the Proj parameters
6. Set the proj projection code and the proj parameters into the SpaProjectorGrids object
TheProjectorGrids.Setup(ProjectionCode,ProjParameters)
7. Setting up the drawing settings for the final image
8. Save the projected image to disk.
TheProjectorGrids.SaveProjImage(DrawSettings,ImageFilePath,CountriesFilePath)