Plots2: Combined people/content inline maps

Created on 18 Jul 2018  Â·  38Comments  Â·  Source: publiclab/plots2

In follow-up for the big Geographic Features list (#1416 ), we still need a "combined" content + people map syntax, like:

[map:all:_latitude_:_longitude_]

https://publiclab.org/wiki/inline-maps doesn't list it, so once we implement, we can add that new syntax.

We'd love to show BOTH nodes and profiles at https://publiclab.org/puerto-rico

It'd be a combination of:

  1. People maps: https://github.com/publiclab/plots2/blob/master/app/models/concerns/node_shared.rb#L220
  2. Note maps: https://github.com/publiclab/plots2/blob/master/app/models/concerns/node_shared.rb#L174

I think we could probably make private methods that did these two so there's no code duplication.

@mridulnagpal or @sagarpreet-chadha interested in this one? Mridul knows this stuff pretty well.

I think the templates themselves are at:

JavaScript Ruby enhancement help wanted stale

Most helpful comment

I'll think about how best to do this! We basically just have to initialize a regular map and then turn on a few layers. Maybe an option in LEL would be best. I think the include param makes sense for including ONLY a set number of layers. But we could have one called display maybe that is in the same format, listing which layers to turn on?

All 38 comments

I think this may now be possible by using a content map, and specify the PL People layer from LEL to be shown... @sagarpreet-chadha is this right?

Yes right :)

On Fri, 15 Nov 2019, 21:24 Jeffrey Warren, notifications@github.com wrote:

I think this may now be possible by using a content map, and specify the
PL People layer from LEL to be shown... @sagarpreet-chadha
https://github.com/sagarpreet-chadha is this right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/3090?email_source=notifications&email_token=ADSCRRJJMUQ4B35JNNWWUGLQT3A3FA5CNFSM4FKUAMH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEF3L6I#issuecomment-554415609,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADSCRRI62DLCV3NF6ENJVSDQT3A3FANCNFSM4FKUAMHQ
.

No apologies, we donot have this. We have LEL+content and LEL+people, but
donot have content+people.

On Sat, 16 Nov 2019, 00:13 Sagarpreet Chadha, notifications@github.com
wrote:

Yes right :)

On Fri, 15 Nov 2019, 21:24 Jeffrey Warren, notifications@github.com
wrote:

I think this may now be possible by using a content map, and specify the
PL People layer from LEL to be shown... @sagarpreet-chadha
https://github.com/sagarpreet-chadha is this right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
https://github.com/publiclab/plots2/issues/3090?email_source=notifications&email_token=ADSCRRJJMUQ4B35JNNWWUGLQT3A3FA5CNFSM4FKUAMH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEF3L6I#issuecomment-554415609
,
or unsubscribe
<
https://github.com/notifications/unsubscribe-auth/ADSCRRI62DLCV3NF6ENJVSDQT3A3FANCNFSM4FKUAMHQ

.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/3090?email_source=notifications&email_token=ADSCRRNGRC4PE36YRXVZ5RTQT3UWPA5CNFSM4FKUAMH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGLIQA#issuecomment-554480704,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADSCRRLSTK7HO2FWPKCHNK3QT3UWPANCNFSM4FKUAMHQ
.

Ah, but if we do LEL + content, but we also specify the PL People layer in LEL, wouldn't we see both? Thanks!!

Yes that is correct but we do not have people layer in LEL yet.

Ah, ok!

On Fri, Nov 15, 2019 at 1:56 PM Sagarpreet Chadha notifications@github.com
wrote:

No apologies, we donot have this. We have LEL+content and LEL+people, but
donot have content+people.

On Sat, 16 Nov 2019, 00:13 Sagarpreet Chadha, notifications@github.com
wrote:

Yes right :)

On Fri, 15 Nov 2019, 21:24 Jeffrey Warren, notifications@github.com
wrote:

I think this may now be possible by using a content map, and specify
the
PL People layer from LEL to be shown... @sagarpreet-chadha
https://github.com/sagarpreet-chadha is this right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<

https://github.com/publiclab/plots2/issues/3090?email_source=notifications&email_token=ADSCRRJJMUQ4B35JNNWWUGLQT3A3FA5CNFSM4FKUAMH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEF3L6I#issuecomment-554415609

