This is the Udacity Neighborhood Map Project. It's intended as a challenge to put together a SPA using Google Maps Javascript API along with third-party APIs.
This map displays some of the locations in Vancouver, BC where TV Series - Supernatural was shot.
- Download or Clone this repo, replace demo key with your own Google Api key in config.js, and open index.html
- Checkout Live version here
- Download Udacity provided Repo
- Setup Google account and project to obtain API
- Setup local server. (I used browser_sync. Help)
- Learned and practiced KockoutJS framework on Pup Clicker
- Reviewed project requirements
- Collected data required for project
- Implemented requirements as per project specifications
- Responsive (complete)
- Usability (complete)
- Map fullScreen Enabled
- Toggle between Custom Map and Hybrid mapTypes
- Filter locations using input field and error free
- List view displays all locations and filtered subset locations
- Map displays all locations by default and filtered subset locations
- Markers animation and InfoWindow display when clicked on pin or list item
- List functionality is responsive and error free
- Google Maps API loads asynchronously
- Asychronous request from third-party API (Wikipedia)
- Error handling (complete)
- Application runs without an error
- Displays complete address of the location
- Episode and Season information
- Displays Panorama Image for device widths > 768px
- Displays Static Street View image for width < 768px
- Displays additional Wikipedia links for the location
- Code minification (complete)
- Comments to explain functionality
- Code quality as per Udacity JS style guide (complete)
- Knockout handled list, filter, click event on list
- Seprarate model function for Map marker, marker click events
-
Error: Uncaught ReferenceError: google is not defined
Solution: Script or Google Javascript API callback function, or any google.maps.* function is being called before Google Api. Any google function will not be defined until api request is made.
-
Issue: Multiple InfoWindows will open but content was displayed in the very InfoWindow that was open in the map
Solution: Keep the variable global (var windowInfo), and put defination in ViewModel or callback function
-
Issue: After closing InfoWindow, it won't open again when clicked on list item or pin
Solution: When used InfoWindow.close(), it removes the InfoWindow from the DOM, i.e. It set the value of global variable var windowInfo = null. We need to re-assign new google.maps.InfoWindow(); after calling close()
-
Deferred update: When I entered search term in the input bar, it would update map and list only when I enter second letter or second key press. This caused delay and asynchronous update rendering.
Solution: I noticed that when following is used for computed observablearray - value: computedObservableArray, valueUpdate: 'afterkeydown' or 'keydown'. textInput is better approach to get update with computed observablearray. Source: Browser event quirks handling
-
Issue: With DOCTYPE HTML, Google Maps would disappear.
Solution: Google Maps inherits height of the parent div. Doctype html set the height of body, html to 0. Setting body, html or the parent div of the Google Maps div to fied height resolved the issue. height: 100%;