What is the difference of using esri/geometry/geometryEngine distance method and GeometryService length method? Which is faster and capable of calculating distance on Mouse Move event on client side in JS API?


The geometryEngine should be faster as it runs client side. Although there would be the slight slow down as the module gets loaded during your site's initialization, you don't need to wait for a callback function as you would with the GeometryService.

If you're doing it with the mouse move event, definitely stay client side with geometryEngine.


@Branco is right, but its also important to note that the geometryEngine distance and length methods are only capable of generating geodesic calculations for WGS84 and Web Mercator maps. As such the clientside library should not be used to calculate planar measurements in map projections that distort distance.

see this blog for more information.

  • So this is true for all geometryEngine methods? I'm trying unsuccessfully to use nearestCoordinate with a projected layer, but no chance it's going to work then ? Is there any other alternative for finding the closest feature for a clicked location? Pity this isn't explained clearly in the doc, I've lost a lot of time. – GISGe Feb 7 '17 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.