问题
Im making a simple proof of concept webpage using Bing maps. I need to have several pins on a map which is embedded in my page. Then a javascript UI will make it so when users tick or untick certain boxes the results are filtered, so different pins will be made visible or invisible.
Sorry for the openness of this question but how do I go about doing this? Id much rather work with jQuery than plain JavaScript. Its only a proof of concept so speed, performance, reliability, etc are all flexible. Do I need microsoft tools like silverlight?
It would be best if I could do this with Bing maps but if Google maps is far easier to work with then I can be flexible on this too. Thanks
回答1:
I have done something similar this with Google maps. I pretty much did it with all jQuery except for some areas where I needed JavaScript.
Here's a very high level description. I had markers classified by what we will call regions and when a user clicked on the number corresponding to that region all of the markers that belong to that region were then plotted on the map.
On load of the map I would hit my JSON file of markers (I cache the marker information that is located in a DB table) and store them by region in an array of objects. I used unique IDs so I would be able to specify what markers to plot. If you're using checkboxes or radio buttons you can use the value attribute, It was multidimensional so it looked like this:
markers_obj[region][marker]
If the user clicked that region again the markers would then be removed from the map.
What helped me most was looking at how other people had accomplished tasks similar to what I was trying to achieve. There is a wealth of information out there for interacting with google maps. Unfortunately, I don't have any experience with Bing maps.
Here's some links to the Google maps API, code samples they provide, and demos.
- http://code.google.com/apis/maps/documentation/javascript/tutorial.html
- http://code.google.com/apis/maps/documentation/javascript/examples/index.html
- http://code.google.com/apis/maps/documentation/javascript/demogallery.html
Let me know if you have any questions about what I described, it may be a little vague.
回答2:
If you're looking to get started fast with jQuery and Google Maps, this library might be useful for you: http://code.google.com/p/jquery-ui-map/
来源:https://stackoverflow.com/questions/9316667/javascript-ui-for-ideally-bing-maps-or-google-maps