src/util/measure/MeasurerUtils.js
function (location, locations) {
                var result = false;
                var p1 = locations[0];
                for (var i = 1, len = locations.length; i < len; i++) {
                    var p2 = locations[i];
                    if (((p2.latitude <= location.latitude && location.latitude < p1.latitude) ||
                        (p1.latitude <= location.latitude && location.latitude < p2.latitude)) &&
                        (location.longitude < (p1.longitude - p2.longitude) * (location.latitude - p2.latitude) /
                        (p1.latitude - p2.latitude) + p2.longitude)) {
                        result = !result;
                    }
                    p1 = p2;
                }
                return result;
            }
function (location, locations) {
                var result = false;
                var p1 = locations[0];
                for (var i = 1, len = locations.length; i < len; i++) {
                    var p2 = locations[i];
                    if (((p2.latitude <= location.latitude && location.latitude < p1.latitude) ||
                        (p1.latitude <= location.latitude && location.latitude < p2.latitude)) &&
                        (location.longitude < (p1.longitude - p2.longitude) * (location.latitude - p2.latitude) /
                        (p1.latitude - p2.latitude) + p2.longitude)) {
                        result = !result;
                    }
                    p1 = p2;
                }
                return result;
            }
function ( location , locations ) { var result = false ; var p1 = locations [ 0 ] ; for ( var i = 1 , len = locations . length ; i < len ; i ++ ) { var p2 = locations [ i ] ; if ( ( ( p2 . latitude <= location . latitude && location . latitude < p1 . latitude ) || ( p1 . latitude <= location . latitude && location . latitude < p2 . latitude ) ) && ( location . longitude < ( p1 . longitude - p2 . longitude ) * ( location . latitude - p2 . latitude ) / ( p1 . latitude - p2 . latitude ) + p2 . longitude ) ) { result = ! result ; } p1 = p2 ; } return result ; }
Determines whether a location is located inside a given polygon.

@param {Location} location
@param {Location[]}locations The list of positions describing the polygon.
Last one should be the same as the first one.

@return {Boolean} true if the location is inside the polygon.
Determines whether a location is located inside a given polygon .