I'm trying to use Google Maps datatype but without luck. I have found bits here and there but not sure that I have set up everything correct - I see Lee Keller's guide mentined but I can't find it -
This is what I do
<div style="border: 0 none;"> <div id="localMap" class="map"> <umbraco:Item field="googleMap" runat="server"></umbraco:Item> </div> <div style="vertical-align: middle; height: 22px"></div> </div> </asp:Content> <asp:Content ContentPlaceHolderId="scripts" runat="server"> <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript" ></script> <script type="text/javascript"> $('div[class=map]').each(function() { $(this).addClass('mapdimensions'); var mapId = $(this).attr('id'); var value = $(this).text(); value = $.trim(value); var point = value.split(','); var lat = parseFloat(point[0]); var lon = parseFloat(point[1]); var zoom = parseFloat(point[2]); var p = new google.maps.LatLng(lat, lon); var myOptions = { center: p, zoom: zoom, mapTypeId: google.maps.MapTypeId.ROADMAP }; fm = new google.maps.Map(document.getElementById(mapId), myOptions); var marker = new google.maps.Marker({ position: p, title:"We are here!", animation: google.maps.Animation.BOUNCE }); // To add the marker to the map, call setMap(); marker.setMap(fm); }); </script> </asp:Content>
I think my problems is that the field Location does not contain a value although the Datatype is created with a default value and the map is shown correctly in Content
I have tried that also without luck. One difference I notice between my site and the Razor sample site is that the grey box next to the Clear button contains the coordinates in the Razor sample but the same box is empty at my site
I have exactly the same as in the MapEmptyTest in the Razor Example. No marker and I can't saved one either. So perhaps if I knew what the purpose was of MapEmptyTest.
The version of the GoogleMaps I installed was 0.0.0.0 and in Raxor sample it is 2.0.0.0 - I tried to copy that into my site but it didn't change anything.
Apologies for late reply have been out all day and tried to login via my phone but it wouldn't let me in.
Checked the mapEmptyTest and have no idea of it's purpose.
My Google Map package is the latest version, 2.0.4, from here:
and as I do that there is a 2.0.6 so would suggest you remove your current package and install the latest.
If your code then still does not work, will post my current code as I know that this will.
One other thing is this save and publish issue, save and publish twice just to make sure, this has been fixed in the nightly's but may still be causing issues elsewhere.
Again apologies, but we will have something working for you shortly.
Ok, so you have the marker which is centered at the default value given in the datatype?
You can move it, then when you release it you can right click and hit "use this location" from the pop-up? But this is not updating the field with the selected location?
Can you also use the search to find a location by name? (just checking to see if it is connected).
I don't have a marker although I have set the default location for the datatype. If I do a search the marker is displayed, but when I publish it disappears
It seems odd that with a default you have no marker, but if you search and get your marker, then use "use this location" from teh pop-up, does the fiels become populated wiith the co-ordinates?
Google maps datatype
Hi
I'm trying to use Google Maps datatype but without luck. I have found bits here and there but not sure that I have set up everything correct - I see Lee Keller's guide mentined but I can't find it -
This is what I do
/Paul S
Hi Paul
What does the content of your googleMap macro look like?
/Jan
Hi
I don't have a macro - just the a property in my Document of type Google Maps. Am I missing something here?
The field is inserted here
/Paul S
Hi Paul
Without checking your script will just ask if you have set a height for the map div in css.
Have been caught out with this a couple of times. It will show nothing without the height specified.
If this doesn't work, I use Sebaastians script.js (modified a bit) from his razor examples site. That does work in 6.0.2.
Regards
Gary
@Paul Aaah, sorry missed that part in the code above. As Gary says you probably just need to set some dimensions for your map container.
Cheers,
Jan
Hi
I'm working on it and have set the dimensions, but I'm not there yet. I'm not sure I have checked everything yet.
/Paul S
Hi
I think my problems is that the field Location does not contain a value although the Datatype is created with a default value and the map is shown correctly in Content
/Paul S
Hi Paul
There is another "gotcha" on the maps which catches people.
When you place the marker, you must right click and then click use this location, this wil then be used as the map centre.
Just check this before doing too much with the code.
G
Hi Gary
I have tried that also without luck. One difference I notice between my site and the Razor sample site is that the grey box next to the Clear button contains the coordinates in the Razor sample but the same box is empty at my site
/Paul S
Hi
I have exactly the same as in the MapEmptyTest in the Razor Example. No marker and I can't saved one either. So perhaps if I knew what the purpose was of MapEmptyTest.
The version of the GoogleMaps I installed was 0.0.0.0 and in Raxor sample it is 2.0.0.0 - I tried to copy that into my site but it didn't change anything.
/Paul S
Hi Paul
Apologies for late reply have been out all day and tried to login via my phone but it wouldn't let me in.
Checked the mapEmptyTest and have no idea of it's purpose.
My Google Map package is the latest version, 2.0.4, from here:
and as I do that there is a 2.0.6 so would suggest you remove your current package and install the latest.
If your code then still does not work, will post my current code as I know that this will.
One other thing is this save and publish issue, save and publish twice just to make sure, this has been fixed in the nightly's but may still be causing issues elsewhere.
Again apologies, but we will have something working for you shortly.
Regards G
Sorry forgot the link
http://localhost:61150/datatypesexamples/mapemptytest/
G
Hi
I'm using 2.0.6, but I have tried to uninstall it and install it again. Makes no difference - I still don't see the coordinates in the backend
/Paul S
Hi
Just realised I posted the wrong link too!
Ok, so you have the marker which is centered at the default value given in the datatype?
You can move it, then when you release it you can right click and hit "use this location" from the pop-up? But this is not updating the field with the selected location?
Can you also use the search to find a location by name? (just checking to see if it is connected).
G
Hi
I don't have a marker although I have set the default location for the datatype. If I do a search the marker is displayed, but when I publish it disappears
/Paul S
Hi
It seems odd that with a default you have no marker, but if you search and get your marker, then use "use this location" from teh pop-up, does the fiels become populated wiith the co-ordinates?
Just like the picture below?
Hi
When I search and get the marker I cannot right click to get a content menu so I can't get what your picture looks like
/Paul S
Hi Paul
OK, I may have got this wrong, but I am sure that it was a right click - however -
Just normal left-click the black dot at the centre - this should bring up the "use this location".
This will then enter the latitude and longitude in the field, save and publish then see if appears in page.
G
Hi G
Left.click - sorry I didn't try that also, but now i works - thanks a lot
/Paul S
is working on a reply...