i am trying to get distance between two polygons and somehow i get different distance, depending on how I call distanceTo
a.distanceTo(b) != b.distanceTo(a) should it be like that?
layers[0].features[0].geometry.distanceTo( layers[0].features[1].geometry, {details:true,edge:true});Object {distance: 10.48962511638198, x0: 2684839.287184146, y0: 7750111.194373621, x1: 2684849.7767009, y1: 7750111.146694}and
layers[0].features[1].geometry.distanceTo( layers[0].features[0].geometry, {details:true, edge:true});Object {distance: 19.05365206557588, x0: 2684857.7419808176, y0: 7749989.676176046, x1: 2684838.7291617, y1: 7749988.4294338}Some additional information...
Main map object:
var map = new OpenLayers.Map('map', { units: 'm', projection: 'EPSG:3857', layers: [ new OpenLayers.Layer.Google( "Google Roadmap", {type: google.maps.MapTypeId.ROADMAP, numZoomLevels: 22} ), conflictLayer,markerLayer, ], center: new OpenLayers.LonLat(1787495.895083, 5755860.4398742), zoom: 18 });later I just add more layers and keep these layers in array, so 'layers[0]' is one of them.code to generate new layer:
var newLayer = new OpenLayers.Layer.Vector(o.name, { styleMap: styleMap, renderers: renderer, zone_id.id }); map.addLayer(newLayer); layers.push(newLayer);
أكثر...
a.distanceTo(b) != b.distanceTo(a) should it be like that?
layers[0].features[0].geometry.distanceTo( layers[0].features[1].geometry, {details:true,edge:true});Object {distance: 10.48962511638198, x0: 2684839.287184146, y0: 7750111.194373621, x1: 2684849.7767009, y1: 7750111.146694}and
layers[0].features[1].geometry.distanceTo( layers[0].features[0].geometry, {details:true, edge:true});Object {distance: 19.05365206557588, x0: 2684857.7419808176, y0: 7749989.676176046, x1: 2684838.7291617, y1: 7749988.4294338}Some additional information...
Main map object:
var map = new OpenLayers.Map('map', { units: 'm', projection: 'EPSG:3857', layers: [ new OpenLayers.Layer.Google( "Google Roadmap", {type: google.maps.MapTypeId.ROADMAP, numZoomLevels: 22} ), conflictLayer,markerLayer, ], center: new OpenLayers.LonLat(1787495.895083, 5755860.4398742), zoom: 18 });later I just add more layers and keep these layers in array, so 'layers[0]' is one of them.code to generate new layer:
var newLayer = new OpenLayers.Layer.Vector(o.name, { styleMap: styleMap, renderers: renderer, zone_id.id }); map.addLayer(newLayer); layers.push(newLayer);
أكثر...