I have two map views and I want both of them to zoom to (and center over) the markers in them; however, as Views doesn't seem to provide an option for setting the layer to zoom to, I have to do it from the OpenLayers Preset settings, but that only lets me choose one layer to zoom to...

How to I make all maps zoom to their respective markers? Surely I don't have to create two separate map presets just for this functionality...?

Files: 
CommentFileSizeAuthor
#22 openlayers-zoom_multiple_layers-928244-22.patch4.21 KBjeffschuler
PASSED: [[SimpleTest]]: [MySQL] 238 pass(es).
[ View ]
#20 openlayers-zoom_multiple_layers-928244-20.patch4.17 KBjeffschuler
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openlayers-zoom_multiple_layers-928244-20.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#18 openlayers-zoom_multiple_layers-928244-18.patch4.5 KBjeffschuler
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openlayers-zoom_multiple_layers-928244-18.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#16 openlayers-zoom_multiple_layers-928244-16.patch4.17 KBjeffschuler
PASSED: [[SimpleTest]]: [MySQL] 238 pass(es).
[ View ]
#10 openlayers-zoom_multiple_layers-928244-10.patch4.07 KBjeffschuler
FAILED: [[SimpleTest]]: [MySQL] 238 pass(es), 0 fail(s), and 4 exception(s).
[ View ]

Comments

Status:Active» Closed (works as designed)

Yes, you currently need to create different presets for different 'zoom-to' options.
Especially because there's no such thing as a "its respective marker". All markers (layer?) are of the same importance within a map/preset.

Status:Closed (works as designed)» Active

I suppose I was expecting similar functionality to the preset's 'Pop Up' option... That let's you select (via checkboxes) different layers to have popups.

Why can't 'zoom to' do the same? I'm probably not understanding this properly, but if you say that there's no such thing as 'respective markers', how can popups be assigned to more than one layer?

I must have misunderstood. If you want a _single_ map (a preset) to start by zooming to an extent enclosing
multiple vector layers than YES this is a valid feature request (not possible at the moment).

See if you can come out with a patch for the zoom_to_layer behavior, looking at the popup one or cluster one
for examples.

Title:How to make all maps zoom to layer?Allow zoom-to-layer to apply to multiple layers
Version:6.x-2.0-alpha10» 6.x-2.x-dev
Component:OpenLayers Views» Behaviors
Category:support» feature

Cool, glad we got that sorted :)
Re-naming issue.

subscribe

subscribe

Component:Behaviors» OL API

subscribe

subscribe

Version:6.x-2.x-dev» 7.x-2.x-dev
Status:Active» Needs review
StatusFileSize
new4.07 KB
FAILED: [[SimpleTest]]: [MySQL] 238 pass(es), 0 fail(s), and 4 exception(s).
[ View ]

Here we go.

This adds the ability to choose multiple layers to which to zoom, and follows the route in the the doc mentioned in #9 (thanks @elyobo!) to extend bounds with each chosen layer. I'm storing "fullExtent" inside the map object so that layers with delayed processing (KML / GeoJSON) can get at it. There might be unhandled race conditions, but this is working for me.

Reviews appreciated!

Status:Needs review» Needs work

The last submitted patch, openlayers-zoom_multiple_layers-928244-10.patch, failed testing.

Title:Allow zoom-to-layer to apply to multiple layersWork around for the time being?

This might be a workaround for as long there is no patch:

I also ran into this. I needed 3 layers to show different marker colors, with an exposed filter that made things zoom. Basically what i did was:

create the 3 layers and ad them to the map
create a 4th layer with all results from the 3 layers combined
I than enabled all 4 layers and only activated the first 3 layers (so the 4th layer markers don't show).
In settings I set the "zoom to" to the 4th layer with all results.
and that's it, I got the behavior I needed.

Hope this helps a bit

proxy triple posts

proxy triple posts

Title:Work around for the time being?Allow zoom-to-layer to apply to multiple layers

Status:Needs work» Needs review
StatusFileSize
new4.17 KB
PASSED: [[SimpleTest]]: [MySQL] 238 pass(es).
[ View ]

Fixed:

-        '#default_value' => isset($defaults['zoomtolayer']) ? $defaults['zoomtolayer'] : NULL
+        '#default_value' => isset($defaults['zoomtolayer']) ? $defaults['zoomtolayer'] : array(),

Go, testbot, go!

Is this patch merged into the latest main dev release? Or should we manually apply it?

StatusFileSize
new4.5 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openlayers-zoom_multiple_layers-928244-18.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

@cesareaugusto: It's not in dev yet -- the patch needs to be reviewed by the community first. So, you'll need to apply the patch to 7.x-2.x-dev.

Here's a re-roll of it to apply cleanly.

Thanks for testing! Please report back here whether it worked for you...

Status:Needs review» Needs work

The last submitted patch, openlayers-zoom_multiple_layers-928244-18.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.17 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openlayers-zoom_multiple_layers-928244-20.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Sorry about that. Patching from right place...

Status:Needs review» Needs work

The last submitted patch, openlayers-zoom_multiple_layers-928244-20.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.21 KB
PASSED: [[SimpleTest]]: [MySQL] 238 pass(es).
[ View ]

Tested & committed, thanks again Jeff' !

http://drupalcode.org/project/openlayers.git/commit/024d582

Status:Needs review» Fixed

Wow, that's timing - just needed this feature today and then found this - marked as fixed - yesterday!

I think there is a bug, but could be mistaken, when there is a non-kml and non-geojson, single-point, single-layer. Filed a new issue at #1708514: Bug in "Allow zoom-to-layer to apply to multiple layers" patch with a one-line patch since this one was already committed. Wanted to post here though since everyone on this thread will care about the bug.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Priority:Normal» Major
Status:Closed (fixed)» Needs work

I tested during a few hours why this is still broken, I didn't not succeeded to find, I'm looking for help on this.

Try the 'Example GeoJSON' map, you'll see that the map doesn't center on the feature added by geojson.

Status:Needs work» Fixed

Problem solved.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.