wolfcry Posted August 16, 2011 Share Posted August 16, 2011 Hey all, Not sure if this is the proper place for my question and if it isn't, I apologize in advance. I've recently began building this website and one of the desired aspects is to allow their users to input their location (city, state / province and country) and have PHP automatically create markers on a map of the location. I'm not sure PHP can even do this, sounds more like a JavaScript / Ajax thing but does anyone know of a script or open source program that can do what I'm describing? or at least can provide me some direction because I have absolutely no idea on where to start looking and before someone suggests GoogleMaps, they're storing the information locally so GoogleMaps won't work in this case as far as I know. Thanks for any help you can provide! Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/ Share on other sites More sharing options...
The Little Guy Posted August 16, 2011 Share Posted August 16, 2011 GoogleMaps.... API Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/#findComment-1258233 Share on other sites More sharing options...
wolfcry Posted August 16, 2011 Author Share Posted August 16, 2011 Ok, I naturally assumed someone would suggest GoogleMaps, but seeing as they want custom markers based on various user status and they want the map to auto-update based on location entered by the user and from what I've seen on GoogleMaps API (unless I'm looking at the wrong API), the locations (coordinates) are predetermined within the script itself and I don't see where the I can customize the markers themselves. So, how do I go about doing this with GoogleMaps API? I'm sure I'm just missing something. Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/#findComment-1258239 Share on other sites More sharing options...
ignace Posted August 16, 2011 Share Posted August 16, 2011 they're storing the information locally so GoogleMaps won't work in this case as far as I know No, they are not. You can either use the GClientGeocoder and use AJAX to store the returned values or use their Geocoding webservice API directly from PHP. Yahoo! also provides a Geocoding service among others. Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/#findComment-1258246 Share on other sites More sharing options...
The Little Guy Posted August 16, 2011 Share Posted August 16, 2011 This will add two markers to the map <script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(38.891033, -96.591797); var myOptions = { zoom: 3, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var myLatlng, marker; myLatlng = new google.maps.LatLng("44.6307","-93.3034"); marker = new google.maps.Marker({ position: myLatlng, map: map, title:"24.197.217.40" }); myLatlng = new google.maps.LatLng("44.8205","-92.9256"); marker = new google.maps.Marker({ position: myLatlng, map: map, title:"174.155.1.75" }); } function loadScript() { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize"; document.body.appendChild(script); } </script> <div id="map_canvas" style="width: 500px; height: 300px"></div> <script>loadScript();</script> Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/#findComment-1258248 Share on other sites More sharing options...
wolfcry Posted August 17, 2011 Author Share Posted August 17, 2011 No, they are not. You can either use the GClientGeocoder and use AJAX to store the returned values or use their Geocoding webservice API directly from PHP. I didn't even know about GClientGeocoder, thanks for the heads up. Also, when I stated, "They're storing the information locally" I meant the user's information is being stored locally in their (the client's) own internal database. Thanks for the code snippet Little Guy, I'll see what I can do with it. Unfortunately I'm not sure if it's going to be what they want because the site owner wants that information created dynamically when the user inputs it in and as far as I know, they don't want to do that using a predetermined list of coordinates but rather general city, state/province, country stuff. Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/#findComment-1258379 Share on other sites More sharing options...
xyph Posted August 17, 2011 Share Posted August 17, 2011 That can all be done real time. Google Maps API is by far the easiest way to do this. Quote Link to comment https://forums.phpfreaks.com/topic/244945-anyone-know-of-a-php-script-that-auto-maps-locations/#findComment-1258390 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.