projection – How to reproject base layers in OpenLayers? – Geographic Information Systems Stack Exchange

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 EPSG26912 projection. Now I wanna use these as basemap for my openlayer 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 EPSG900913 which is sphericalMercator projection to my knowledge, if I just add these base map layers into openlayer map component, the group A and group B won't overlay correctly, which means they are displayed as seperate maps. I know this is something related to projection, and might need some code with proj4js, however, as a newbie, I dont really know how to start with. Basically, I want to put OSM/Google maps as the base map for the whole world in tier 1, then put EPSG26912 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 EPSG26912 to EPSG900913 or opposite? I guess I should use EPSG900913 as the base projection. 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. 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. Any good WMS should be able to do the reprojection for you. However I have no idea if ArcGIS Server is a good WMS. If it is unable to provide the layer in 900913 then consider using GeoServer or MapServer as a cascading WMS to handle the reprojection for you. I'm no OpenLayers guru, but you need to specify the projection of the map object. I think it defaults to WGS84....I could be wrong i might even be the source of the first layer added to the map. But then remember when you want to set the map center by using a lat,lon you have to project that coordinate from WGS to GoogleMercator like this (using the wgs84 and googleMercator variable from above). Once you start using different projections, you have to start thinking about the possibility of converting coordinates from one projection to another, either when displaying those coordinates, or when reading in vector data in a different coordinate system from the map's. As stated before, this conversion logic is not provided by OL, so you have to use Proj4js, which you will have to include in your page: Source.

Яндекс.Метрика Рейтинг Free Web Counter
page counter
Last Modified: April 22, 2016 @ 2:01 am