Advertisement

09.21.2008 at 03:01PM PDT, ID: 23749965
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.5

Please help me customise my Google map to fit my desired criteria

Asked by 93jordanaj in JavaScript

Tags: , ,

I am completely new to Google maps and I'm trying to customise a map on my site. I have started producing it and I have listed the code below. I would like to customise it in the following ways and would appreciate as much help as possible.

- When the map is clicked a marker appears in that position, if the marker is then clicked it will disappear. There can only be one marker on the map at any given time. When a marker is set the map is also centred at that location.

- When a marker is placed the values of latitude and longitude are recorded in the hidden fields named 'lat' and 'lon'. The fields are then cleared if the marker is removed as mentioned above.

- I would like to allow the user to search the map by dragging the cursor, as already is the case, however is it possible to set the size of the map so that they can't drag past a certain point? When the map first loads it features the United Kingdom, I do not want the user to be able to scroll past this whatever the zoom level. Hence the user cant drag the map at all at the zoom level when the page first loads, then as the user zooms in he will be able to drag up to the perimeter defined by the map shown when the page first loads.

- Finally is it possible to prevent the marker being placed in the sea, or on land out of the United Kingdom? More favourably can the map be manipulated so the bordering countries shown (France, Ireland etc) are removed completely, if not then can the city names and other detail out of the United Kingdom be removed?

Thank you in advanced for your help.

Alex
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAADLvWIatVgZigVMhkgJ1pCBQTU3iuhSWej-OvfROlbiVWP1UIjhQPJeMn3hEHd47pskO_7DQLVSXW5A" type="text/javascript"></script>
 
<script type="text/javascript">
//<![CDATA[
    function load() {
      if (GBrowserIsCompatible())
	  {
        var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl()); 
        map.addControl(new GMapTypeControl());  
        map.setCenter(new GLatLng(55.8000, -3.6000), 5);
		//Sets a minimum zoom
        var minmapscale = 5; 
        var mapTypes = map.getMapTypes(); 
        for (var i=0; i<mapTypes.length; i++)
		  { 
          mapTypes[i].getMinimumResolution = function() {return minmapscale;} 
          }
		//
      }
	  else
	  {
	  alert("<p class='style1' align='center'><b>Google Maps is not compatible with this browser!</b><br/>As a result we could not display this map."); 
      }
    }
//]]>
</script>
</head>
 
<body onload="load()" onunload="GUnload()">
<div style="border:#CCCCCC solid 1px; padding:2px; width:350px; height:500px;">
<div id="map" style="width:350px; height:500px;"></div></div>
<form action="" method="get">
<input name="lat" type="hidden" value="" />
<input name="lon" type="hidden" value="" />
</form>
</body>
</html>
[+][-]09.22.2008 at 11:03AM PDT, ID: 22542342

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.22.2008 at 05:20PM PDT, ID: 22545462

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: JavaScript - Google Maps, Google Maps, N/A
Sign Up Now!
Solution Provided By: Zyloch
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628