I have been developing in Google Maps for awhile and am switching to OpenLayers but am stuck on one point: I am drawing vectors that are mostly circular but also involve some custom geometry so I can't use createRegularPolygon. I'm creating an array of points and sending it to a OpenLayers.Layer.Vector object. This works great but the resulting 'circles' are only round near the equator, not at higher latitudes. They are squashed about the same amount as the basemap is at higher latitudes, which seems to makes sense. If I use Google as a base layer then they are the correct shape at all latitudes, but I'm making an offline mobile solution so that won't do.
What do I use for a base layer (or what parameters to set) so that my geometry remains round at all latitudes without using Google or online maps?
Answer
I guess your circles look something like this:
(Source: Esri mapping center blog)
You will want to use Web Mercator EPSG:900913 instead of WGS84 EPSG:4326 for perfect circles
More on this topic and an example of how the circles look like in Mercator: Tissot's indicatrix helps illustrate map projection distortion
To make openlayers use Mercator, you have to set the sphericalMercator option in your base layer.
sphericalMercator: true,
No comments:
Post a Comment