Changing the Projection — GeoMOOSE 2.6.1 documentation

GeoMOOSE 2 uses the Proj4js library to perform all of its projection work. This is much more robust than the older GeoMOOSE reprojection library but requires a different setup to use different projections within the application. Projections are defined using the standard Proj4 syntax which configures the datum, origin, and units for the projection among other parameters. Most applications will use a well-known projection that is assigned a unique identifier, or “EPSG code”. The Spatial Reference website contains a listing of valid EPSG codes and definitions in various formats. The Proj4 C library also includes the full list of EPSG definitions. This list can be found in the file proj/nad/epsg included with MS4W. Proj4js does not include the full list of definitions by default, though it can dynamically load definitions directly from the Spatial Reference website. However, it is recommended that you explicitly create an EPSG code definition file for your projection in order to use it in your map. First check to see if your projection already exists as an EPSG definition. Having a predetermined projection makes this step quick and easy. Note that the same basic projection may have multiple variants with differing EPSG codes. For example, UTM 15N is defined as EPSG:26915 when based on the NAD83 datum, but as EPSG:32615 when based on the WGS 84 datum. Most commercial map layers use a projection commonly known as Web or Spherical Mercator, which now has the standard code EPSG:3857. The GeoMoose demo is configured to use EPSG:3857 by default. If your projection is not found in the standard list, you will need to define your own. For example, an arbitrary projection might be defined as: Projection files should be placed in the htdocs/projections directory and follow the naming convention EPSGXXXXX.js where “XXXXX” is the projection code. If you created a custom projection in step one be sure to make this a number above 100000. In side of this file you should have: Again, substitute your own EPSG number and projection information above. The Spatial Reference website provides Proj4js format files for well known projections. After searching for and finding a projection you will have the option to export the projection in Proj4js format. Simply copy and paste the code into your EPSGXXXXX.js file. Find the section in the <,head>, of geomoose.html that states, “Include your projection here” and place the code: This step will depend on your data sources and target projection. If your data source does not support your projection you will usually need to reproject it. Coordinates and vector layers (e.g. WFS) can generally be reprojected from within the web browser as long as both Proj4js definitions are provided. Raster layers (e.g. WMS) can often be reprojected using MapServer. In the case of the demo it is as simple as adding the EPSG code to the ows_srs parameter in basemap.map, parcels.map, lmic.map, and usgs.map: If you are changing the projection for an existing map (such as the demo), you will almost certainly need to change the max_extent and initial_extent parameters or the entire map may be shifted far off-screen. Essentially you will need to reproject the extent coordinates from the old projection into the new. One way to do approximate this from within GeoMOOSE is by panning and zooming until your data is back in view, then recording the X,Y coordinates at the bottom left and top right of the region. This task will be much simpler if you are able to use a worldwide map layer that supports your target projection. The ArcGIS REST example in the demo supports a wide range of projections and can be useful for this purpose. For example, after changing the demo to Minnesota state plane South (EPSG:26993) you would want to change the initial_extent to something like: For more information on finding projections and projection definition strings visit http://www.spatialreference.org. Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 18, 2016 @ 11:05 am