Comments (10)
That would be very nice.
btw Is it possible to define the deafult base layer in an easy way in the .js-file?
from lizmap-plugin.
Here is what I changed in lizmap/www/js/map.js :
Basemap names are : Google Streets, osm, ignphoto for example.
ORIGINAL :
// get the baselayer select content
// and adding baselayers to the map
//var select = '<select class="baselayers">';
var select = [];
baselayers.reverse();
for (var i=0,len=baselayers.length; i<len; i++) {
var baselayer = baselayers[i]
baselayer.units = projection.proj.units;
map.addLayer(baselayer);
var blConfig = config.layers[baselayer.name];
if (blConfig)
select += '<option value="'+blConfig.name+'">'+blConfig.title+'</option>';
else
select += '<option value="'+baselayer.name+'">'+baselayer.name+'</option>';
/*
if (blConfig)
select.push('<input type="radio" name="baselayers" value="'+blConfig.name+'"><span class="baselayer-radio-label">'+blConfig.title+'</span></input>');
else
select.push('<input type="radio" name="baselayers" value="'+baselayer.name+'"><span class="baselayer-radio-label">'+baselayer.name+'</span></input>');
*/
}
MODIFIED :
// get the baselayer select content
// and adding baselayers to the map
//var select = '<select class="baselayers">';
var select = [];
baselayers.reverse();
for (var i=0,len=baselayers.length; i<len; i++) {
var baselayer = baselayers[i]
baselayer.units = projection.proj.units;
map.addLayer(baselayer);
var selected = '';
if(capabilities.service.title=='YOUR PROJECT TITLE' && baselayer.name=='YOUR BASEMAP NAME'){
selected = 'selected';
map.setBaseLayer(map.getLayersByName(baselayer.name)[0]);
}
var blConfig = config.layers[baselayer.name];
if (blConfig)
select += '<option value="'+blConfig.name+'" '+selected+'>'+blConfig.title+'</option>';
else
select += '<option value="'+baselayer.name+'" '+selected+'>'+baselayer.name+'</option>';
/*
if (blConfig)
select.push('<input type="radio" name="baselayers" value="'+blConfig.name+'"><span class="baselayer-radio-label">'+blConfig.title+'</span></input>');
else
select.push('<input type="radio" name="baselayers" value="'+baselayer.name+'"><span class="baselayer-radio-label">'+baselayer.name+'</span></input>');
*/
}
Of course it is better to use an external script or you'll have to report this hack when you'll update lizmap web cient.
from lizmap-plugin.
THX!!
from lizmap-plugin.
Though with that script I noticed that if you use a permalink with a different base layer than default you'll get the default base layer selected in combobox. I might take some time to fix this.
from lizmap-plugin.
Thanks!
it would be best to select through the plugin...
from lizmap-plugin.
Of course it would be best but it has to be developed.
@rldhont : what would cost the development of this feature? Maybe we can fund it with all interested people?
from lizmap-plugin.
yes it's true and of course you're right. so, It's a suggestion for the future!
from lizmap-plugin.
Fix in commit 15982a8 [FEATURE] Baselayers - Choose active baselayer at map startup
from lizmap-plugin.
Thanks. Any plans to backport it to 2.x?
from lizmap-plugin.
Done commit c875b1d2cf063a56769ab6e88878b8fa19cb14e8
from lizmap-plugin.
Related Issues (20)
- Add new blocker rule when the layer or group has a trailing space HOT 4
- lizmap qgis plugin version =>4 error at czech locale[Bug]: HOT 3
- [Bug]: `Display plot only when the layer is visible` should on be checkable for layers w/ geometry HOT 2
- [Bug]: Check state of tables when we remove a layer which has used before
- [Bug]: dataviz bootstrap/html layout
- The title of a filter form should be mandatory
- [Bug]: Print tool shows even if option is not enabled in LM Plugin HOT 8
- [Bug]: Saved extent is not valid in CFG HOT 11
- Python error on new project with old files HOT 35
- Remove `Zoom history` checkbox for Lizmap >= 3.8
- Add `image/webp` to the list of image formats HOT 1
- [Bug]: Layers, Open the file browser (button) crashes the plugin
- Get min/max resolutions for WMTS layers
- Correct entry of the Google API key HOT 1
- [Bug]: OSM layer comes with zoom min/max defined HOT 3
- [Question]: Qgis Desktop plugin > 4.2.7 don't work with Qgis 3.18.3 HOT 1
- [Bug]: Error python with 4.3.17 HOT 4
- [Bug]: AttributeError: 'NoneType' object has no attribute 'type'
- Update popup template to handle Bootstrap 5
- [Bug]: QgsProjectServerValidator is not defined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lizmap-plugin.