How to label pushpins in bing maps? - bing-maps

Can any one tell me how to label pushpins in Bing maps for points of int interest? AM able to place multiple pushpins but unable to add labels to them dynamically.

Are you using the v7 maps control and APIs?
Check out the Infobox class and adding Infobox entities - these allow you to add a custom HTML block that can contain your label info. See http://msdn.microsoft.com/en-us/library/gg675208.aspx.
Alternatively with a pushpin you can specify the text field in the PushpinOptions object (http://msdn.microsoft.com/en-us/library/gg427629.aspx) when creating a pushpin.

pin.setOptions({text: "label"});

If you're using 7, try this little hack:
pinLayer.push(pinX);
pin1.cm1001_er_etr.dom.setAttribute('title', 'Push Pin Title');
This is an unpublished DOM. And keep in mind if MS decides to change it, you'll have to find a different solution.

Related

leaflet.js - Questions about polyline

I have some questions about leaflet's polyline and they are as follows
Is there a way when instantiating the polyline (L.polyline) to dictate that it should not show by default on the map? I know that I can use .addTo([map]) and .remove() but is there a way to specify as part of the options?
What is the best practice to hide/show polylines that are used to indicate a path between markers (L.marker)? I know that I can add the markers to a layer group (L.layerGroup). I know that when creating the polyline, I can use the same lat/lng for each of the markers indicating the path. I know that I can show/hide each one of those individually (using L.Control.Layers and passing in the layer groups in as overlay maps and using that control to show/hide the markers and then, again, using the addTo() and .remove() for the polylines) but what I'm hoping to get help with is to make it show that the polylines show/hide when the layer group is visible/not visible and also show/hide them using an external control. For the former case, I've tried using feature groups (L.featureGroup) but I could not get it to work. For that latter case am I limited to .addTo() and .remove()?
thnx,
Christoph

Stop click propagation on a custom div within a leaflet map

I have a custom div (with settings) within a map. I would like click event not to propagate to map when a user clicks on the div. How could one achieve such behavior?
Leaflet version 1.0.
See the documentation for L.DomEvent.stopPropagation().
For anyone else coming here from a search engine, if you are trying to prevent clicks from a circle or other interactive layer from being handled by the underlying object (other circle or the map itself) you could also create the layer passing the option bubblingMouseEvents: false
Documentation: http://leafletjs.com/reference-1.2.0.html#interactive-layer

How to create a Bing pushpin on my page that corresponds to the one on a map

I have a Bing map on my page that displays the location of each returned search result. Next to each result I'd like to put the corresponding pushpin image. So for example, on the first result I'd like to have an "A" pushpin next to it that looks exactly like the "A" pushpin on the map. Is there a way to retrieve that from the Bing service?
I can see that the pushpin is actually a combination of an "a" an "img" and a "div" - it would be ideal to be able to get that package returned from the service.
You will first need to get a copy of the base pushpin image that you are using to display your location. Once you have that then you can simply put this image in a div and overlay some text over it accordingly to mimic the look the layout of the pin on the map. This is pretty straight forward to do and a pretty common practice.

Bing Maps Pushpins and Info Box

I had a problem in bing maps, any one solve my issue.
On my bing maps I had lot's of pushpins, some are very closer to each other. So, when I click on one pushpin, respective Infobox is opened, but closer pushpins are displayed on the Infobox opened. Those need to be hidden below that opened Infobox.
So,please help me to hide the inactive pushpins beside infobox
I know exactly what your issue is. In bing Maps V7 the infobox entity is considered as just another entity like a pushpin, polygon, poliline... This is to make it more flexiable.That said, in most cases you want your infobox to always appear above your shapes. This can easily be done by using two entity collections. The bottom one for your shapes/pushpins and the top one for your infoboxes. I have a blog post demonstrating this here: http://rbrundritt.wordpress.com/2011/10/13/multiple-pushpins-and-infoboxes-in-bing-maps-v7/

How to disable Bird's eye angled view in Bing Maps control version 7

For business use Microsoft charge extra for use of the Bing Maps birds eye angled view, so my client has ask that I disable this option. In verion 6.3 of the control this was easy, there is a map option that can be used to do this: enter link description here
However, I can't find how to do this using the API with version 7 of the control. The current menu has Birds eye as an option with check boxes show labels and show angled view. Ideally I'd like to disable the option from the menu so that users are only able to view road and aerial views. So it looks like I have two options available:-
1) Hide the show angled view check box somehow with css. The issue here is that I can't get to the HTML content using the IE developer toolbar of firebug as it only displays when selected.
2) Attach to the map maptypechanged event and if birds eye map selected set it back to the map type it used to be.
Both of the above are far from ideal. Does anyone have a suggestion for the best way of doing this?
Sample code:
map = new Microsoft.Maps.Map(document.getElementById('myMap'),
{
credentials: 'Your Bing Maps Key',
disableBirdseye:true
});
here are some working examples from the iSDK:
http://www.bingmapsportal.com/isdk/ajaxv7#CreateMapWithMapOptions14
API Reference:
And here is the MSDN:
http://msdn.microsoft.com/en-us/library/gg427603.aspx
disableBirdseye
boolean
A boolean indicating whether to disable the bird’s eye map type. The default value is false. If this property is set to true, bird’s eye will be removed from the map navigation control and the birdseyeMapTypeId is disabled. Additionally, the auto map type will only display road or aerial.
This property can only be set when using the Map constructor.
You're correct in stating that there is no way currently using the v7 API to disable individual map styles. A possible Option #3 which is less hackish, but requires a bit more work, is to set the showMapTypeSelector property of the MapOptions to false, which would have the effect of hiding the entire map style selection dropdown. Then create your own custom navigation menu that only includes links to those styles you want to allow the user to choose.