Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('geoProject(feature, projection)', () => {
expect(dv.geoProject(feature0, 'geoAiry')).to.eql(d3GeoProjection.geoProject(feature0, d3GeoProjection.geoAiry()));
});
it('geoProjectByName(name, projection)', () => {
geoProject(feature: ExtendedFeature, projection: string, exportRaw?: boolean) {
projection = getGeoProjection(projection, exportRaw);
return geoProject(feature, projection);
},
geoProjectByName(this: View, name: string, projection: string, exportRaw?: boolean) {
const usOrig = require('../node_modules/us-atlas/us/10m.json');
const worldOrig = require('../node_modules/world-atlas/world/50m.json');
const projection = d3geo.geoAlbersUsa().scale(1280).translate([480, 300]);
const invert = d3geo.geoTransform({
point: function(x, y) {
const inverted = projection.invert([x, y]);
this.stream.point(inverted[0], inverted[1]);
}
});
const usFeatProjected = topojson.feature(usOrig, {
type: "GeometryCollection",
geometries: usOrig.objects.states.geometries,
});
const usFeat = d3geoProjection.geoProject(usFeatProjected, invert);
const worldFeat = topojson.feature(worldOrig, {
type: "GeometryCollection",
geometries: worldOrig.objects.countries.geometries.filter(c => c.id != "840"),
});
const combinedFeats = {
type: "FeatureCollection",
features: usFeat.features.concat(worldFeat.features),
};
const combinedTopo = topojson.topology({all: combinedFeats}, 1e3);
let combinedSimpl = topojson.presimplify(combinedTopo);
combinedSimpl = topojson.simplify(combinedSimpl, 0.25);
const combinedResult = topojson.feature(combinedSimpl, combinedSimpl.objects.all);
geoProject(feature, projection, exportRaw) {
projection = getGeoProjection(projection, exportRaw);
return geoProject(feature, projection);
},
geoProjectByName(name, projection, exportRaw) {
geoProjectByName(name, projection, exportRaw) {
projection = getGeoProjection(projection, exportRaw);
return geoProject(this.geoFeatureByName(name), projection);
},
geoProjectPosition(position, projection, exportRaw) {
geoProjectByName(this: View, name: string, projection: string, exportRaw?: boolean) {
projection = getGeoProjection(projection, exportRaw);
return geoProject(this.geoFeatureByName(name), projection);
},
geoProjectPosition(position: [number, number], projection: string, exportRaw?: boolean) {