filter map (or other visualization page) to a subset of the collection #104
Replies: 5 comments
-
@sheishistoric you want to create a "New York" specific version of the map page that only has points for the items with "New York" as the location? I would add that as another
That would set up the "items" as the subset you want, then you won't need to modify anything else below. |
Beta Was this translation helpful? Give feedback.
-
Fair enough! I was hoping to not make copies of the map individual customizations but probably less work for myself.
|
Beta Was this translation helpful? Give feedback.
-
Oh actually, I think I see what you mean better--> like you would like to be able to set the "location" in the page front matter so you could use the map layout for multiple different map pages? So that would be possible with a quick customization of the map-js.html file--> This version supports the options "location", "latitude", "longitude", and "zoom" in the page front matter. With no front matter, the map will be the standard CB map. To create a new customized map page with the data filtered by a specific value in the "location" column, you would add front matter options in the yml front matter of the page:
You could create additional pages with the "layout: map", and customize each with different options. The version I linked above uses this Liquid to filter the items:
So the "location" field would have to match exactly to what you set in the location option. |
Beta Was this translation helpful? Give feedback.
-
Okay, yes! That's what I was thinking - thank you. |
Beta Was this translation helpful? Give feedback.
-
I am going to convert this to a Discussion in case other people want to do this! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to have be able to show the map & timeline for a subset of my collection as well as my full collection. The subset will be based on location (for example, I want to be able to show the map for "New York" and have a separate map for all items including New York.) I should be able to do this by editing the map-js.html like so:
`{%- assign items = items | where_exp: 'item', 'item.objectid != nil' | where_exp: 'item','item.latitude' -%}
{%- capture place -%}
{{ page.location }}
{%- endcapture -%}
{%- assign items = items[place] -%}`
But this doesn't seem to filter as expected (my New York map shows no items). Is there a recommended way to do such a thing?
Beta Was this translation helpful? Give feedback.
All reactions