1

UPDATE: solved, kind of. I spent some time learning ogr2ogr and topojson and made a topojson that works beautifully in D3. I'm not sure why the file spit out by mapshaper.org turned into shards in my hands; on their site, the file displays fine.

ORIGINAL POST: There may be an answer out there, but how do you ask google "why does my d3 map look like zig zags and shards?" FWIW, "search by image" turned up nothing. ;)

I suspect it's something with wrong projection or wrong conversion from shapefiles? I've been converting via mapshaper.org while I'm learning ogr2ogr and topojson myself.

This should be a map of two Georgia counties, an area maybe 100 miles across. The shapefile came from U.S. Census Tiger.

UPDATE: Tiger's .xml seems to suggest the projection is WGS_1984_Web_Mercator_Auxiliary_Sphere

I got another shapefile of the same area from our state mapping agency and it mapped perfectly.

Any ideas?

d3.json("050_00.json", function(error, counties) {
  if (error) return console.error(error);
  console.log("ok counties:", counties)


 var projection = d3.geo.mercator()
    .scale(scale)
    .rotate([84.2, -33.9, 0]) 

var path = d3.geo.path()
  .projection(projection);

svg.selectAll("#counties")
  .data(topojson.feature(counties, counties.objects['050_00']).features)
  .enter().append("path")
    .attr("id", "counties")
    .attr("d", path)
    .attr("opacity", 0.5);
});

This is not a map of DeKalb County, GA

Adam Pearce
  • 9,243
  • 2
  • 38
  • 35
Maggie
  • 1,975
  • 3
  • 15
  • 17
  • 1
    does your shapefile give the projection? it's probably not geo mercator. – Union find Oct 01 '14 at 00:32
  • 1
    Any chance the source file uses some sort of internal coordinate system instead of long and lat? The last time I got a similar glitch-art geoJSON question, that [turned out to be the case](http://stackoverflow.com/a/22117477/3128209). The curved lines imply that the d3 projection is wrapping the lines around the globe a few times... – AmeliaBR Oct 01 '14 at 03:05
  • 1
    Another option: you could load it in QGIS and see what it looks like there (after going through a few coordinates options). – goblin-esque Oct 01 '14 at 04:14

0 Answers0