BiologicalRecordsCentre / SPRING

Repository for tracking issues for the SPRING (EU Pollinator Monitoring) project
GNU General Public License v3.0
0 stars 0 forks source link

Map of SPRING MVS sites #24

Closed DavidRoy closed 2 years ago

DavidRoy commented 2 years ago

Following closed issue #20

Can you create a simple map page on the website for the site list

Also needed for #21

andrewvanbreda commented 2 years ago

@DavidRoy Yes, can do that very easily.

andrewvanbreda commented 2 years ago

Hi @DavidRoy On UKPoMS we have a Squares Management page for admins. However that did not include a map. I have extended the equivalent page on Spring here:

https://test-eu-pollinator.pantheonsite.io/list-squares

At the moment, this is designed for admins (has editing facility). Will you want it available for public or admins?

There are a couple of issues with page I will fix at low priority

  1. The points actually vanish when map zoomed in too far
  2. Map clicking is not highlighting the row on the grid and vice versa.
  3. Currently the map is set to zoom to output. However because of the locations spread, this results in a very far out zoom. Let me know how you want it to zoom.
DavidRoy commented 2 years ago

@andrewvanbreda that's great. In answer to your numbered points.

  1. would be good to fix but not an immediate issue
  2. Yes, this is important. It would be good to be able to select points on the map to either filter the table, or to bring up a pop-up of site details. There is a site clearly in the wrong place and I'd like to be able to find it in the list.
  3. That's fine for default zoom

Additional requirements:

andrewvanbreda commented 2 years ago

@DavidRoy Thanks for note about redirection. I have corrected that, and also on UKPomS (good example of the 2 projects helping each other out)

Other points noted and will be worked on.

andrewvanbreda commented 2 years ago

Hi @DavidRoy On SPRING, will squares be allocated as they are in UKPoMS?, on UKPoMS there is a checkbox that is set on the square to mark them as allocated which then would appear on this equivalent page https://test-eu-pollinator.pantheonsite.io/square-volunteer-pantrap-statuses

DavidRoy commented 2 years ago

hi @andrewvanbreda there is no need for the allocation checkbox for SPRING. There might be other attributes we want to capture but I'll raise any requirements separately

andrewvanbreda commented 2 years ago

Hi @BirenRathod Whenever you get a sec, can you pull this report please. Not urgent, just when you get a sec. Cheers reports/projects/PoMS/spring_squares_list_and_mapping.xml

BirenRathod commented 2 years ago

@andrewvanbreda it has pulled on live now.

andrewvanbreda commented 2 years ago

@BirenRathod Thanks Biren for super quick response, can see that is live

andrewvanbreda commented 2 years ago

@DavidRoy Some further fixes. Location code added, country filter added, vanishing points on zoom fixed (as I had to create a new report which fixed this naturally, even if not high priority).

The Country filter does currently assume the square's imported country code attribute matches the Country 2016 code, so if you see it not working for a particular country, we can check that as a first port of call.

Do you know if there is a Countries 2016 WMS layer we could use a layer to display the country boundaries (we do that for NPMS), however I can't see the list of available layers?

Not fixed the reaction of the grid to map yet, I believe this is because it is a locations report and there is something stopping it working as it normally would in that scenario.

DavidRoy commented 2 years ago

@andrewvanbreda Selecting Greece does not return any sites. Is there a mismatch between country names and the spatial layer?

Text under the country layer needs changing.
Currently says 'ID of the parent country to filter to.
should say 'Select country to filter to'

andrewvanbreda commented 2 years ago

@DavidRoy Yes there is a mismatch, Greece is "EL" on the Countries 2016 country, but has been imported as "GR" on the MVS location. I will get Biren to run sql to find all mismatches, then we can decide best way to fix that. Could be that we can place exceptions directly into report if needed, if the codes are actually correct.

I will make text change now, but probably not worth getting Biren to pull the report just for that. So that change will appear next time report pulled for something else.

andrewvanbreda commented 2 years ago

@BirenRathod Could you run this whenever you get a sec please. Cheers.

select l.id,l.name from indicia.locations l JOIN indicia.location_attribute_values lav on lav.location_attribute_id = 305 AND lav.location_id = l.id AND lav.deleted = false LEFT JOIN indicia.locations countries on countries.code = lav.text_value AND countries.location_type_id in (16516) AND countries.deleted = false where l.location_type_id = 19048 AND countries.id = null;

BirenRathod commented 2 years ago

@andrewvanbreda It has returned with no result.

andrewvanbreda commented 2 years ago

@BirenRathod Ok that is fine. I actually didn't test it in detail on my machine as a lot of it was from a real report and didn't want to waste time. I will give it a proper check on my machine, there is probably a mistake

andrewvanbreda commented 2 years ago

@BirenRathod Sorry my bad, the logic of the report was right, but I put in a silly syntax error, I should of put "IS NULL" at the end.

Have double-checked on my machine, please try again. Thanks.

select l.id,l.name from indicia.locations l JOIN indicia.location_attribute_values lav on lav.location_attribute_id = 305 AND lav.location_id = l.id AND lav.deleted = false LEFT JOIN indicia.locations countries on countries.code = lav.text_value AND countries.location_type_id in (16516) AND countries.deleted = false where l.location_type_id = 19048 AND countries.id IS null;

andrewvanbreda commented 2 years ago

AVB not to myself: have made the report wording change and pushed that.

BirenRathod commented 2 years ago

@andrewvanbreda I have attached the result. data-1645200006070_18022022.zip

andrewvanbreda commented 2 years ago

@BirenRathod Brilliant thanks

andrewvanbreda commented 2 years ago

@DavidRoy Think Greece is the only one with mismatch. EL does look like a correct country code.

I think that is the right code on the country, so one solution is if I just edit the code on the Greek squares. Shall I do that?

Alternatively we could change approach to linking a square to country. (I had originally considered making the country a parent of the square, but I thought that could get messy tying down the data structure like that e.g. what would happen if you then wanted to add a region location mid-tier. I also didn't want your general country locations to have a messy set of child locations)

DavidRoy commented 2 years ago

@andrewvanbreda can't we just do this on a spatial basis? The drop-down is purely to zoom the map to a boundary, and then show the locations that intersect with that boundary. The country column in the location attributes are irrelevant for this?

The ICO 2-letter code is GR, so odd that the Country 2016 uses EL. https://www.iban.com/country-codes

andrewvanbreda commented 2 years ago

@DavidRoy I am not a code expert, but the following page does note a code of EL that is an exception for Greece. I guess it depends what type of code you should be using for your work.

https://publications.europa.eu/code/pdf/370000en.htm

I am not sure if we can do this spatially. We need an index as we don't want to be calculating it everytime.

The cache samples table has a list of location_ids in a column. But in our case, the map features themselves are locations, so we have no equivalent cache table. Perhaps am missing something here. Do you know an answer? or I can check with John.

I have check the spatial index builder code and it is just referring to indexing against samples/occurrences.

So this (alongside the issues I mentioned about parent location relationships) simply led me to the conclusion that joining on the code int he report would be best.

Another option is to build a one-off exception into the report for Greece.

andrewvanbreda commented 2 years ago

Noting the reason for not doing a direct intersect in report is purely because wanted to avoid extra load on warehouse, the code join would be quicker (or index if there was one)

DavidRoy commented 2 years ago

Thanks for the explanation. Let's stick with your plan and use the EU code for Greece rather than the ISO one.
So the country code in the location list needs to be 'EL' for those for Greece? Are you able to make this update if you haven't done so

andrewvanbreda commented 2 years ago

@DavidRoy I hadn't, but I have now and can see it working on the map.

Three thoughts

  1. Think this one is out of place http://warehouse1.indicia.org.uk/index.php/location/edit/275156

  2. Should the location code field itself be changed to use EL as well? I didn't change that.

  3. When the Countries termlist is expanded to include Greece, we should use EL as well in the country synonym. http://warehouse1.indicia.org.uk/index.php/termlist/edit/974 (this is the termlist that is use by sample to identify the county the term lists are associated with)

DavidRoy commented 2 years ago
  1. Yes. I’m going to ask partners to review their sites
  2. Yes please
  3. Agreed

thanks

andrewvanbreda commented 2 years ago

@DavidRoy

  1. Done
DavidRoy commented 2 years ago

@andrewvanbreda I removed your developer notes from the test version and changed the page name. So I can ask colleagues to review their sites

andrewvanbreda commented 2 years ago

@BirenRathod Hi Biren, Could you pull this report please, will allow the grid to react to map clicks for David. Thanks reports/projects/PoMS/spring_squares_list_and_mapping.xml

BirenRathod commented 2 years ago

@andrewvanbreda This is has gone live now.

andrewvanbreda commented 2 years ago

@DavidRoy @BirenRathod Thanks Biren. David: Using the ? icon on the map now allows you to click on the map and the grid will react. This will let you click on misplaced items on the map to see what they are. (note the map doesn't highlight locations when grid rows are clicked yet).

andrewvanbreda commented 2 years ago

@BirenRathod Can I be a pain and get you to pull that report again as I fixed the grid click much quicker than I thought. I realised the grid clicking was working, it is simply that the default map feature colour was red, and the grid clicking is also red, and therefore not showing up! Cheers.

BirenRathod commented 2 years ago

@andrewvanbreda Not at all. that's done.

andrewvanbreda commented 2 years ago

@DavidRoy @BirenRathod Thanks Biren. David that is working too. So grid can be clicked and the map is highlighting. David, I think this issue can be closed if you are happy with it?

DavidRoy commented 2 years ago

Thanks. That works well