Creating 3d Buildings with Google Maps<a href="
You are not allowed to view links.
Please Register or Login" imageanchor="1" target="_blank"><img border="0" src="
You are not allowed to view links.
Please Register or Login" />[/url]
I had one of those 'I wish I'd thought of that' moments this week when I saw the awesome <a href="
You are not allowed to view links.
Please Register or Login" style="color: #cc0000;" target="_blank">DTS Dallas Theological Seminary[/url] campus map. The map uses polygons and the Google Maps 45° Imagery view to create the impression of 3d buildings on Google Maps.
Today I had a little play with the Google Maps API to see if I could reproduce the effect. The result is this little <a href="
You are not allowed to view links.
Please Register or Login" style="color: #cc0000;" target="_blank">3d Polygon[/url] demo map. My solution to creating the polygons differs a little from the DTS map (see the comments on this <a href="
You are not allowed to view links.
Please Register or Login" style="color: #cc0000;" target="_blank">post [/url] for some clues as to their solution).
In essence I simply create four different building polygons, one for each heading in the 45° Imagery view. So when the user rotates the map only the correct building polygon is displayed on the map. To achieve this you have to use getHeading() with an event listener to detect when the map view has been changed.
My solution is to have four different building polygons and then create an if...else statement to load the correct building polygon. Here's the important part of the code:
if (heading == 0) {
buildingOne.setMap(map);
buildingTwo.setMap(null);
buildingThree.setMap(null);
buildingFour.setMap(null);
}
else if (heading == 90) {
buildingOne.setMap(null);
buildingTwo.setMap(map);
buildingThree.setMap(null);
buildingFour.setMap(null);
}
else if (heading == 180) {
buildingOne.setMap(null);
buildingTwo.setMap(null);
buildingThree.setMap(map);
buildingFour.setMap(null);
}
else if (heading == 270) {
buildingOne.setMap(null);
buildingTwo.setMap(null);
buildingThree.setMap(null);
buildingFour.setMap(map);
}<img src="
You are not allowed to view links.
Please Register or Login" height="1" width="1"/>
You are not allowed to view links.
Please Register or Login
Linkback: You are not allowed to view links.
Please Register or Login
http://www.thunting.com/smf/index.php/topic,45994.msg250552.html#msg250552
|
|
Logged
|
This message has been posted by our automatic Treasure in the News Feed
|