Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping: Country boundaries failing to display #2944

Closed
Norric1Admin opened this issue Feb 25, 2019 · 19 comments
Closed

Mapping: Country boundaries failing to display #2944

Norric1Admin opened this issue Feb 25, 2019 · 19 comments
Assignees

Comments

@Norric1Admin
Copy link
Contributor

@brockfanning

I've updated the sdg-indicators data-deploy branch config.yml file to add additional mapping boundaries. However, I can't get the new Country-level boundaries to display: http://sdg.mango-solutions.com/data-deploy/3-2-1/. In addition, the map seems to have reset to the 0,0 long/lat position. Please can you advise?

You'll notice that I commented out the County boundaries for now, as they add extra complexity. All of the boundaries are from the ArcGIS Hub, 'name/id Property' fields are consistent with the geojson, and the GeoCodes match with the CSV as far as I can see. Zoom levels are consistent with nested zooming.

Thanks Brock!

@Norric1Admin
Copy link
Contributor Author

#2791

@brockfanning
Copy link
Collaborator

@Norric1Admin I'm not sure if this will fix all the problems, but I see there is a javascript error happening, which may be aborting the map code before it finishes. The problem is, on this line the...

"Change data view".

should be a...

"Change data view",

You might start there and see if there is any improvement.

@Norric1Admin
Copy link
Contributor Author

Norric1Admin commented Feb 26, 2019 via email

@Norric1Admin
Copy link
Contributor Author

you are a rare kind of genius 🥇 🍾
http://sdg.mango-solutions.com/data-deploy/3-2-1/

@brockfanning
Copy link
Collaborator

Thanks, glad that helped! :)

@Norric1Admin
Copy link
Contributor Author

Norric1Admin commented Feb 26, 2019

@brockfanning
Second error before I close this is that Country boundaries are not displaying by default. LA boundaries are shown first even at a far zoom, and users must zoom in then back out to view Country. It looks like the Country boundaries are not being rendered until this first zoom occurs.
http://sdg.mango-solutions.com/data-deploy/3-2-1/

I've simplified the CSV so it's just headline data and Country. Same problem, and often there is a mixture of boundaries (e.g. only England and Northern Ireland display). Is it to do with the boundary order (currently set as Country, Region, LA)? The open-sdg jquery.sdgMap.js might hold the key.

P.S. The JavaScript solution seemed to work before - how do I search for JavaScript errors?

Edit: Fixed this by disabling zoom on click - the high-level boundaries now display by default! Plus, the map is now easier to use. @brockfanning should this be added to open-sdg?

@brockfanning
Copy link
Collaborator

I usually use the Console in Chrome to sniff out any javascript errors. If you go to any page that seems broken, and open the Console, you can usually see any javascript errors that might be happening. Often times you also click on them and get taken directly to the line of javascript with the problem (which is how I knew about the problem above).

About the mapping layers problem - I don't have time just this moment to play around with it, but I'm curious if it would help to make sure that there is no "overlap" in the min_zoom and max_zoom settings. For example I see that the country layer is 4-20, and the region layer is 6-6, and the LA layer is 8-20. Maybe try this approach?
country: 4-5
region: 6-7
LA: 8-20

@Norric1Admin
Copy link
Contributor Author

@brockfanning Thanks - I'll use the Console to see if I can get to the bottom of this. Unfortunately I already tried non-overlapping boundaries, and the overlaps are an attempt at testing the layers out. Is there any guidance you can point me to which deals with adding new boundaries please (I've read ReadTheDocs).

@brockfanning
Copy link
Collaborator

@Norric1Admin From what you're describing it seems like this is probably a bug in Open SDG. Maybe I never tested out more than two layers. I dig into it some more.

@brockfanning
Copy link
Collaborator

@Norric1Admin I've got some ideas, but it will need an update to Open SDG. I've started a thread there: open-sdg/open-sdg#103

@brockfanning
Copy link
Collaborator

brockfanning commented Feb 27, 2019

@Norric1Admin I've submitted a PR for review on the Open SDG repo, which should help things. In addition here are some recommendations for configuring the layers:

  • It's probably a good idea to set a maxZoom (just under the minZoom) of 10. That's actually the default, so this is not required, but it will make things more clear.
  • Usually with the layers you will not want any overlap between the min_zoom and max_zoom. For example if the max_zoom of a layer is 6, the min_zoom of the next layer should be 7.
  • The last layer should not have staticBorders
  • The last layer should have a max_zoom that matches the map's overall maxZoom (mentioned above). So if the map has a maxZoom of 10, the last layer should have a max_zoom of 10 also.

These tips should help, but only after this PR has been merged and then included in a new release of Open SDG.

@Norric1Admin
Copy link
Contributor Author

Ta - I have approved it. My only hesitation is that the UK map will require overlaps (e.g. Country + Region). For example, while England is showing the Regions, we want Scotland to continue showing Country (map).

@brockfanning
Copy link
Collaborator

Ah gotcha. Well it's worth a try. I'm just not sure if the order of the layers will cooperate. Hopefully it will just work. :) If you want to test it now, you could temporarily "un-pin" the version of Open SDG you're using. That will pull in the latest code. Or you could hold off until we properly release 0.4.0, though that may be days/weeks away.

@Norric1Admin
Copy link
Contributor Author

I'll try that ;) Is this correct? remote_theme: open-sdg/open-sdg

@brockfanning
Copy link
Collaborator

Yep that's right.

@brockfanning
Copy link
Collaborator

@Norric1Admin Actually you'll need one other addition to the _config.yml, because of a change in Open SDG. Add this:

goal_image_base: https://open-sdg.github.io/sdg-translations/assets/img/goals

This is necessary because we've removed the goal images from Open SDG and put them in SDG Translations.

@Norric1Admin
Copy link
Contributor Author

Thanks for all your help today! This commit c6a602c shows that 3-layer maps are possible. Cannot unpin open-sdg yet, but I'll have another look tomorrow at this error. I suspect it is because feature/develop and master don't align.

@brockfanning
Copy link
Collaborator

@Norric1Admin See my comment just above - if you look at the details on those test failures, you'll notice they are all about missing goal images. This is because in the latest open-sdg code the goal images have been removed. There's a new _config.yml setting (goal_image_base) that needs to be there - see above.

@Norric1Admin
Copy link
Contributor Author

I have decided to hold off on the unpinning for now, and incorporate this in the @0.4.0 release. We have selected maps 3.9.1 and 3.a.1, sans Country boundaries (for now). This has been a good test in adding new boundaries to the map - the method will be useful in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants