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

change OpenMapSurfer_Roads basemap to terrain #537

Merged
merged 3 commits into from
Mar 27, 2019

Conversation

boney-bun
Copy link
Contributor

fix ##531

@boney-bun boney-bun requested a review from lucernae March 26, 2019 07:33
@ghost ghost assigned boney-bun Mar 26, 2019
@ghost ghost added in progress labels Mar 26, 2019
@NyakudyaA
Copy link
Collaborator

@boney-bun does this remove the base maps even at Layer detail page, Because this also affects the thumbnail generation where the basemap is empty

@codecov
Copy link

codecov bot commented Mar 26, 2019

Codecov Report

Merging #537 into 2.8.x will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##            2.8.x     #537   +/-   ##
=======================================
  Coverage   57.75%   57.75%           
=======================================
  Files          49       49           
  Lines        2720     2720           
  Branches      301      301           
=======================================
  Hits         1571     1571           
  Misses       1068     1068           
  Partials       81       81

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08db72a...0a89ffe. Read the comment docs.

Copy link
Collaborator

@lucernae lucernae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we don't use OSM as default basemap?
I'm not sure why you add Terrain in this page?
Could you use the same logic from Layer details to include set of basemaps taken from the settings file?

@NyakudyaA
Copy link
Collaborator

Why we don't use OSM as default basemap?
I'm not sure why you add Terrain in this page?
Could you use the same logic from Layer details to include set of basemaps taken from the settings file?

Yes @lucernae we just need to have a basemap that we know always works. OSM basemap would be nice to have it as the default and the terrain can still be added as a second option for people who do want to change

@lucernae
Copy link
Collaborator

Yes @lucernae we just need to have a basemap that we know always works. OSM basemap would be nice to have it as the default and the terrain can still be added as a second option for people who do want to change

Yeah, argh sorry for not being clear :D. If I read my comment above again, it seems I'm complaining about the Terrain map. What I mean is, we should add the Terrain in the settings, not in the page. Then take the default basemap from whatever the first basemap in the list from the settings.

In last year's sprint, we already fixed this problem by offloading the basemap to settings, so we made this:

https://github.com/kartoza/geonode/blob/2.8.x-qgis_server/geonode/client/templates/leaflet/layers/layer_leaflet_map.html#L142 (in kartoza/geonode repo)

The layer detail page takes extra basemaps from the settings module.

I suggest that:

  1. We take the same approach for analysis related page (because it isn't handled by geonode) in this geosafe repo.
  2. Customize the basemaps to everywhere from settings module.
  3. Add new settings field to choose default basemaps from a given basemaps defined in settings
  4. Refactor layer and map page of GeoNode to choose default basemaps from settings.

The settings that I was talking about:

https://github.com/kartoza/geonode/blob/2.8.x-qgis_server/geonode/settings.py#L1015

It would be nice if we can handle all these

@boney-bun
Copy link
Contributor Author

yes, the default is osm. terrain is just an additional basemap to replace the removed one.
i have another PR in custom repo.
i thought we will just use the custom one.
i guess i will close the PR in the custom repo and move it to geonode repo.
i also will revise this PR.

@boney-bun
Copy link
Contributor Author

the PR in action:
geosafe#531-geosafe

the basemaps are taken from settings.
the default basemap is always osm.

@lucernae @NyakudyaA could you review again?

Copy link
Collaborator

@NyakudyaA NyakudyaA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice @boney-bun , Does it also cover the layer details page where the default will be OSM

Copy link
Collaborator

@lucernae lucernae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @boney-bun , thank you :).

Could you check my suggestion too in your local environment first.

The aim is to have the default basemap automatically taken from the first TILES config if defined, if not, use default osm.

attribution: '{{ tile.2|safe }}'
});
{% endfor %}
{% endif %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% endif %}
default_basemap = base_maps["{{ LEAFLET_CONFIG.TILES.0 }}"];
{% endif %}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes it into:
default_basemap = base_maps["{{ LEAFLET_CONFIG.TILES.0.0 }}"];

zIndex: 0,
noWrap: true,
attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> &mdash; Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
var default_basemap = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {

map = L.map('map', {
layers: [OpenMapSurfer_Roads],
layers: [osm],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
layers: [osm],
layers: [default_basemap],

attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> &mdash; Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
map.addLayer(OpenMapSurfer_Roads);
map.addLayer(osm);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
map.addLayer(osm);
map.addLayer(default_basemap);

@boney-bun
Copy link
Contributor Author

thanks for the feedback @lucernae @NyakudyaA
i've revised and tested it locally.
i'm going to merge this PR.

@boney-bun boney-bun merged commit 9291061 into kartoza:2.8.x Mar 27, 2019
@ghost ghost removed the in progress label Mar 27, 2019
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

Successfully merging this pull request may close these issues.

3 participants