Google Map Subgurim Show Arrowed Polyline - asp.net

I am using Subgurim asp.net control for Google Maps in ASP.net.
The Problem is that I need to show an ARROWED POLYLINE betwwen my two points on map.
Following is my code , but unfortunately I am not able to apply anything for that:
GLatLng from = new GLatLng(FromLan, FromLon);
GLatLng To = new GLatLng(ToLan, ToLon);
GLatLngBounds llbound = new GLatLngBounds(from, To);
GMap2.GZoom = GMap2.getBoundsZoomLevel(llbound);
GMap2.setCenter(llbound.getCenter());
GLatLng inside = llbound.getCenter();
bool isInside = llbound.contains(inside);
GPolyline objpolyline = new GPolyline();
objpolyline.points.Add(from);
objpolyline.points.Add(To);
objpolyline.color = "red";
objpolyline.colorNet = System.Drawing.Color.Red;
objpolyline.clickable = false;
objpolyline.PolylineID = "Route";
objpolyline.geodesic = true;
//Javascript Code
//pts1.push (new GLatLng(lat111, lng222));
//var poly1 = new BDCCArrowedPolyline(pts1,"#FF0000",4,0.3,
// null,30,7,"#0000FF",2,0.5);
//map.addOverlay(poly1);
GMap2.addPolyline(objpolyline);
//GMap2.addPolyline(objpolyline);
Regards ,
Vishal

It looks to me like you are using the Google Maps API v2.
Two issues with that:
it is deprecated and could stop working in less than a year.
the Google Maps API v3 now supports "arrowed polylines" natively.

Related

formatting infowindow google maps

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.

Display photographer's name in Business View via Google Maps Javascript API v3

Is there any way to read and display the photographer's name in Google Maps Business View using Google Maps Javascript API v3? I can't find any hint in the reference and I don't get the problem solved.
Thanks, Stefan
You could use the #copyright param from the panorama.
https://developers.google.com/maps/documentation/javascript/reference#StreetViewPanoramaData
For example you could do this:
var center = new google.maps.LatLng(-31.416676, -64.1841580000002);
var streetViewService = new google.maps.StreetViewService (document.getElementById("map"));
streetViewService.getPanoramaByLocation(center, 30, function(panorama){console.log(panorama.copyright);});
This would create a new instance of streetViewService, then you ask for the panorama related to the "center" variable and finally, you could use the copyright variable.
Also, you could use just the description field from the location variable returned from the same getPanoramaByLocation call:
var center = new google.maps.LatLng(-31.416676, -64.1841580000002);
var streetViewService = new google.maps.StreetViewService (document.getElementById("map"));
streetViewService.getPanoramaByLocation(center, 30, function(panorama){console.log(panorama.location.description);});
Hope it helps.

google.maps.Overlay is not a constructor

Hi I m trying to migrate a google maps V2 to google maps V3 project.
Here I m creating a prototype as below.It is in a seperate .js file other than the .js file containing function to initialize the map.
Ubicacion.prototype = new google.maps.Overlay();
Ubicacion.prototype.initialize = function(map) {
var alias_ = this.alias_;
var direccion_ = this.direccion_;
var fecha_ = this.fecha_;
var point_ = this.point_;
var tipo_ = this.tipo_;
var imagen_ = this.imagen_;
...
}
But I m getting "google.maps.Overlay is not a constructor". I understand by googling that it may be caused because initialization is happening before google maps is being loaded; and can be rectified by using google.setOnLoadCallback() for initizialising objects.But I m not very clear in using the same.
Can any one please guide me?This is very urgent.
There really is no such constructor.
I guess what you try to use should be google.maps.OverlayView

Difficulty with the image quality of the map generated with Bing Map Api

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

Cloning 3D model in google earth API

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

Resources