District.Boundary.Shape ???

22 views
Skip to first unread message

Brandon Gresham

unread,
Mar 25, 2012, 3:24:59 PM3/25/12
to fifty-sta...@googlegroups.com
On http://openstates.org/api/districts/#district-boundary-lookup we see the following gist:


Notice that 'shape' is embedded in a 4-layer object.  I thought it was just that particular example and how it's truncated.  But I queried a district in my state and found the same thing.
Is there a reason this field is this way, or can I safely just strip out the top few layers and treat it as a single object consisting of a list of pairs?  ie: List<BoundaryPoints>

Or, are there instances where this:

[[[[-111.944203, 40.832028], [-111.942407, 40.831548], ... ]]]

doesn't hold and can be this:

[-111.944203, 40.832028], [-111.942407, 40.831548], ... 

], 

[ ... ], ... 

], 

[ ... ], ... ] 

]

????


If this holds, can anyone provide me an example of such?

 


 

Brandon Gresham

unread,
Mar 25, 2012, 3:27:53 PM3/25/12
to fifty-sta...@googlegroups.com
Sorry, that gist-embed didn't work how I expected; here it is raw instead:

{
   "name":"35",
   "region":{
      "lon_delta":1.6516490000000061,
      "center_lon":-98.100715,
      "lat_delta":1.9897119999999973,
      "center_lat":28.479282
   },
   "chamber":"lower",
   "shape":[
      [
       [
         [ -97.359811,  28.400859 ],
         [ -97.368913,  28.393902 ],
         [ -97.373934,  28.390072 ],
         [ -97.375113,  28.389172 ],  
         ... // truncated
       ], ... 
     ]
   ],
   "abbr":"tx",
   "boundary_id":"sldl-tx-state-house-district-35",
   "num_seats":1
}

James Turk

unread,
Mar 26, 2012, 11:16:02 AM3/26/12
to fifty-sta...@googlegroups.com
The reason for this deeply nested structure is that some shapes are
multipolygons, if you're looking for an example look to a state like
Alaska that has lots of islands. I wouldn't recommend flattening it
or truncating it in any way.

> --
> You received this message because you are subscribed to the Google Groups
> "Open State Project" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/fifty-state-project/-/evcPvHg4edYJ.
>
> To post to this group, send email to fifty-sta...@googlegroups.com.
> To unsubscribe from this group, send email to
> fifty-state-pro...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fifty-state-project?hl=en.

Brandon Gresham

unread,
Mar 26, 2012, 11:51:48 AM3/26/12
to fifty-sta...@googlegroups.com
Dang, that's what I was worried about. :(
OK, thanks for the confirmation. :)

Brandon Gresham

unread,
Mar 26, 2012, 11:00:59 PM3/26/12
to fifty-sta...@googlegroups.com
How do you think it would be best to represent this?   Like so?

public String[][][][] shape; 

 
Reply all
Reply to author
Forward
0 new messages