[Geomoose-users] How to set max Zoom?

Brent Fraser bfraser at geoanalytic.com
Thu Aug 6 12:41:00 PDT 2020


So in map.js I added:

if(this.props.config.maxZoom) {
view_params.maxZoom = this.props.config.maxZoom;
}

// initialize the map.
this.map = new olMap({
target: this.mapDiv,
layers: [this.selectionLayer],
logo: false,
view: new olView(view_params),
controls: getControls(this.props.config),
});

And using 

var app = new gm3.Application({
mapserver_url: CONFIG.mapserver_url,
mapfile_root: CONFIG.mapfile_root,

map: {
maxZoom: 19,
scaleLine: {
enabled: true,
units: 'imperial'
}
}

});

I was able to get the desired behaviour, but it seems like such a hack...

Brent

----------------------------------------

From: "Brent Fraser" <bfraser at geoanalytic.com>
Sent: 8/6/20 12:39 PM
To: "TC Haddad" <tchaddad at gmail.com>
Cc: GeoMoose Users <geomoose-users at lists.osgeo.org>
Subject: Re: [Geomoose-users] How to set max Zoom?

Well I had tried 

app.setView({
center: [ -8950659, 4738816 ],
zoom: 8,
maxZoom: 20
});

as well, but no effect.  So I expect GM maybe laundering the options somewhere.

Thanks!

----------------------------------------

From: TC Haddad <tchaddad at gmail.com>
Sent: 8/6/20 12:10 PM
To: Brent Fraser <bfraser at geoanalytic.com>
Subject: Re: [Geomoose-users] How to set max Zoom?

I'm sure you've already been here, just just incase:

there is minZoom and maxZoom on the layer level, but sounds like you want it on the view level?

https://openlayers.org/en/latest/apidoc/module-ol_View-View.html

https://openlayers.org/en/latest/examples/zoom-constrained.html

view: new View({
center: [-13553864, 5918250],
zoom: 11,
minZoom: 9,
maxZoom: 13,
}),

On Thu, Aug 6, 2020 at 10:32 AM Brent Fraser <bfraser at geoanalytic.com> wrote:

Hi All,

I'd like to set the maximum zoom level of my map.  Any thoughts on how to do that?

I've tried:

var app = new gm3.Application({
mapserver_url: CONFIG.mapserver_url,
mapfile_root: CONFIG.mapfile_root,

map: {
maxZoom: 20,
scaleLine: {
enabled: true,
units: 'imperial'
}
}

});

but no go.

Thanks!
Brent_______________________________________________
Geomoose-users mailing list
Geomoose-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geomoose-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20200806/ba5de6a3/attachment.html>


More information about the Geomoose-users mailing list