Hello Everyone!
First of all I want to say that this is a fantastic piece of code and
am very thankful that it has been made available to us. I work for
the Department of Emergency Management here in Virginia and have been
tasked to create a map/page (that will then be implemented in an
iPhone app) that zooms in on your current location via the <script
type="text/javascript" src="
http://maps.google.com/maps/api/js?
sensor=true"></script> or initialLocation. Also we have several
GeoXML feeds that we will need to have displayed in the vicinity of
the user's current location.
We have had partial success in that I have one page that zooms in on
the initialLocation without any problems but doesn't show the GeoXML
feed. This test page is located here:
http://www.gamecarver.com/map.html
Conversely, we have also been able to create a page that shows the
GeoXML feed and the callout windows but does not show or zoom in on
the initialLocation. This test page can be seen here:
http://www.gamecarver.com/map3.html
So in a nut shell...we are trying very hard to come up with the page
that does the zoom in on user's current location combined with the
GeoXML feed for that zoomed in vicinity. These pages have to be in
the "<div id="map_canvas" style="width:100%; height:100%"></div>"
format so that they display properly in the iPhone app.
Once we have this figured out I have to figure out how to display more
than one GeoXML feed at a time.
Below is my feeble attempt at combining the two functions but have yet
to figure it out. I would be absolutely incredible if someone would
be willing to help us out. We are trying to get a few tools in place
before hurricane season hits. Our mission is to save lives and
property and any mobile tools we can develop for our emergency
responders is paramount.
Thank you so much for taking the time to read this....below is the
code.
Jack
********************************************************************************
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: iPhone Geolocation</
title>
<script type="text/javascript" src="
http://maps.google.com/maps/api/js?
sensor=true"></script>
<script src="
http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAAw5BzHVctlqcdX2AtIbHzdhREwLgSgD5KyH21uJ9WYUXt4-
zK4BS0OmBpncr71qBor9WGbM7FJ4A_pA"
type="text/javascript"></script>
<script type="text/javascript">
var initialLocation;
var statepolice = new google.maps.LatLng(37.502168, -77.542212);
var geoXml;
function initialize() {
var myOptions = {
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
// Safari supports the W3C Geolocation method
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new
google.maps.LatLng(position.coords.latitude,position.coords.longitude);
var placeMarker = new google.maps.Marker({
position: initialLocation,
map: map,
});
geoXml = new GGeoXml("
https://cop.vdem.virginia.gov/gis_feeds/
GeoRSS2.ashx");
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(49.496675,-102.65625), 3);
map.setUIToDefault();
map.addOverlay(geoXml);
var placeMarker = new google.maps.Marker({
position: initialLocation,
map: map,
});
map.setCenter(initialLocation);
}, function() {
handleNoGeolocation(browserSupportFlag);
});
} else {
// Browser doesn't support Geolocation
handleNoGeolocation();
}
function handleNoGeolocation() {
initialLocation = statepolice;
map.setCenter(initialLocation);
}
}
</script>
</head>
<body style="margin:0px; padding:0px;" onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
--
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-map...@googlegroups.com.
To unsubscribe from this group, send email to
google-maps-js-a...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.