Wednesday 28 December 2016

coordinate system - Reprojecting base layers in OpenLayers


I have vector/topo/image tiled maps for some places in North America which were published as ArcGIS Server REST service. These maps (A) are based in EPSG:26912 projection. Now I want to use these as base map for my OpenLayers web app; besides, I also want to consume other base map sources (B), e.g., OpenStreetmap, Google Maps, ESRI, etc. Since most of these maps are in EPSG:900913 which is spherical Mercator projection to my knowledge, if I just add these base map layers into OpenLayers map component, the group A and group B won't overlay correctly, which means they are displayed as separate maps.


I know this is something related to projection, and might need some code with proj4js, however, as a newbie, I don't really know what to start with.


Basically, I want to put OSM/Google maps as the base map for the whole world in tier 1, then put EPSG:26912 base maps for some places in North America in tier 2, and put other WMS or WFS in the top tier.


do I need to transform EPSG:26912 to EPSG:900913 or opposite? I guess I should use EPSG:900913 as the base projection.



Answer




OpenLayers can transform vector layers (like WFS). If your vector layer is in EPSG:900913 or EPSG:4326 OpenLayers can handle the transformation itself, otherwise, it needs Proj4js included.


There are examples of how to use OpenLayers with Proj4js.


Raster Layers cannot be transformed by OpenLayers. If you need to include them in a different projection, you have to reproject them by yourself or use a reprojecting WMS proxy like GeoWebCache.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...