Posted by ChocolateTeapot on April 4, 2010 at 5:03pm
I've created an OpenLayers preset which I use to create a linestring. When I'm creating content, the map shows the whole of the UK and you zoom into your location to create a trail, which is what I want. When viewing the content I'd like the map to be zoomed into the trail (linestring), like the Mapstraction CCK field seems to do by default, rather than showing me a tiny (unnoticeable) dot where the trail is.
Is it possible to center the map on the data?
Any help appreciated, thanks.
Comments
using OpenLayers module?
You are not mentioning whether your issue relates to the OpenLayers module. If that is the case, then the new/edit preset page has a section called "Center" that (in theory) should allow you to do what you are after - quoting the help text for the section:
"Where the map will center itself initially. You may use the small map to help you set your center and zoom. Pan and zoom where you want the centering defaults to be."
I am not using that module myself.
.
Yes, you are correct, and that's what I'm using to create the trail - a map that shows the whole of the UK.
I'm using the same OpenLayers preset (that I created myself) to create and display the trail.
I suppose I could create a different preset to display the trail, but I'd still have to input the center co-ordinates, whereas I want the map to center on the trail, which could be anywhere in the UK and different on each node.
Thanks for your help.
Hey, this would be more
Hey, this would be more appropriate to put in a support request on the OpenLayers issue queue.
It depends on what version you are using. Currently the 1.x version CCK has an option to zoom to layer. Note that if it is one feature, you need to set a zoom level as well.
--
zzolo
And this is quite doable if
And this is quite doable if you present the data via a view. Currently 2.x does not allow extra behaviors on CCK Displays (because CCK displays are... a suboptimal way to display content in Drupal), but will support this nicely with OpenLayers Views and the WKT data type.
Thanks. @zzolo I installed
Thanks.
@zzolo
I installed the latest version of OpenLayers, but my OpenLayers widgets disappeared, so I've posted a support request on the OpenLayers issue queue, as suggested.
@tmcw
I wondered about a view, the trouble is that my Drupal knowledge is quite limited (I'm trying to improve!) and I don't really get Views. I get how to create a view that shows a collection of records on a given page, but in this instance I want my View to target the node page (and possibly the create content page). I posted a question here http://drupal.org/node/761632 but I think that my knowledge is too limited to explain myself properly and it all got a bit confusing. I couldn't workout the path to use in my view that would target example.com/content_type/node_title (I'm using Pathauto), for example,
example.com/walks/thames_path
example.com/walks/cotswolds_way
I got the impression from the replies to my post that Views aren't really for representing individual records, but for displaying collections of records.
Just to clarify what I'm trying to achieve at the moment:
1) Authenticated users can create a trail on a map which is centered on the UK (which I managed with the older version of OpenLayers)
2) All visitors can view the maps, which would be zoomed into the trail (which I understand I can do with the latest version of OpenLayers when I get it working)
I really like the fact that the user can choose the type of map that they use to view the trail.
Thanks again for everyones help.