,
or unsubscribe
<

https://github.com/notifications/unsubscribe-auth/ADSCRRI62DLCV3NF6ENJVSDQT3A3FANCNFSM4FKUAMHQ
>

.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<
https://github.com/publiclab/plots2/issues/3090?email_source=notifications&email_token=ADSCRRNGRC4PE36YRXVZ5RTQT3UWPA5CNFSM4FKUAMH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGLIQA#issuecomment-554480704
,
or unsubscribe
<
https://github.com/notifications/unsubscribe-auth/ADSCRRLSTK7HO2FWPKCHNK3QT3UWPANCNFSM4FKUAMHQ

.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/3090?email_source=notifications&email_token=AAAF6JZFN3F3CF4O6BFYGNLQT3WFTA5CNFSM4FKUAMH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGMLAI#issuecomment-554485121,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAF6J7CBTDQ4UY33DOLPJ3QT3WFTANCNFSM4FKUAMHQ
.

Ah, but if we do LEL + content, but we also specify the PL People layer in LEL, wouldn't we see both? Thanks!!

@jywarren , should we make a new people Layer in LEL to solve this? Thanks!

And then we can use:

[map:layers:content:23:77:PEOPLE_LAYER]

What do you think @jywarren ?

Ah ok - so i think we need to link to this: https://github.com/publiclab/plots2/pull/5961

@sagarpreet-chadha what if we thought about @nstjean's work on the /map/_slug_ page and getting people appearing there? And think in parallel about the way to do the inline shortcode?

@nstjean what do you think of this?

Also, #5961 does need some additional work on how the list of people is displayed when you click on a grid square, and perhaps some design thinking about how to explain the grid vs. the markers, maybe a message something like:

Learn about location privacy and why some people are displayed in grid format

within the grid square popup?

Sorry to be putting this info just here, i know this has some break-out tasks to get all these parts working smoothly together.

I'll be going through all of this next week! It makes sense to be able to add a content layer and a people layer to get everything to show up!

Hey @jywarren , @nstjean
Breaking this into small issues:

  • [x] Make a People Layer in LEL.

  • [ ] Testing inline map including people Layer using syntax [map:layers:content:23:77:PEOPLE_LAYER]

  • [ ] Using LEL embed parameter to load people Layer by default in /map/_slug_ page.

  • [ ] Modifying PR https://github.com/publiclab/plots2/pull/5961 to include People Layer of LEL instead of calling API directly.

  • [ ] In PR https://github.com/publiclab/plots2/pull/5961 adding message to tell about the grid Vs people relation.

Thanks!

@sagarpreet-chadha Are you working on a People layer in LEL or do you want me to do it?

I can not start immediately 😄 . If this is becoming blocker you can work on it else i will do it by Saturday. Thanks!

I'll see if I get to it! I have something in LBL to fix first. :)

@sagarpreet-chadha It looks like there is already a People layer in LEL: https://github.com/publiclab/leaflet-environmental-layers/blob/master/src/PLpeopleLayer.js
It was disabled on the example page, but I turned it on and it seems to work (though it is very slow). Is this what is needed?

I am not seeing a PL content layer however.

We do PL content within plots2, actually -- see these resources --

https://publiclab.org/wiki/inline-maps

This template builds the map:

https://github.com/publiclab/plots2/blob/master/app/views/map/_inlineLeaflet.html.erb

And here's the JS to fetch and display!

https://github.com/publiclab/plots2/blob/c5e3275d8f3841c2291551abfc8d357904dfddd2/app/assets/javascripts/leaflet_helper.js#L94

I hope this helps!

I need to write back to Sagarpreet and you on the people map thing. I think there were some remaining todos with the people map layer in LEL!

Aha - yes, @sagarpreet-chadha had listed them above!

Hey @nstjean ,
Yes i remember i had made people layer long way back!
You may not be getting content due to CORS error (check browser console).
Although /people layer in not part of allLayer.js file, right? We can easily add thay there now. Thanks!

I don't see an error. And the markers do show up eventually! but every time I move the map it takes a long time for the markers to re-appear. Is that normal?

Peek 2020-01-15 11-35

I don't think it's in allLayers.js so I'll do that. :)

I'm getting errors when running tests in master in LEL:

