Placing labels on the map (such as for vehicle identifiers)
hi all,
i have switched silverlight maps standard map control due restrictions on our company network (terminal servers can't handle silverlight well). i've successfuly migrated functionality standard control stuck on 1 item.
labels.
the application used track several hundred vehicles , unable display labels on map next custom icons using. in silverlight quite simple stuck on how implement in version. can me place simple labels on map?
thanks in advance!
there property on pushpin called textname can set point css class. can create styles make creating labels on map pretty easy. here code put seems have nice result:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> <script type="text/javascript"> var map = null; function getmap() { // initialize map map = new microsoft.maps.map(document.getelementbyid("mymap"), { credentials:"your_bing_maps_key" }); var labelpin = new microsoft.maps.pushpin(new microsoft.maps.location(0,0),{ text : 'custom label', //the text label typename : 'labelpin', //assign css class pin anchor : new microsoft.maps.point(45, 12) //adjust anchor point better label positioning //adjust x value see fit better centering of text }); map.entities.push(labelpin); } </script> <style> /* allow div of pushpin display overflowing content */ .labelpin{ overflow:visible !important; } /* hide default pushpin, alternatively point icon property of pushpin transparent image */ .labelpin img{ display:none; } /*use style text*/ .labelpin div{ white-space:nowrap; } </style> </head> <body onload="getmap();"> <div id='mymap' style="position:relative; width:800px; height:600px;"></div> </body> </html>
http://rbrundritt.wordpress.com
Bing Maps > Bing Maps Web Controls
Comments
Post a Comment