Select your Location on GoogleMap

15 years 7 months ago #74862 by fallnet
Select your Location on GoogleMap was created by fallnet
Hi,

is it possible on Front when I add new or edit my user profile next to custom tables Longitude and Latitude (where user can select his location) - add small googlemap, here user can zoom and select point on the map and location automatic import to Longitude and Latitude custom fields???
Next user can save Profile ...

I used this code in EventList and EZ Reality components, but I don't know how to implement it to CB 1.1.

[code:1]<script src="maps.google.com/maps?file=api&v=2.x&key=ABQIAAAA_aT_-
IRw0Ec2KYr4Buy1WBRmJ1nH3jvqEUHY_P7unFlsyOMTWBQpbbJt1NX1hs1Z9menKsZBUpm5XA" type="text/javascript"></script>

<div id="map" style="width: 95%; height: 300px"></div>

<script type="text/javascript">
//<![CDATA[

function load () {
var zoomlevel = 13;
var start_latitude = "25.21239616785117";
var start_longitude = "55.283203125";
var declat = "25.21239616785117";
var declong = "55.283203125";
var map = new GMap(document.getElementById("map"«»));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl(true));
var latitude = document.getElementById('declat').value;
if (latitude == ""«»)

latitude = start_latitude;
var longitude = document.getElementById('declong').value;
if (longitude == ""«»)

longitude = start_longitude;
if (latitude == 55.283203125) {
zoomlevel = 4 }
else {
zoomlevel = 6 }

// center and zoom to the lat/long in the form
map.centerAndZoom(new GPoint(longitude,latitude), zoomlevel);

GEvent.addListener(map, "click", function(overlay, point){
map.clearOverlays();
if (point) {
map.addOverlay(new GMarker(point));
map.panTo(point);
document.getElementById('declat').value = point.y;
document.getElementById('declong').value = point.x;
}
}
);
}
//]]>
</script>
<body onload="load()" onunload="GUnload()">
[/code:1]

To custom fields I need to add:
[code:1] id="declat" [/code:1]
and
[code:1] id="declong" [/code:1]

Example:
[code:1]<input class="shadebox" type="text" name="declat" size="15" id="declat" value="<?php echo $row->declat;?>" />[/code:1]

Example on Frontpage


Can you help me please?

I use CB 1.1 and Joomla! 1.0.15

Thank you.

Post edited by: fallnet, at: 2008/09/19 12:04

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.173 seconds

Facebook Twitter LinkedIn