Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineString distanceTo Issues #1391

Open
geographika opened this issue Sep 25, 2014 · 0 comments
Open

LineString distanceTo Issues #1391

geographika opened this issue Sep 25, 2014 · 0 comments

Comments

@geographika
Copy link

I've been having some issues using the distanceTo function on linestring geometries. I'm not sure this is a misunderstanding on my part or problems in the OL library.

An example:

var feat1, feat2, wkt1, wkt2;
var wkt = new OpenLayers.Format.WKT();

wkt1 = 'LINESTRING(0 0, 10 0)';
wkt2 = 'LINESTRING(11 0, 20 0)';

feat1 = wkt.read(wkt1);
feat2 = wkt.read(wkt2);

var dist = feat1.geometry.distanceTo(feat2.geometry);
console.log(dist); // would expect this to be 1? In fact returns 0

In fact any start X for the second line with a Y of 0 returns a distance of 0.

Also the docs at http://dev.openlayers.org/releases/OpenLayers-2.13.1/doc/apidocs/files/OpenLayers/Geometry/LineString-js.html#OpenLayers.Geometry.LineString.distanceTo states that this function "Calculate the closest distance between two geometries (on the x-y plane)" - however it appears to simply find the distance between the two closest vertices of the line geometries?

geographika added a commit to geographika/openlayers that referenced this issue Oct 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant