how to configure for marker
zigma - August 11, 2007 - 07:03
| Project: | GMap Addons |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
How do i configure to enable marker.
I see a field called "Marker noderef" on field configuration page. I am not sure what this field means and what value do i need to provide there. From the name of the field, it seems to be related to marker configuration.

#1
You put there the fieldname of a nodereference field in the same content type (without the field_ prefix). When the map is shown you'll see markers for the locations of the nodes the noderef field is pointing to.
#2
ray,
thank your for your response. you have always been there to help me out on this module. Hope to get this working in my site.
So here is what i understand. Correct me if i am wrong.
1) i define a cck content type "MyType"
2) I create two cck type fields for "MyType" content type
a) I create a nodereference(autocomplete) type dummy cck field "location_marker"
b) I create a gmap type field "test_location_map" using this module. And i specify "location_marker" as Marker noderef
3) Now i create a node of type "MyType" and specify "Latitude & Longitude" in field "test_location_map"
Now when i view the node, it displays correct map location. But it does not display any marker.
I can see the marker when i try go to "Build a GMap Macro" interface.
Did i miss anything. Do i have to do something more so that marker can be displayed.
#3
The noderef field "location_marker" references _other_ nodes that should have location coordinates to show as markers on the map.
There's no support yet for showing the node's own location data in the map.
#4
now i am confused. Do you mean the the location coordinates that i stored in field test_location_map can not be displayed in this node. I believe the map does show correct value on the node page. It just does not display the marker.
And what _other_node do i refer to? What type of node is that? Is there any documentation to explain all these relations.
#5
The coordinates of the field test_location_map are only the center of the map. I had planned to add support for showing a marker there, but didn't yet get around to do it - patches welcome ;-)
A nodereference field can point to _any_ other node, it depends on how you configure the field, see documentation for the nodereference field. To show markers the node(s) you're pointing to must have a location set with the 'location' module, it's those coordinates that are evaluated here.
#6
I am not using location module.
Throw me some guidelines how what is needed to get the marker working. I may give it a try.
I believe there are 3 things-
1) an interface to allow selection of a location similar to what can be selected in Macro builder interface
2) ability to store that macro
3) interface to display that stored location information from the data stored in step#2 (which includes lat, long and marker information)
Now tell me what you tried and where you struggled. I have not done anything on gmap but i may give it a try if i think i can do it.
#7
I didn't struggle, I didn't yet try since i didn't need it (yet).
You need to:
- add a configuration option to the field so the center-marker can be enabled/disabled. I'd recommend to not make it a simple on/off switch, but a select box to choose a marker to use, with '<none>' as default.
- add the marker to the map settings array in the formatter, have a look at the markers for the noderefs to see an example
#8
I believe you are populating settings array in function _gmap_cck_noderef_markers(), which is being called to check for markers.
$settings['markers'][] = array('label' => $n->title,
'opts' => array('title' => $n->title),
'latitude' => $n->locations[0]['latitude'],
'longitude' => $n->locations[0]['longitude'],
'markername' => variable_get('gmap_node_marker_'. $n->type, 'drupal'),
'text' => theme('gmapnodelabel', $n), // TODO:
//'popuplink' => url('map/query/node/'. $n->nid),
);
What if i set all the values of $settings array in gmap_cck_field_formatter() itself, something like this-
$settings['markers'][] = array('label' => "MY TITLE",
'opts' => array('title' => "MY TITLE"),
'latitude' => 41.693761,
'longitude' => -88.10149,
'markername' => 'number',
'text' => " MY TEST LABEL", // TODO:
//'popuplink' => url('map/query/node/'. $n->nid),
);
This is only for testing the code that has to be written.
Even though this is not a configurable solution, I would have expected it to show the marker for this specific hardcoded location. Is that correct? It does not show the marker though.
#9
I set markername to blue. And here is $map array. It should print the marker, it seems. It does not however.
Any input?????
Array
(
[width] => 200px
[height] => 200px
[zoom] => 14
[controltype] => Small
[align] => None
[latlong] => 41.693761,-88.10149
[maptype] => Map
[line_colors] => Array
(
[0] => #00cc00
[1] => #ff0000
[2] => #0000ff
)
[behavior] => Array
(
[locpick] =>
[nodrag] => 0
[nokeyboard] => 0
[nomousezoom] => 0
[autozoom] => 0
[dynmarkers] => 0
[overview] => 0
[notype] => 1
[collapsehack] => 1
)
[markermode] => 1
[field_name] => field_test_location_map
[type] => gmap_cck
[required] => 1
[multiple] => 0
[db_storage] => 1
[alignment] => None
[gpx] =>
[gpx_src] =>
[marker_noderef] => location_marker
[widget] => Array
(
[type] => gmap_cck
[weight] => 0
[label] => test_location_map
[description] =>
)
[type_name] => mytype
[display_settings] => Array
(
)
[markers] => Array
(
[label] => TEST MARKER
[latitude] => 41.693761
[longitude] => -88.10149
[markername] => blue
)
[id] => gmap_18_field_test_location_map
)
#10
Are you sure you used the code from comment #8 to produce the result seen in #9?
Looking at $map['markers'] you should see something like
[markers] => Array(
[0] => Array
(
[label] => TEST MARKER
[latitude] => 41.693761
[longitude] => -88.10149
[markername] => blue
)
)
Note the additional array in map['markers'].
To the original code:
if you don't use the location module, there is no $node->locations. You need split the coordinate-string $map['latlong'] to get those.
and be sure to get the marker name right, 'blue' sounds good but the only one I'm sure about without checking is 'drupal' ;-)
#11
oops.
i sent you the old array. I had messed up initially.
Here is what i have. This does not show up the marker as well.
Array
(
[width] => 200px
[height] => 200px
[zoom] => 14
[controltype] => Small
[align] => None
[latlong] => 41.693761,-88.10149
[maptype] => Map
[line_colors] => Array
(
[0] => #00cc00
[1] => #ff0000
[2] => #0000ff
)
[behavior] => Array
(
[locpick] =>
[nodrag] => 0
[nokeyboard] => 0
[nomousezoom] => 1
[autozoom] => 0
[dynmarkers] => 1
[overview] => 0
[notype] => 1
[collapsehack] => 1
)
[markermode] => 1
[field_name] => field_test_location_map
[type] => gmap_cck
[required] => 1
[multiple] => 0
[db_storage] => 1
[alignment] => None
[gpx] =>
[gpx_src] =>
[marker_noderef] =>
[widget] => Array
(
[type] => gmap_cck
[weight] => 0
[label] => test_location_map
[description] =>
)
[type_name] => mytype
[display_settings] => Array
(
)
[markers] => Array
(
[0] => Array
(
[label] => TEST MARKER
[latitude] => 41.693761
[longitude] => -88.10149
[markername] => blue
[opts] => Array
(
[title] => TEST TITLE
)
)
)
[id] => gmap_18_field_test_location_map
)
One query. Does icon.js need to be included for the marker to show up. I would assume that it all such js should be included on its own, if they are needed. Expecially if it works with noderef then i am surprised why it does not show up in this case.
#12
Here is what seems to be the problem.
I can see one javascript error on Firebug.
Drupal.gmap has no propertieshttp://~~/modules/gmap/js/icon.js
Line 14
Drupal.gmap.getIcon = function(setname, sequence) {
Any idea what's going on here???
#13
the cck gmap type file test_location_map stores values such as zoom and other related stuff related to gmap along with latlong.
Is there an API to extract latitude and longitude value stored in that field?
#14
ok. i can see the marker with hardcoded latlong.
It was throwing some cryptic error in IE6. It shows up in FireFox. Have you experienced such behavior in IE6?
#15
ad #13: there's no api to get the data from the field, you could suggest something like that to the gmap module. but then it's only a simple call to split() and not really worth to wrap ...
ad #14: testing here with firefox and opera mostly, no idea what went wrong here. my testing with IE didn't show any problems so far either
#16
I have the Location module. How do I use this field "marker noderef"?
For example, I have a content type "meeting" which is a modified event: I added a "Google map view" type field.
My intention is to have a small map in each meeting node, with a marker on the meeting location.
Beer++ would be if I could choose from a predefined list (or map) of locations, with option to add a new location.
#17
I would really like the ability to have a marker for the location of the center of the map shown. In my case I am building sort of a dealer locator. You click on a link to a location details page and I want a small map with just that location highlighted. It would also be great to turn on directions which could just link to the standard Google directions page.
I am not a programmer otherwise i would offer to contribute code but I certainly would be willing to contribute to a bounty to get this done.
#18
I'd second that. Any chance we could get a marker for the googlemap view, I'd also be willing to help fund the development
Alternatively, could we get some idea of how to implement a marker using the 'Marker noderef' - I use locations, but have no idea what I should put in the 'marker noderef' box
Thanks
#19
I am new to gmap, and am following the steps above regarding creating cck fields, but when I create them, i do not see any gmap field types.
What I want to do is to have a map (one location only) that shows where our offices are. I have installed and enabled the locations module and the gmap module, and configured them both. I also created a gmap macro, and by inserting the html code that i found on the google API site, I can see the map, and it is zoomed into where I want it, but I cannot see the map marker that I set up.
Any ideas would be welcomed. I appreciate it.
#20
http://drupal.org/node/162180