[OpenLayers-Users] Addition of grid

Paul Spencer pagameba at gmail.com
Thu Jun 12 07:18:59 EDT 2008


Hi Kusum,

Producing maps in different projections is not part of OpenLayers  
mandate - it just displays them.  OpenLayers doesn't really care about  
projections much, so its pretty easy to pull in maps that are in  
different projections.  You just need to know some stuff about what  
you are pulling in.

* when creating a new OpenLayers.Map instance, you can specify a  
projection parameter in the options to say what projection the map is  
in - this is not absolutely necessary, OpenLayers will not use this to  
reproject your map, but it can be used with some controls to reproject  
output of, say mouse coordinates, from the map projection into  
something more recognizable (usually lon/lat values).  You probably  
need to include proj4js (http://proj4js.org/) if you want to reproject  
coordinates.

* you should specify the 'units' for the map (or the base layer)  
correctly.  OpenLayers assumes a unit value of 'dd' (decimal degrees)  
but projected maps often have units in 'm' (meters) or 'ft' etc.  It  
depends on the projection of the map, this is something you have to  
know.

* you should specify the minResolution and maxResolution, and the  
maxExtent of the map (or the base layer).  Resolution is a measure of  
ground units per pixel.  The defaults are reasonable for decimal  
degrees so if your projection is not in decimal degrees then the  
defaults will be wildly wrong and you'll have problems.  Same for  
maxExtent (by default this is new OpenLayers.Bounds(-180,-90,180,90))

As to examples, I suggest that you spend some time reviewing the  
extensive examples provided with the source - there are several  
examples of working with maps in other projections (specifically with  
SphericalMercator projection)

Cheers

Paul


On 12-Jun-08, at 1:26 AM, Kusum wrote:

> Hii All
>
> Can somebody please suggest me how to add grid on map??
> Also how can we change projection of map??
>
> please provide path of some example or some code for help as I have  
> already messed a lot with this.
>
> Regards
> Kusum
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list