<a href="natalie@natalie-ubuntu">natalie@natalie-ubuntu</a>: ~-Dev-Ruby-public-lab-leaflet-environmental-layers_021

This appears to be the same issue from https://github.com/publiclab/leaflet-blurred-location/pull/232#issuecomment-574215331

Looks like I'll have to figure out how to get the tests running without a warning in LBL.

Hey as this PR is old, make sure you are using latest version of LBL. Thanks!

I'm definitely using the latest version of LBL, the same test errors are showing for PLpeopleLayer.

I think I've solved the testing issues in https://github.com/publiclab/leaflet-blurred-location/pull/235

And then once that fix is published I'll post the PR for showing the PLpeopleLayer. It's still really slow, though, which you can see here: https://publiclab.github.io/leaflet-blurred-location-display/examples/ If you scroll up to the UK/Europe it takes a long while for markers to show up. Is this something I should try to fix in LBLD? Or should I continue on with other items on this list ?

I'm making good progress here! Right now in the inline maps we have some that specify layers to display on page load, and some that don't.

  • no layers specified -> display no LEL layers but add all LEL layers to the layer menu
  • specify layers -> display those layers on the map and add only those layers to the menu
    Example: https://stable.publiclab.org/wiki/inline-maps scroll down to "Maps with preset layers" - it only has 2 layers listed in the menu.

My question is should all the layers be added to the menu even when we want only a couple of layers to shown on the map on page load?

@jywarren @sagarpreet-chadha @crisner

My question is should all the layers be added to the menu even when we want only a couple of layers to shown on the map on page load?

Do you mean to specify the layers, load only them to the layer menu but not displayed by default on the map? That is you want the same behaviour from the second point mentioned above but without displaying the maps by default on the page. If this is what you meant, there is an option addLayersToMap, that you can pass in LEL that decides if the layers should be displayed by default on the map when you specify them. It is not available in the version of LEL here in plots2 but will be available in the next version.

Yes awesome

@crisner No, what I mean is loading ALL available layers to the menu, but turning on two of the layers to display just like it does when you use addLayersToMap.

Oh okay, why do you want to do this?

My question is should all the layers be added to the menu even when we want only a couple of layers to shown on the map on page load?

Yes i guess we can do it.

This might not be good for user experience because loading all layers can slow down the page and the users will be left stuck with no choice to remove it from the map.

@nstjean, What did you have in mind? I mean is there a reason you don't want users to have access to turning off those layers?

I think my explanation must be getting confused. I don't mean turning on all the layers. I mean having only the two layers being turned on and visible on the map, but having the other layers available in the menu if the user wants to turn it on.

For example, say in the page only the Unearthing layer is specified. And the user wants to share it to their page, but they also want to add the pfasLayer. Right now there is no way for them to do that, because there is only the Unearthing layer in the menu. That's the only layer they have access to on that map.

FireShot Capture 261 - 🎈 Public Lab_ Inline Maps - localhost

Ah! you can have all the layers added to the menu if you don't pass in the include option. In LEL we use the url hash to determine which layer we want to load on the map by default. Maybe something like that can be done here in plots2?
Or how about this we could add another option in LEL and add some logic into it to get this done. It depends on if we want to keep the current style of displaying only the selected layers in the menu.

In LEL we use the url hash to determine which layer we want to load on the map by default. Maybe something like that can be done here in plots2?

This won't help inline maps. So scratch out what I said about using the url hash.

I'll think about how best to do this! We basically just have to initialize a regular map and then turn on a few layers. Maybe an option in LEL would be best. I think the include param makes sense for including ONLY a set number of layers. But we could have one called display maybe that is in the same format, listing which layers to turn on?

I like this include display convention! Sounds awesome, and thanks for thinking through this distinction!

And yes, to be honest I think across all maps on PL we want all layers to be /available/ but only some to be /shown/. So this distinction can be really helpful for such variations. Thank you!!!

Ok great! I'll add this to LEL today.

I believe this is complete! Thank you!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RuthNjeri picture RuthNjeri  Â·  3Comments

grvsachdeva picture grvsachdeva  Â·  3Comments

milaaraujo picture milaaraujo  Â·  3Comments

grvsachdeva picture grvsachdeva  Â·  3Comments

divyabaid16 picture divyabaid16  Â·  3Comments