Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// geoContains(...) =======================================================
let contained: boolean = d3Geo.geoContains(samplePolygon, [0, 0]);
contained = d3Geo.geoContains(sampleSphere, [0, 0]);
contained = d3Geo.geoContains(sampleGeometryCollection, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedGeometryCollection, [0, 0]);
contained = d3Geo.geoContains(sampleFeature, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedFeature1, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedFeature2, [0, 0]);
contained = d3Geo.geoContains(sampleFeatureCollection, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedFeatureCollection, [0, 0]);
// geoDistance(...) =======================================================
const distance: number = d3Geo.geoDistance([54, 2], [53, 1]);
// geoLength(...) =========================================================
let length: number = d3Geo.geoLength(samplePolygon);
length = d3Geo.geoLength(sampleSphere);
length = d3Geo.geoLength(sampleGeometryCollection);
length = d3Geo.geoLength(sampleExtendedGeometryCollection);
length = d3Geo.geoLength(sampleFeature);
length = d3Geo.geoLength(sampleExtendedFeature1);
length = d3Geo.geoLength(sampleExtendedFeature2);
length = d3Geo.geoLength(sampleFeatureCollection);
length = d3Geo.geoLength(sampleExtendedFeatureCollection);
// geoInterpolate(...) ====================================================
const interpolateFct: (t: number) => [number, number] = d3Geo.geoInterpolate([54, 2], [53, 1]);
// geoContains(...) =======================================================
let contained: boolean = d3Geo.geoContains(samplePolygon, [0, 0]);
contained = d3Geo.geoContains(sampleSphere, [0, 0]);
contained = d3Geo.geoContains(sampleGeometryCollection, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedGeometryCollection, [0, 0]);
contained = d3Geo.geoContains(sampleFeature, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedFeature1, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedFeature2, [0, 0]);
contained = d3Geo.geoContains(sampleFeatureCollection, [0, 0]);
contained = d3Geo.geoContains(sampleExtendedFeatureCollection, [0, 0]);
// geoDistance(...) =======================================================
const distance: number = d3Geo.geoDistance([54, 2], [53, 1]);
// geoLength(...) =========================================================
let length: number = d3Geo.geoLength(samplePolygon);
length = d3Geo.geoLength(sampleSphere);
length = d3Geo.geoLength(sampleGeometryCollection);
length = d3Geo.geoLength(sampleExtendedGeometryCollection);
length = d3Geo.geoLength(sampleFeature);
length = d3Geo.geoLength(sampleExtendedFeature1);
length = d3Geo.geoLength(sampleExtendedFeature2);
length = d3Geo.geoLength(sampleFeatureCollection);
length = d3Geo.geoLength(sampleExtendedFeatureCollection);
// geoInterpolate(...) ====================================================
const interpolateFct: (t: number) => [number, number] = d3Geo.geoInterpolate([54, 2], [53, 1]);
function distanceFromAirports(airportCode1, airportCode2) {
return (
geoDistance(
[
airportIataCodeToCoordinates(airportCode1).longitude,
airportIataCodeToCoordinates(airportCode1).latitude,
],
[
airportIataCodeToCoordinates(airportCode2).longitude,
airportIataCodeToCoordinates(airportCode2).latitude,
]
) * 6371 // To convert great-arc distance (in radians) into km.
+ detourConstant
);
}
markers.map((x, i) => {
const areaCoords = [x.longitude, x.latitude];
const distance = d3.geoDistance(areaCoords, projection.invert([width / 2, height / 2]));
const sphereCoords = projection(areaCoords);
const isActive = activeMarkerId === x.id;
// eslint-disable-next-line
const fill = distance > 1.57 ? 'none' : isActive ? colors.activeMarker : colors.marker;
const radius = isActive ? 9 : 6;
return (
public distance(pointA: IGeoPoint, pointB: IGeoPoint): number {
return d3geo.geoDistance([pointA.longitude, pointA.latitude], [pointB.longitude, pointB.latitude]);
}
geoDistance(p1, p2) {
return geoDistance(p1, p2);
},
geoLength(feature) {
v.find = function(x, y, radius) {
v._found = v.delaunay.find(x, y, v._found);
if (!radius || geoDistance([x, y], v.points[v._found]) < radius)
return v._found;
};
function find0(lambda, phi) {
var d0 = Infinity;
var found = -1;
for (var i = 0; i < faces.length; i++) {
var d = distance(faces[i].site, [lambda, phi]);
if (d < d0) {
d0 = d;
found = i;
}
}
return found;
}