-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Zoom to bookmark extent #316
Conversation
plugins/Bookmark.jsx
Outdated
resolveBookmark(bookmarkkey, (params) => { | ||
const scale = parseFloat(params.s); | ||
const zoom = MapUtils.computeZoom(this.props.mapScales, scale); | ||
const center = params.c.split(/[;,]/g).map(x => parseFloat(x)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on urlPositionFormat
in config.json
, the url parameters may contain c
and s
, or e
for extent. You might also want to handle the e
case here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is resolved with my new commit
9a8e558
to
84375bb
Compare
6963a1e
to
1f4003e
Compare
plugins/Bookmark.jsx
Outdated
this.props.zoomToPoint(center, zoom, this.props.mapCrs); | ||
} else if ('e' in params) { | ||
const bounds = (params.e).split(',').map(n => parseFloat(n)); | ||
this.props.zoomToExtent(bounds, this.props.mapCrs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I forgot earlier, there is also the urlPositionCrs
config option, which will add a crs
URL parameter if urlPositionCrs
is different than mapCrs
. Something like params.crs ?? this.props.mapCrs
should do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was not aware of these options
Thanks! |
Hi,
This PR allows user to only zoom to a bookmark extent without changing theme or load/open the bookmark in the current window or new tab.
Thanks for the review
This feature has been funded by Grand Lyon Métropole https://www.grandlyon.com/