simile-widgets/exhibit

Map view - show marker for individual country only

Closed this issue · 1 comments

If I have data containing a list of projects and the countries where the projects are implemented (one project can belong to multiple countries), what is the best way to show all projects for only one country?
If I use country as one of the facet, it displays marker on the selected country as well as other countries where the same project is implemented.

For instance, say, project X is implemented in US and Canada. If I set country as a facet and select only 'US', a marker appears in both US and Canada. I want to display only one marker when user selects specific country.

If the project and country association is one to one, there's no issue but in this case, one project can be associated with multiple countries. Any solution/suggestion?

Since this is a usage question and not a bug/feature request, it's probably better asked on the simile-widgets mailing list.

But here's one answer. If you want to display project sites, then your map needs to show a collection of sites not projects. I'm assuming that right now you give each project several lat-long coordinates that create markers on the map. Instead, create a bunch of site entities, and define each project to have sites instead of coordinates:

{
{type: "Project", label: "P1", site: ["S1", "S2"], color: "red"},
{type: "Project", label: "P2", site: ["S2", "S3"], color: "blue"},
{type: "Site", label: "S1", coords: "45.1, 42.0"}
etc.
}

Now define a collection consisting of just the sites,

<div data-ex-role="collection" data-ex-item-types="Site">

and show that collection of sites on the map. Then use facets to filter the sites by filtering the projects. For example, if I wanted to be able to filter on the color of the project, I would say

<div data-ex-role="facet" data-ex-expression="!Project.color"></div>

which says "for each site, check it's project, and use the color of that project in the facet.