You fundamentally need the part you "don't want" especially

map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

That line effectively creates the map and connects it to the target
div (#map_canvas). Then your later statements feed into it to tell it
more precisely what you want it to display.

A link to your actual page would help us understand more precisely
what you're trying to achieve and whether your code can be refined.


On Jul 24, 1:38 am, slindsey3000 <slindsey3...@gmail.com> wrote:
> This works in my app but I know it can be cleaned up.  I am just not
> sure how to do it.  I kind of (well totally) rigged this javascript
> from examples on the API page.  It works... but it does not need to do
> the *HERE IT IS* part.   I can't take out this stuff because it uses
> this to build needed objects.  I really only need it to build the map
> from the *HERE IS WHAT I WANT TO MAP*.  Sadly and embarrassingly, I am
> building a map then really quickly changing it... so silly...
>
> Any cleanup suggestions?   Thanks!!
>
> **********************
>
> <script type="text/javascript"
>     src="http://maps.google.com/maps/api/js?sensor=false";>
> </script>
> <script type="text/javascript">
>   var geocoder;
>   var map;
>
>   function initialize() {
>
>     geocoder = new google.maps.Geocoder();
>      var latlng = new google.maps.LatLng(-34.397, 150.644);
> <!--- HERE IT IS  -->
>
>     var myOptions = {
>       zoom: 12,
>       center: latlng,
>       mapTypeId: google.maps.MapTypeId.ROADMAP
>     }
>     map = new google.maps.Map(document.getElementById("map_canvas"),
> myOptions);
>
>     var address = "<%...@tournament_address %>"                     <--
> HERE IS WHAT I WANT TO MAP -->
>
>     geocoder.geocode( { 'address': address}, function(results, status)
> {
>       if (status == google.maps.GeocoderStatus.OK) {
>         map.setCenter(results[0].geometry.location);
>         var marker = new google.maps.Marker({
>             map: map,
>             position: results[0].geometry.location
>         });
>       } else {
>         alert("Geocode was not successful for the following reason: "
> + status);
>       }
>     });
>   }
>
> </script>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to