Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am working on a OSM map that clusters several points with a modification of AnimatedCluster (https://github.com/acanimal/AnimatedCluster).

However, somewhere the accuracy seems to lack. Can someone help me figure out at which point it might go wrong?

The image below displays how a cluster ends up in the middle of the sea, as well as the cluster's longitude/latitude coordinates. The points are still in the sea when I zoom in Wrong clusters and their coordinates

The code I used to display them goes as follows:

var coor=clusters[i].geometry.getBounds().getCenterLonLat().transform(map.getProjectionObject(),fromProjection);
coords = coords +coor.lat+","+coor.lon +"; ";

If I type in the coordinates manually into Google Maps or Openstreetmap, none of the coordinates are in the sea. However, they are all in different places using Google and OSM. Could it be OSM and/or Google can't handle more than 1-2 decimal places? Or could it be an issue with the AnimatedCluster? I couldn't find anything while debugging there. Parsing between geometry and long/lat seems to cause inaccuracy (the original latitude was 21) on the 13th decimal place, but that should not be visible on the map.

This is the code for adding the features:

map = new OpenLayers.Map('geoMap');
osm = new OpenLayers.Layer.OSM();

vector = new OpenLayers.Layer.Vector("Features", {
renderers: ['Canvas','SVG'],
strategies: [
    new OpenLayers.Strategy.AnimatedCluster({
        distance: 50,
        animationMethod: OpenLayers.Easing.Expo.easeOut,
        animationDuration: 10,
        clusterType: clustertype
    styleMap:  new OpenLayers.StyleMap(style)


for (var i = 0; i < dataselect.length; i++) {
var lon = dataselect[i][5];
var lat = dataselect[i][6];
lon = Math.round(lon * 100000) / 100000;
lat = Math.round(lat * 100000) / 100000;
var select = getRandomArbitary (0, 4)
   var lonlat = new OpenLayers.Geometry.Point(lon,lat);
lonlat.transform(fromProjection, map.getProjectionObject());

var f = new OpenLayers.Feature.Vector(lonlat, null, null);

I'd appreciate any help whatsoever :)

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.