Comments (5)
Unfortunately to use world-110m.json
one would have to depend on topojson. I'm not sure this is what we want here.
I've created a test in test/projection/equirectangular-test.js
with a random test/data/countries.geo.json
; is it the kind of test you had in mind?
var tape = require("tape"),
fs = require("fs"),
d3_geo = require("../../");
var projection = d3_geo.geoEquirectangular()
.scale(900 / Math.PI)
.precision(0);
tape("projection equirectangular: center", function(test) {
test.deepEqual(projection([0,0]), [ 480, 250 ]);
test.end();
});
tape("projection equirectangular: countries geojson", function(test) {
var world = JSON.parse(fs.readFileSync("test/data/countries.geo.json", "utf-8"));
var path = d3_geo.geoPath()
.projection(projection);
test.equal(path(world).replace(/[13579]/g, '').length, 159941);
test.end();
});
from d3-geo.
path(world).replace(/[13579]/g, '').length
is here just to list a very short result in the test file; it could be a crc32 or anything else…
from d3-geo.
A topojson dependency isn’t strictly required since you can make a copy of world-110m.json, and you could convert it to GeoJSON to avoid the dependency on the client library. But I don’t see any issue with having a devDependency on topojson for the purpose of testing.
from d3-geo.
It might be nice to do image-based testing since these are much easier to review than looking at the coordinates of the generated geometry by hand.
from d3-geo.
Also automate these tests https://jasondavies.com/maps/clip/
from d3-geo.
Related Issues (20)
- d3.geoBounds returning confusing output HOT 1
- How can I clamp a geodesic to between a max/min latitude? HOT 1
- fit-test.js Remove duplicate test HOT 1
- Geojson to SVG offset HOT 1
- Geojson to SVG offset
- Cannot import d3-geo in node with typescript HOT 8
- Geographic or Geodetic HOT 1
- D3 uses GeoJSON to represent geographic features in JavaScript HOT 2
- postclip with polygon path maybe... HOT 10
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module / require() of ES modules is not supported HOT 2
- geoAzimuthalEqualArea not rendering straight lines HOT 2
- clipCircle's precision is too low
- Configurable precision for d3.geoPath
- Mercator. Getting boundary values by longitude HOT 2
- Mercator with rotate. Incorrect conversion from projection to geographic coordinates HOT 3
- Сonvert geographic points considering antimeridian and pole HOT 1
- geoContains function doesn't seem to handle MultiPolygons HOT 9
- path.bounds should return numbers even when input coordinates are strings
- [Question] API for chekcing if point is in view or not given projection HOT 3
- Mercator Map centered on the Pacific HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-geo.