[OpenLayers-Users] need Static image as map of small city with correct longitude and latitude

Pierre GIRAUD bluecarto at gmail.com
Mon Mar 9 13:07:20 EDT 2009


You're not adding the layer to the map.

Try the following :

        function init(){
            map = new OpenLayers.Map('map');
            var options = { numZoomLevels: 5 };
            var olbound = new OpenLayers.Bounds(15.865164, 58.172783,
16.651403, 58.620233);           //bounds(left,buttom,right,top)

            var topography = new OpenLayers.Layer.Image(
                'Wrap signals',
                'img/image.24.png',
                olbound,
                new OpenLayers.Size(1000, 1000),
//size in pixel of the map
                options
            );
            map.addLayer(topography);
            map.zoomToMaxExtent();
        }

map.setCenter(new OpenLayers.LonLat(16.23069, 58.406794), 3);

On Mon, Mar 9, 2009 at 4:43 PM, nab <nabinrs at gmail.com> wrote:
>
>
> Thanks for the reply,
> here is the code which i used with static map, but the longitued and
> latitude i got is incorrect or sometime i couldnot even get any image loaded
> on the canvas.
> function init(){
>             map = new OpenLayers.Map('map');
>             var options = { numZoomLevels: 5 };
>             var olbound = new OpenLayers.Bounds(15.865164, 58.172783,
> 16.651403, 58.620233);           //bounds(left,buttom,right,top)
>
>
>             var topograpy = new OpenLayers.Layer.Image(
>                                 'Wrap signals',
>                                 'img/image.24.png', olbound,
>                                 new OpenLayers.Size(1000, 1000),
>        //size in pixel of the map
>                                 options);
>      map.setCenter(new OpenLayers.LonLat(58.406794, 16.23069), 3);
>    }
> I will be thankful, if somebody can help me with this problem.
>
>
> Hi,
>> I had seen your posts and replies in this forum, which is impressive and
>> helped me lot as well while using openlayer.
>> Actaully i am new to openlayer and i am using static map image(jpg) of my
>> city but i could not get correct long/lat value since i use map of very
>> small city, i try to fix it through
>> OpenLayers.Bounds(15.865164, 58.172783, 16.651403, 58.620233) and i set
>> the
>> centre long/lat as 0,0 which is not workin then i set them in to its real
>> long/lat that is also not working.
>> is there any method which i didn't understood to make static map of my
>> city
>> with long/lat value.
>>
>> The concept that i follow for Bounds and centre are:
>>
>>
>>                -------------------------------------(long1, lat1)
>>               |                                     |
>>               |        image (lon,lat)         |
>> (long2,lat2)-------------------------------------
>>
>> i would be very thankful if you could help me.
>>
>> regards,
>> nabin
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



-- 
Pierre GIRAUD
http://www.camptocamp.com



More information about the Users mailing list