topoJSON question

65 views
Skip to first unread message

Tito

unread,
Apr 22, 2016, 12:24:44 PM4/22/16
to d3-js
Hello

Trying to learn d3 mapping using topoJSON. I got USA map going and then I want to overlay another topoJSON but I get following error

counties:57 Uncaught TypeError: Cannot read property 'counties' of undefined

[{
"type": "Topology",
"objects": {
"counties": {
"type": "GeometryCollection",
"geometries": [{
"type": "Polygon",
"properties": {
"name": "King County"
},
"id": "019",
"arcs": [
[0, 1, 2]
]

  svg.append("path")
      .datum(topojson.feature(counties, counties.objects.counties))
      .attr("class", "points")
      .attr("d", path);

Thanks!

Ian Johnson

unread,
Apr 22, 2016, 1:11:47 PM4/22/16
to d3...@googlegroups.com
would you mind posting a block with your topojson file and sample code that breaks? You can use http://blockbuilder.org to quickly put one together.

it does look like you have an array of topojson objects from the minimal snippet you've pasted, what happens if you console.log(counties)?

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ian Johnson - 周彦

Tito

unread,
Apr 22, 2016, 1:54:12 PM4/22/16
to d3-js
is there a way to reference us.json as one does for d3 using cdnjs. or is there a folder I can reference?

I will post my stuff asap

mark montgomery

unread,
Apr 22, 2016, 1:59:50 PM4/22/16
to d3-js
Hi,

If you have an account over at https://gist.github.com/ you can place code in there. Remember to call your HTML file "index.html"

Then you access the blocks site that Ian mentions - http://bl.ocks.org/-/about 

Ian Johnson

unread,
Apr 22, 2016, 2:46:11 PM4/22/16
to d3...@googlegroups.com
You can also upload a file directly to blockbuilder.org (the little plus sign in the top right)

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tito

unread,
Apr 22, 2016, 4:15:01 PM4/22/16
to d3-js
dang this is nice!

ok I have my stuff uploaded here

Tito

unread,
Apr 22, 2016, 4:15:40 PM4/22/16
to d3-js
I mean here

http://blockbuilder.org/yosiasz/4c2598dc9ce6a521ef6a3fc31410f9a4

On Friday, April 22, 2016 at 11:46:11 AM UTC-7, Ian Johnson wrote:

Ian Johnson

unread,
Apr 22, 2016, 5:14:22 PM4/22/16
to d3...@googlegroups.com
How did you make the counties.topojson file?
It looks like its an array of topojson features but they have no arcs. I don't know enough to know if that matters, but it seems like it could be the source of your problem?

to be sure, this is supposed to be something different than the counties found in us.json?

Tito

unread,
Apr 23, 2016, 1:56:00 AM4/23/16
to d3-js
it was just soms topo data I found somewhere. not even sure it is counties. I used another topo data for airports and it works. I will compare to see what the issue is.

thanks all!!!

Tito

unread,
Apr 25, 2016, 1:21:20 PM4/25/16
to d3-js
after a few dizzying hours with topoJson here is what I now have

Reply all
Reply to author
Forward
0 new messages