Web maps api to see in 45 deg angle - javascript

I've been searching for a map API that allows me to see in a 45 degree angle, such as Google Earth does.
So far I haven't found any, and I know that Google Maps and Bing Maps do not have this function. And any others found do not include the country required: Portugal.
I'm searching for, preferably, a map that is not installed by a plugin, but in last case, I will work with that.

With google maps this is possible. You must use the tilt property in mapOptions
var mapOptions = {
center: new google.maps.LatLng(36.964645, -122.01523),
zoom: 18,
mapTypeId: google.maps.MapTypeId.SATELLITE,
tilt: 45
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
Look at this sample from google dev

Related

how do I get latest satellite maps from Google map api V3

Today I was trying add a google map(satellite view) to my project when i located my place in google map site its looks like below
Captured from maps.google.com:
When I load same location in my web site this looking like below
captured from my project :
am using below code to do this stuff am missing anything ...
var map = new google.maps.Map(document.getElementById('map-tool'), {
zoom:6,
center: {lat: -37.729737, lng: 144.814376},
mapTypeControl: false,
streetViewControl: false,
fullscreenControl: true,
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.HYBRID
});
My question is how do I get a clear satellite map view like what we get in maps.google.com in JavaScript API?
Any help will be appreciated.
Only Google Maps for Work API will give you the access to the latest and higher resolution images. The images shown on the maps.google.com are extruded with elevation data on it and displayed in WebGL canvas, it is expected to look differently than what you see when simply use the out-of-box satellite view from the API.

Google Maps Javascript API does not open blank grey

I'm trying to develop an asp.net project using Google Maps and JavaScript. For three days my map was opening perfectly. But today the map zoom and other map control buttons are coming but map doesn't come. Instead map grey blank is coming.
HereIsTheImage and here is my js code:
function LoadHarita() {
var myLatlng = new google.maps.LatLng(33.3, 33.3);
var myOptions = {
zoom: 16,
center: myLatlng,
disableDefaultUI: true,
panControl: true,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.DEFAULT
},
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
},
streetViewControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map-canvas'), myOptions);
}
What's the problem? The map quota or limits? But what kind of limits for 3 days? I didn't understand it.
Thanks guys. Solved the problem. Here is the details if anyone needs it.
I opened the console by pressing F12. There was saying that i've added multiple maps.
I wrote the google map javascript codes under http://maps.google.com/maps/api/js to top of my javascript code. I deleted all these code on my js. And my map comes :) Normally i won't able to reach the map yesterday because i've added these codes yesterday. Maybe cookie is the reason. Whatever my map comes :) Thanks again
I had the same problem. Turned out it was Internet Explorer's 'Compatibility view' that was wrecking Google's Map code when running in localhost. Turning compatibility view off in IE11 made it work again.
The API call limit for Google Maps is 25000/day or something. It's very unlikely you managed to hit that just by playing around while developing. Try running your code in different browsers to see if it makes any difference.

Get ExtendedData from KML with Google Maps API

I have a KML export from google maps, and some pointers have images or youtube videos. When i open the kml i see a tag on some pointers with youtube and image links. But when i load them into the Google Maps Api i cant see these urls.
This is what i have:
function initialize() {
var mapOptions = {
center: { lat: 52.448346, lng: 4.602585},
zoom: 12
};
var map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
var kmlLayer = new google.maps.KmlLayer({
url: 'test_1.kml',
clickable: true,
preserveViewport: true,
map: map
});
google.maps.event.addListener(kmlLayer, 'click', function(event) {
console.debug(event);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
Is there something to extract the media from the pointers?
My solution would be to export to a xml or json then build a map from it since ExtendedData of kml is partially supported by design, check out the documentation here
Here a possible duplicate of this question: Accessing ExtendedData information via Google Maps API v3

How to highlight a user's current location in google maps?

I am using following code to get the location of user in phonegap (it works fine)
function getLocation() {
var win = function(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
var myLatlng = new google.maps.LatLng(lat, long);
var myOptions = {
center: myLatlng,
zoom: 7,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
var map_element = document.getElementById("displayMap");
var map = new google.maps.Map(map_element, myOptions);
};
var fail = function(e) {
alert('Error: ' + e);
};
var watchID = navigator.geolocation.getCurrentPosition(win, fail);
}
This is working fine by centering the user's current location on the map. But I would like to show an indicator (a red dot) on the user's location. But I can see that google API provide only 3 options center, zoom and mapTypeId.
Are there any available options that can be used to highlight the position or is there a workaround?
EDIT
Was able to find that google maps API has a marker ho highlight any position. That looks helpful, but that shows a default red balloon, can that be modified by a custom image?
You can use the newly released GeolocationMarker which is part of the Google Maps API Utility Library.
It will add a marker and accuracy circle at the user's current location. It also allows a developer to customize the marker using the setMarkerOptions method and specifying an icon property.
Use icon inside marker like
var Marker = new google.maps.Marker({
map: map,
animation: google.maps.Animation.DROP,
position: "",
icon: /bluedot.png
});
you can use this google map location indication circular blue dot icon similar to the google map
You can use MarkerOptions to set a custom image. Check the Google Maps Javascript API V3 Reference to more details about Google Maps.

Printing API-Generated Google Maps from Internet Explorer

Having an odd problem printing an API-generated (V3) Google Map from Internet Explorer 7 & 8.
I generate my map with JavaScript similar to the following:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var centroid = new google.maps.LatLng(35.9948166667, -83.9781791667);
var myOptions = {
disableDefaultUI: true,
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: centroid
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var marker0 = new google.maps.Marker({
position: new google.maps.LatLng(36.1102, -83.9208),
map: map
});
var marker1 = new google.maps.Marker({
position: new google.maps.LatLng(36.001, -83.8646),
map: map
});
}
</script>
Typically there are about 25-35 markers on any of my maps. These print just great from Safari, Firefox, and Chrome, on both OS X & Windows XP. But, as soon as I try to print from Internet Explorer 7 or 8, the maps go all crazy: they overflow their boundaries that I set in the print CSS and the markers disappear from the map, leaving just a blank spot on the map.
Anyone encountered this/know how to proceed?
TIA.
IIRC, you'll have to use the Google Static Maps API if you want printer friendly maps.
It should be pretty easy to build the Static Maps API URL request string from the LatLng or your markers. One caveat is that the URL is limited to 2048 characters including any character escapes, this will limit how many markers you can have on the map at one time.
[Edit] In the Javascript API, markers have the class 'gmnoprint', which disables them from showing up on the printed rendering. You can iterate through the markers and remove this class, which should allow them to be printed on the page. As far as I know, this will not work for the direction lines.

Categories