Map projection in OpenLayers – Geographic Information Systems Stack Exchange

I want to overlay some data whose projection is WGS-84 on Google map layer in OpenLayers. But I just can't make them in the right place. I did as follows: Though I have assigned veclayer in 4326 projection, but it is still interpreted as 900913, and the display coordination system is also 900913, though I set displayProjection to 4326. What mistake do I make? You have a space after the colon. Projection('EPSG: 4326') should actually be Projection('EPSG:4326'), no space before 4326. I posted my old code snippet. I remember that the clou is in the projections. addTransform should solve your problem. (proj4) You may fall there because you are looking for a slightly offset vector representation on Google Maps while it's fine on other base layers and transforming EPSG:4326 to EPSG:900913 or EPSG:3857 doesn't solve everything. There is a bug on Google Maps that doesn't evaluate well the div size when initiating the OpenLayers Map object if it's not yet visible. So after the transform() & redraw() calls, you may need to do myMapObject.updateSize(), to let Google know the actual proportion of your map on screen. If you are looking for a generic solution to transform layers from one projection to another, you could use this function: Source.


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