Trying to make a little page to reproject data using d3.carto jam and it kind of works.
This defaults to a gnomonic projection w/ map.mode('globe') which makes for some rotating cool rotation effects when panning the map rather than just transitioning every path like in projection mode.
Then there's the boring old transform mode which I think is just mercator.
Please see d3-cart-map readme.md for a little explanation of the map modes (from which 'globe' is missing). And show me how to use them correctly.
https://github.com/emeeks/d3-carto-map
Things which could make this a little nicer:
-Adding some graticules maybe not to the feature group.
-Adding different kinds of layers.
-Figure out what the errors are about the paths which get multiplied when panning in globe mode.
For some much cleaner better javascript examples of how to do similar things w/ d3 please see Jason Davies stuff like http://www.jasondavies.com/maps/transition/ and Mike Bostocks stuff like /mbostock/3711652.
Really I'm just trying to figure out how to kind of do some things they did w/ d3-carto-map.
As always let me know if there is anything silly in my code or how I could make it better.
xxxxxxxxxx
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<title>reprojection selection</title>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="https://raw.githubusercontent.com/emeeks/d3-carto-map/master/d3map.css" />
<link type="text/css" rel="stylesheet" href="https://raw.githubusercontent.com/emeeks/d3-carto-map/master/examples/example.css" />
</head>
<style>
html,body {
height: 100%;
width: 100%;
margin: 0;
}
#map {
height: 90%;
width: 90%;
top: 10%;
position: absolute;
}
#title {
padding: 20px;
}
.bluesquare {
fill: green;
stroke: gray;
stroke-width: 1px;
}
button.marker {
position: fixed;
z-index: 1;
bottom: 150px;
left: 150px;
}
.countryborders{
fill:#99d8c9;
stroke:#de2d26;
}
.reproject{
margin-top:-15;
}
.reprojectshp{
margin-top:-15;
}
.addgr{
margin-top:-15;
}
#projection-menu{
margin-top:5px;
}
.grat{
stroke:grey;
stroke-width:1px;
stroke-opacity:.7;
fill:none;
}
</style>
<select id="projection-menu"></select>
<script src="./projmode.js" type="text/javascript">
</script>
<body onload="makeSomeMaps()">
<body onload="makeSomeMaps()">
<div id="map"></div>
<footer>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8" type="text/javascript"></script>
<script src="https://d3js.org/topojson.v1.min.js" type="text/javascript">
</script>
<script src="https://d3js.org/d3.geo.projection.v0.min.js" type="text/javascript">
</script>
<script src="/mpmckenna8/raw/55557f2cc06ae603f242/tile.js" type="text/javascript">
</script>
<script src="/mpmckenna8/raw/55557f2cc06ae603f242/d3.quadtiles.js" type="text/javascript">
</script>
<script src="/mpmckenna8/raw/55557f2cc06ae603f242/d3.geo.raster.js" type="text/javascript">
</script>
<script src="https://cdn.jsdelivr.net/gh/emeeks/d3-carto-map/d3.carto.map.js" type="text/javascript">
</script>
</footer>
</body>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://d3js.org/topojson.v1.min.js to a secure url
Modified http://d3js.org/d3.geo.projection.v0.min.js to a secure url
Updated missing url https://rawgit.com/emeeks/d3-carto-map/master/d3.carto.map.js to https://cdn.jsdelivr.net/gh/emeeks/d3-carto-map/d3.carto.map.js
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js
https://d3js.org/d3.geo.projection.v0.min.js
https://rawgit.com/emeeks/d3-carto-map/master/d3.carto.map.js