Presentation Google Maps API - VilniusGoogle Maps API - Vilnius
Exercise 1
Description Create a website containing three maps, all centered at Vilnius (Terrain, satellite, roadmap). Adjust the zoom to show the city boundaries screen-wide.
Tips - Create an HTML file
- In the consolehttps://code.google.com/apis/console/ activate Google Maps API v3 service and create a new API key
- Import Google Maps API JavaScript library in the HTML file. Add required parameters: key oraz sensor
- Create mapOptions objects:
- Create google.maps.Map objects and pass right parameters to it (HTML nodes, mapOptions objects, etc.)
Exercise 2 (optional)
Description Publish your website in the internet, and make your application key secure, so it won't be possible to use the outside of your domain. How to make it possible to test the website both on- and off-line?
Tips
Exercise 3
Description - Create a map which contains couple of markers
- For a selected marker define an animation (BOUNCE), while choosing (DROP) for other markers.
- For selected markers define a custom icon loaded from a library
- (optional) Try to create custom, advanced icon for marker (shadows, handling z-index)
- (optional) Create couple of buttons in the website which surrounds the map. Show or hide markers depending on click on the buttons.
Tips
Exercise 4
Description Create an animation in which the center of the map will move around all markers created in a previous exercise.
Tips - Use google.maps.Map.panTo(LatLng)
- These JavaScript functions might be useful: setTimeout() or setInterval()
Exercise 5
Description - Create a map with one opened InfoWindow containing rich HTML content.
- Create a map with several markers. InfoWindows should popup when users clicks on the marker.
Tips - Consider using "Country links" data coming from the Ministry of Foreign Affairs
- Use google.maps.InfoWindow
- Add a listener to a marker to react on its events: google.maps.event.addListener(MARKER, EVENT, CALLBACK_FUNCTION)
Exercise 6
Description - Create a website, where user will be able to enter city name and will be shown a map centered on chosen city. Provide an InfoWindow with the city name too.
- (optional) For bigger set of addresses (e.g. stored in a Spreadsheet) use a Geocoding service
Tips
Exercise 7
Description - Create a map which responds to user's clicks. Create a marker in the point that was clicked.
- Add an InfoWindow to the created marker and provide the info about the nearest town.
Tips - Use the geocode method of google.mapsGeocoder class. Pass a latLng parameter.
- To react on user's clicks, you need to add a listener to the map: google.maps.event.addListener(map, 'click', callback);
- Callback function will be invoked with a parameter containing coordinates of the clicked point available in latLng property.
Documentation https://developers.google.com/maps/documentation/javascript/geocoding?hl=pl#ReverseGeocoding
Exercise 8
Description - Put various predefined symbols on the map. Experiment with color, stroke, transparency, etc.
- (optional) Define your own path and use it as a symbol.
Tips - You can find predefined symbols in the google.maps.SymbolPath class
Exercise 9
Description - Create a map which contains several Polylines. Differentiate them by using various style parameters.
- (optional) Create a map, where user is allowed to create a Polyline by clicking on random point on the map.
Tips - Use strokeColor, strokeOpacity, strokeWeight
- Use Polyline getPath to get access to the array with the point of the Polyline
Exercise 10
Description - Create a Polyline ended with an arrow.
- Create an arrow in every point clicked by the user. (The other end of the arrow may be always in the same point)
- (optional) Enable user to create arrows between two points.
Tips - Use offset to move symbol along the Polyline.
Exercise 11
Description - Create a dashed Polyline.
- (optional) Add animation to the Polyline.
Tips - Use strokeOpacity to hide the line. Add a non-transparent repeating symbol to create a pattern.
- Use setTimeout() and offset to animate symbols.
Exercise 12
Description - Create several Polygons in different colors.
- (optional) Create a Polygon which consists of more than one path and has non-trivial shape (e.g. a donut or non continuous shape)
Tips - Use google.maps.Polygon and google.maps.PolygonOptions
Exercise 13
Description - Create several circles on the map. Diameter of the circle should be related to some real data (e.g. city population)
- Create several rectangles with various colors.
Tips - Use google.maps.Circle and google.maps.Rectangle
Exercise 14
Description - Modify the standard rendering of the map's control buttons. Hide some control elements and move the remaining to another place on the screen.
- (optional) Create your own control element on the map.
Tips - To hide a control element you need to pass a parameter to the mapOptions
- To modify a default place of controls use position property of the ControlPosition class
Exercise 15
Description - Create a custom-styled map. (e.g. change streets color)
Tips - Use styles property in the mapOptions
Exercise 16
Description - Based on external data, create a map with Heatmap layer.
- Change the default gradient of color
Tips - Depending on the zoom level, change Heatmap into markers.
|
|