how to get latlngbound in places get by autocomplete?
for getting latitude i use the following code
var place = places.getPlace();
var latitude = place.geometry.location.lat();
However it is not working when i try following code to get latlngbounds
// northeast is undefined
var latlngbounds = place.geometry.bounds.northeast.lat();
// undefined
var latlngbounds = place.geometry.bounds;
The PlaceGeometry also includes a suggested viewport, which is a google.maps.LatLngBounds object. (Its name is viewport, not bounds, however)
Properties Type Description
location LatLng The Place's position.
viewport LatLngBounds The preferred viewport when displaying this Place on a map. This property will be null if the preferred viewport for the Place is not known.
var place = places.getPlace();
var latitude = place.geometry.location.lat();
var bounds = place.geometry.viewport;
Related
I am following a google map tutorial on youtube. All is well until I try to display the stored data on the infowindow. In the code below latitude and longitude are displayed in one line concatenated. I would like to have them in separate lines. I have tried a number of html tags as well as '/n'. No joy. Unfortunately, the tags are also displayed along with the data.
Any clues would be appreciated.
function showAllColleges(allData) {
var infoWind = new google.maps.InfoWindow;
Array.prototype.forEach.call(allData, function(data){
var content = document.createElement('div');
var strong = document.createElement('strong');
strong.textContent = data.lat + data.lng ;
content.appendChild(strong);
for anybody that is having the same problem I have cobbled the solution from a number of entries in stackoverflow.
Each data.element from the database can be displayed in the infowindow. Here I have shown how to display dacicost, lat and lng
function showAllColleges(allData) {
var infoWind = new google.maps.InfoWindow;
Array.prototype.forEach.call(allData, function(data){
var content = document.createElement('div');
var strong = document.createElement('strong');
strong.textContent =data.dacicost
content.appendChild(strong);
content.appendChild(document.createElement('br'));
var text = document.createElement('text');
text.textContent = data.lat
content.appendChild(text);
content.appendChild(document.createElement('br'));
var text = document.createElement('text');
text.textContent = data.lng
content.appendChild(text);
There must be a more efficient way of doing this but, at last, this works.
Are markers supported in Street View Static API? I am not getting a marker back, and I see no documentation provided for using markers with street view static images.
Documentation from Google indicates that street view markers are supported:
https://developers.google.com/maps/documentation/ios-sdk/streetview#markers_within_street_view
an example is:
// Create a marker at the Eiffel Tower
let position = CLLocationCoordinate2D(latitude: 48.858, longitude: 2.294)
let marker = GMSMarker(position: position)
// Add the marker to a GMSPanoramaView object named panoView
marker.panoramaView = panoView
// Add the marker to a GMSMapView object named mapView
marker.map = mapView
I'm developing an application that retrieves an image of "Bing Maps" with [Bing Api] since my webService.
My problem is the rendering of the image.
If I set my zoom greater than 11,or if I set a size too big, the result of recover my image is like "cut" into several loading and gives the impression that the image is not entirely downloaded.
Example picture below...
Have you any idea why the image looks like its back?
Here is my code used in my webService.
//call function
GetImageMap(46,6,800,800,17);
//Get Bing map Image from the web
public string GetImageMap(double latitude,double longitude,int mapSizeHeight, int mapSizeWidth, int zoomLevel)
{
string key = "asoidfz9aos78fa9w3hf9w3fh9hf7ha9wfw37fhblablablablablabla";
MapUriRequest mapUriRequest = new MapUriRequest();
// Set credentials using a valid Bing Maps key
mapUriRequest.Credentials = new ImageryService.Credentials();
mapUriRequest.Credentials.ApplicationId = key;
// Set the location of the requested image
mapUriRequest.Center = new ImageryService.Location();
mapUriRequest.Center.Latitude = latitude;
mapUriRequest.Center.Longitude = longitude;
// Set the map style and zoom level
MapUriOptions mapUriOptions = new MapUriOptions();
mapUriOptions.Style = MapStyle.Aerial;
mapUriOptions.ZoomLevel = zoomLevel;
mapUriOptions.PreventIconCollision = true;
// Set the size of the requested image in pixels
mapUriOptions.ImageSize = new ImageryService.SizeOfint();
mapUriOptions.ImageSize.Height = mapSizeHeight;
mapUriOptions.ImageSize.Width = mapSizeWidth;
mapUriRequest.Options = mapUriOptions;
//Make the request and return the URI
ImageryServiceClient imageryService = new ImageryServiceClient();
MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
return mapUriResponse.Uri;
}
// ### END Function getImageMap
And the url query:
http://api.tiles.virtualearth.net/api/GetMap.ashx?c=46,6&dcl=1&w=800&h=800&b=a,mkt.en-US&z=17&token={token}
Result image.. :
It seems to be related to the aerial imagery and it's not technically related.
I will report it to the appropriate team.
By the way, you should use the REST Imagery API which is the official way to use the imagery from Bing, see the MSDN:
http://msdn.microsoft.com/en-us/library/ff701724.aspx
Here is a sample URL based on your example:
http://dev.virtualearth.net/REST/v1/Imagery/Map/Aerial/46,6/17?mapSize=800,800&key=YOURKEY
I want to represent 3D models in Google Earth environmente with API and Google Plugin.
I have the code:
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_HIDE);
// Placemark
var placemark = ge.createPlacemark('Modello1');
placemark.setName('model');
var place2 = ge.createPlacemark('Modello2');
place2.setName('modello2');
// Placemark/Model (geometry)
var model = ge.createModel('Mod1');
placemark.setGeometry(model);
var modello2 = ge.createModel('Mod2');
place2.setGeometry(modello2);
// Placemark/Model/Link
var link = ge.createLink('File1');
link.setHref("http://myhost.org/table2/models/table2.dae");
model.setLink(link);
var link2 = ge.createLink('File2');
link2.setHref("http://myhost.org/tavolo/models/table2.dae");
modello2.setLink(link2);
// get center look at location
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
// Placemark/Model/Location
var loc = ge.createLocation('');
loc.setLatitude(40.01000594412381);
loc.setLongitude(-105.2727379358738);
model.setLocation(loc);
//slightly varying coordinates...
var loc2 = ge.createLocation('');
loc2.setLatitude(40.01000594412389);
loc2.setLongitude(-105.2727379358731);
modello2.setLocation(loc2);
// add the model placemark to Earth
ge.getFeatures().appendChild(placemark);
ge.getFeatures().appendChild(place2);
// zoom into the model
lookAt.setLatitude(40.01000594412381);
lookAt.setLongitude(-105.2727379358738);
lookAt.setRange(300);
lookAt.setTilt(80);
ge.getView().setAbstractView(lookAt);
}
function failureCB(errorCode) {
}
google.setOnLoadCallback(init);
When i load different collada (.dae) files no problems appear... but it doesn't load the same Table 2 times! Why?!?
I have also tried to separate instances and files... but problem persists. I have only one table on my environment.
Is there a method to clone single model into N models ?
have you tried injecting kml t display the models using parse kml.
also try using getKml to get the kml and see if it renders properly in a stand alone kml file
I'm having trouble with this code can anybody help...
var imageMap:ImageSnapshot= ImageSnapshot.captureImage(object);
var pixelValue:uint = imageMap.bitmapData.getPixel(x, y);
According to the documentation, there is no bitmapData property of the ImageSnap class. Instead you can use the static ImageSnapshot.captureBitmapData function to get a BitmapData snapshot of your object.
var imageMap:BitmapData = ImageSnapshot.captureBitmapData(object);
var pixelValue:uint = imageMap.getPixel(x,y);