Microsoft Developer Network >
Forums Home
>
Windows Live Developer Forums Forums
>
Bing Maps: Map Control Development
>
Bing map example
Bing map example
- Hi all,
I need to create a bing map application...I have a map of a city (london) and it is spilt up into different areas, one block shows barking, the other shows ealing etc...how can i translate this so when each section of the map is selected ie barking it highlights that block and navigates to another page passing that as a paramater??
please help me??
Answers
- - For option #1, go to http://www.beginningspatial.com/marking_out_features_using_virtual_earth
See how the latitude/longitude of the cursor is displayed under the map? You'd just add an event handler that captured this information when the user clicked and sent it back to a web handler to determine what borough that location was contained within. For SQL Server, this would be a query something like:
SELECT
BoroughName
FROM
LondonBoroughs
WHERE
Borough.STContains(@LocationClicked)
- For importing polygon shapes onto the map (option #2), and determining which one the cursor is over, try: http://www.minus34.com/demo/default.htm
- And for option #3, go to http://www.microsoft.com/maps/isdk/ajax/ Click on Find Information(basic) -> Reverse Find. Then pan/zoom the map to show London and click anywhere - you'll get the closest matching address shown at the top right.
Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290- Marked As Answer byMilli_22 Sunday, November 01, 2009 9:28 PM
All Replies
- Bing Maps doesn't know about boroughs of London - the only thing it knows about is the latitude and longitude of the point where the user clicked or, if you've imported some shapes onto the map, the shape that the user clicked on.
So, if you want your application to respond differently depending on what borough the user clicked on, you basically have two options:
- You can capture the latitude/longitude in Bing Maps and then pass that back to an application or database layer that identifies which borough the point lies in. This is easy, for example, in SQL Server 2008.
- You can import Polygons into Bing Maps that represent the shape of each borough, and then let Bing Maps decide which shape the user clicked on.
Either of these solutions rely on you having data representing the shape of each borough in an easy to use spatial format (ESRI shapefile, WKT, KML etc.) - when you say that you have a "map" of the city split into different areas, is this what you mean, or do you literally have a paper map?
(p.s. a third option, which I'm ruling out here, is to reverse geocode the closest address and then try to parse the address to find out the borough. However, this is unreliable - there is no guarantee (or reason why) addresses in London would include the name of the borough)
Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290 - Is there an example on the web you could point me towards??
- - For option #1, go to http://www.beginningspatial.com/marking_out_features_using_virtual_earth
See how the latitude/longitude of the cursor is displayed under the map? You'd just add an event handler that captured this information when the user clicked and sent it back to a web handler to determine what borough that location was contained within. For SQL Server, this would be a query something like:
SELECT
BoroughName
FROM
LondonBoroughs
WHERE
Borough.STContains(@LocationClicked)
- For importing polygon shapes onto the map (option #2), and determining which one the cursor is over, try: http://www.minus34.com/demo/default.htm
- And for option #3, go to http://www.microsoft.com/maps/isdk/ajax/ Click on Find Information(basic) -> Reverse Find. Then pan/zoom the map to show London and click anywhere - you'll get the closest matching address shown at the top right.
Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290- Marked As Answer byMilli_22 Sunday, November 01, 2009 9:28 PM
- ok thank you.

