utfgrids, geojson, attribute_fields

20 views
Skip to first unread message

jcothran

unread,
Feb 12, 2013, 5:10:16 PM2/12/13
to madrona
Hey folks,

I'm working to understand how to use the ogr and utfgrid methods for
converting shapefiles to geojson. I'm able to run the test_data
example below successfully to create the output .json files

https://github.com/Ecotrust/create-utfgrids

but when I look at the layer json config files at
https://github.com/Ecotrust/marco-portal/blob/master/marco/fixtures/layer_data.json
and see for example the 'attribute_fields' for 'sea level
vulnerability' or other XYZ or Vector layer_type - I'm not sure what
the mapping is between what the json file and request?

"attribute_fields": [
60,
61,
62,
63,
64,
65,
66
],

Feel free to link to existing documentation on the site I might have
overlooked explaining the process flow/relationship between the source
shapefile and output map image/legend and json files as geojson data
and layer config.

Thanks
Jeremy

Scott Fletcher

unread,
Feb 12, 2013, 5:34:57 PM2/12/13
to madron...@googlegroups.com, Jeremy Cothran
Hey Jeremy,

The attribute fields in the data layer fixture are actually only used for Vector layers (displayed via GeoJSON), and are not related to map tiles and utfgrids.  This field is a many-to-many field, relating a list of attribute fields to a given Vector layer.  

For map tile (XYZ) layers that have an associated UTF Grid, you'll want to use the utfurl field in the data manager layer admin to direct the application to the storage location for your utfgrid directories.  (do a ctrl-f on utfurl in the fixture to see how this looks).  
Populating this field will cause the UTFGrid to be loaded whenever the XYZ layer is active.  If you do a search for UTFGrid in map.js, you will find the relevant code, which creates a UTFGrid layer and adds a UTFControl object to the map.  

If this is not working, it is possible that the utfgrid json files are do not have any displayable content.  Realizing that some of these json files may not have any displayable content (not all tiles have displayable data), some poking around in these files should reveal a list of "keys" followed by a dictionary called "data" that associates attribution content with each of the keys.  If this is not the case, the problem may be in the utfgrid generation process.  

Feel free to give me a call if this is not making any sense, or if there are follow up questions that may be more easily discussed over a phone call.  

-Scott
 


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



Matt Perry

unread,
Feb 12, 2013, 5:49:39 PM2/12/13
to madron...@googlegroups.com
Hey Jeremey,

UTFGrids and GeoJSON are unrelated specs; utfgrids are designed to
provide supplementary attributes to rendered tile layers and geojson
data is rendered directly as vectors in the browser.

In fact, the main reason UTFGrids exist is to provide interactivity
for data that is too large or otherwise inappropriate for delivery as
geojson. Think of them as two alternate paths to getting data
interactivity.

- matt


On Tue, Feb 12, 2013 at 2:10 PM, jcothran <jeremy....@gmail.com> wrote:
> --
> You received this message because you are subscribed to the Google Groups "madrona" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to madrona-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>

Matthew T. Perry

"The best way to predict the future is to invent it." -- Alan Kay
http://www.perrygeo.net

"May your trails be crooked, winding, lonesome, dangerous, leading to
the most amazing view." -- Edward Abbey
http://viedevelo.wordpress.com
Reply all
Reply to author
Forward
0 new messages