Yahoo maps api de la versión 3.8 de no mostrar la imagen personalizada?
-
10-07-2019 - |
Pregunta
He utilizado el siguiente código para mostrar el marcador personalizado en Yahoo Maps :
<Script type=text/javascript>
var map=new YMap(document.getElementById('map')); // Create a map object
Get_Lat_Lon() //
var myPoint=new YGeoPoint(Lat,Lon); // Create a lat/lon object
map.addPanControl(); // Add a pan control
map.drawZoomAndCenter(myPoint,16); // Display the map centered on a latitude and longitude
map.setMapType(YAHOO_MAP_REG); // Set map type to either of: YAHOO_MAP_SAT YAHOO_MAP_HYB YAHOO_MAP_REG
var myMapTypes = map.getMapTypes(); // Get valid map types, returns array [YAHOO_MAP_REG, YAHOO_MAP_SAT, YAHOO_MAP_HYB]
var myImage = new YImage(); // Create Custom Marker_Image
myImage.src = 'C:/Dir_Data/Center_Image.png'; // Specify image url
myImage.size = new YSize(10,10); // Set image size
var marker = new YMarker(myPoint,myImage); // Create a marker positioned at a lat/lon
marker.addLabel("<Font Size=1>Here</Font>"); // Add a label to the marker
var Location_Image = new YImage(); // Create Custom Marker_Image
Location_Image.src = 'C:/Dir_Data/Sample_Image.png'; // Specify image url
Location_Image.size = new YSize(6,6); // Set image size
var marker_0 = new YMarker(new YGeoPoint(12.4567890,-12.456789),Location_Image); // Create a marker positioned at a lat/lon
marker_0.addLabel("<Font Size=1>AAA</Font>"); // Add a label to the marker
marker_0.addAutoExpand("<Html><Center>[ A-Id : ]<Br>AAA</Center></Html>"); // Add a mouse over label to the marker
var markup_0 = "Lat = 12.4567890<Br>Lon = -12.456789"; // Add a markup label to the marker
YEvent.Capture(marker_0,EventsList.MouseClick,function(){ marker_0.openSmartWindow(markup_0); }); //
map.addOverlay(marker_0); // Display the marker
var Location_Image = new YImage(); // Create Custom Marker_Image
Location_Image.src = 'C:/Dir_Data/Sample_Image.png'; // Specify image url
Location_Image.size = new YSize(6,6); // Set image size
var marker_1 = new YMarker(new YGeoPoint(-8.253114,33.808793),Location_Image); // Create a marker positioned at a lat/lon
marker_1.addLabel("<Font Size=1>BBB</Font>"); // Add a label to the marker
marker_1.addAutoExpand("<Html><Center>[ B-Id : ]<Br>BBB</Center></Html>"); // Add a mouse over label to the marker
var markup_1 = "Lat = -8.253114<Br>Lon = 33.808793"; // Add a markup label to the marker
YEvent.Capture(marker_1,EventsList.MouseClick,function(){ marker_1.openSmartWindow(markup_1); }); //
map.addOverlay(marker_1); // Display the marker
var Location_Image = new YImage(); // Create Custom Marker_Image
Location_Image.src = 'C:/Dir_Data/Sample_Image.png'; // Specify image url
Location_Image.size = new YSize(5,5); // Set image size
var marker_2 = new YMarker(new YGeoPoint(70,80),Location_Image); // Create a marker positioned at a lat/lon
marker_2.addLabel("<Font Size=1>CCC</Font>"); // Add a label to the marker
marker_2.addAutoExpand("<Html><Center>[ C-Id : ]<Br>CCC</Center></Html>"); // Add a mouse over label to the marker
var markup_2 = "Lat = 70<Br>Lon = 80"; // Add a markup label to the marker
YEvent.Capture(marker_2,EventsList.MouseClick,function(){ marker_2.openSmartWindow(markup_2); }); //
map.addOverlay(marker_2); // Display the marker
var Location_Image = new YImage(); // Create Custom Marker_Image
Location_Image.src = 'C:/Dir_Data/Sample_Image.png'; // Specify image url
Location_Image.size = new YSize(3,3);
......
</Script>
Se utiliza para trabajar bien con :
<Script Type=text/javascript Src=http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=
y puedo ver mi imagen personalizada (un color dot) en el mapa.Ahora con :
<Script Type=text/javascript Src=http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=
mi costumbre de la imagen no aparece, parece que hay una diferencia con la versión 3.0 y la versión 3.8, ¿qué puedo hacer para solucionarlo ?
Frank
Solución
Si usted agregar marcador.addAutoExpand("Añadir una Etiqueta a un Marcador para este Efecto");antes de marcador.addLabel("Y");Va a trabajar.Por CIERTO yo uso v3.8
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow