Click here to Skip to main content
14,661,076 members
Rate this:
Please Sign up or sign in to vote.
Set Image on Map image layer.

my html code is :

open layer code:

var extent=[-13.141528,-58.177920,-11.182053,-57.526062];

var projectionPixel=new ol.proj.Projection(
code :'pixel',
units : 'pixels',
extent : 'extent'

var layer=new ol.layer.Image({
extent : extent,
source : new ol.source.ImageStatic({
url : 'abc.jpg',
imageSize : [2048,2048],
imageExtent : extent,
projection : projectionPixel

var map=new ol.Map({
layer :[layer],
target : 'map',
view : new ol.View({
zoom : 2,
projection : projectionPixel,
center : ol.extent.getCenter(extent),
extent : extent

i am trying this code but some time image shows on half on layers or some times image show over of the layer how may i fit this image that can show perfectly on image Layers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100