Reputation: 1
I'm doing a website for a company that develops new housing estates. I have a database containing table of postcodes/latitudes/longitudes for each of the developments.
What I need to do is get those longitudes/latitudes plotted onto a Google Map within the page based on the search results returned by a function I've written. The above mentioned properties are available through the instances of the class
I've researched this long and hard but can't seem to find anything that will answer my actual question - I've looked at the Google Maps API and various other resources, the closest thing I've found is this: http://www.multiplottr.com which is in essence what I want to do except that the points will be pulled from the database and will have some kind of class/ID on them so that I can add hover and click functions as well as interactivity with other elements on the page
Many thanks,
Matt
Upvotes: 0
Views: 3265
Reputation: 5461
Hi you may use like this
function initialize() {
var fenway = new google.maps.LatLng( <? php echo latitude from db ?> , <? php echo echo longtitude from db; ?> );
var mapOptions = {
center: fenway,
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var image = '<?php echo $path;?>components/com_propertylist/images/Home.png';
var beachMarker = new google.maps.Marker({
position: fenway,
map: map,
icon: image
});
google.maps.event.addDomListener(window, 'load', initialize);
// google.maps.event.trigger(map, 'resize');
}
Upvotes: 1
Reputation: 19879
Take the latitude / longitude values that are stored in your DB and plot them on the map using the Google Maps api. The plots are often referred to as markers. That might help you during your research.
Essentially, you'll need to write JS using PHP...
Upvotes: 0