Chapter 14: Line and Polygon Examples
From Mapping in the Cloud by Michael Peterson
Assignments from (insert your name here)
All Google Maps API examples here do not use a key. Domains and related sub-domains that had used Google Maps API before June 22, 2016 should find that the maps still function without a key. That's why the keyless examples work from this page. If the Google Map examples below don't work once you upload them to your server, you need to get a free key from Google. Further details of this new requirement and other changes to the Google Maps API usage policy can be found here at this site. The key that Google provides to you for free would be added to the call to the API, like this:
- 14_01_Simple_Line - Draw a line that shows your general route home.
- 14_01b_Dashed_line - Draw a dashed line between two points.
- 14_01c_Arrow - Draw an arrow between two points.
- 14_02_Flow_Map -
Map out data on the number of people that fly between three different airports in the US.
Data can be found through this List of busiest passenger air routes. Make the thinnest line 2 pixels and the thickest 20 pixels wide . Include the calculated widths of the lines below the map.
- 14_03a_Geodesic_Line - Make a single map that shows the great circles between three major cities in the world.
- 14_03b_Great_Circle_input - Modify the color and thickness of the resultant line.
- 14_04_Mapping_lines_from_XML_file - Enter new points and infowindow text in the "example.xml" file.
- 14_05_Mapping_lines_from_JSON_file - Enter new points in the "SW.json" file.
- 14_05b_Mapping_lines_from_geoJSON_file - Create a new line and display.
- 14_06a_Mapping_lines_from_KML_file.htm - Change the coordinates for the line in the kml_lines.kml file.
Change the address of the kml_lines.kml file so that it points to your directory. It should not point to the maps.unomaha.edu server.
- 14_06b_Mapping_flight_track_great_circle.htm - Map out a flight track between two cities and the corresponding great circle route. 1) Choose a flight that has arrived between two cities with FlightAware Flight Finder; 2) Under "track log & graph," copy the table of data and paste into Excel; 3) Delete unneeded columns and create a CSV file of longitude, latitude, and elevation.
Replace any missing altitude values with best estimates based on surrounding values; 4) Save and open the CSV file in a text editor and copy/paste the three columns into the "track.kml" file; 5) Change the link of the KML file to your online directory (not maps.unomaha.edu);
6) Save and open the CSV file in a text editor and copy/paste the three columns into the "track.kml" file;
7) Set the second map to highlight a particular aspect of the flight.
- 14_07_Mapping_lines_from a Fusion_Table.htm - Download the tornadoes Fusion Table as CSV and upload to your Google Drive. Share your Fusion Table. Change the symbolization of the lines and link to your version.
- ADVANCED: 14_08a_Mapping_500ft_contours_from_Fusion_Table.htm - Convert the cntrs200_n83.shp.zip from the code14data_FTP folder to a KML and upload to a FusionTable.
- 14_08b_Mapping_flight line from_Fusion_Table.htm - Upload the KML file from 14.06b to a Fusion Table. Share your Fusion Table and link.
- 14_08c_Mapping_flight line from a geoJSON file - Upload the data from 14.06b to http://geojson.io using Open/File. Download (Save) as geoJSON. Link to this file.
- 14_09_Line_Input - Change the center, line width and line color of the line that is drawn.
- 14_10_Cross_section - Make a cross-section that is perpendicular to a mountain or river valley.
- 14_10a_Elevation service - Change location and size of map. Add feet to the infowindow. Replace this text with a title.
- 14_11_Polyline_Encoding.htm - Encode a line segment and map the line by copying and pasting the encoded polyline into the following code: 14_11a_Display_Encoded_Polyline.htm
- 14_12a_Route_Line - Create a route that connects two places.
- 14_12b_Route_Choice - Create a route that connects two places.
- 14_12c_Draggable_Distance - Create a route that connects two places.
- 14_13a_Single_polygon - Change center and create a polygon with 4 points and fill with a different color.
- 14_13b_Draggable_polygon - Change center and create a polygon with 4 points and fill with a different color.
- 14_13c_Point_in_Polygon - Change center and create a polygon with 4 points and fill with a different color.
- 14_14_Mapping_polygon_from_XML_file.htm - Create a new polygon and change the center and polygon color.
- ADVANCED: 14_15_inside_Polygon_Vienna.html - Create another donut polygon.
- ADVANCED: 14_16_Inside_KML_Polygon.html - Create a new donut polygon in the kml_polygons.kml, change the center and polygon color.
- 14_22_Nebraska_Choropleth_Map.html - Enter data values for Nebraska by county from this website. Copy and paste the data into an Excel spreadsheet. Add a comma after each value using concatenate. Create a single string of comma-delimited values by using the transpose function, hitting F9 (Mac: Control/=) before hitting return.
- 14_22b_Display_World_GeoJSON - Change scale and size of map.
- 14_22c_Display_US_GeoJSON - Find another geoJSON file to display.
- 14_22d_Click_Style_GeoJSON - Change color and size.
- 14_22k_Display_California_TOPOjson - Change scale and size of map.
- 14_22l_Display_US_County_TOPOjson - Change scale and size of map.
- 14.22m_Choropleth_map_from_geoJSON - Change the variable mapped.
- 14.22n_Choropleth_map_from_topoJSON - Change the variable mapped.
- 14_23_Fusion_Tables_Shaded_Polygons.html - Open this Fusion Table and download as a CSV. Go to Google Drive and import the file. The data are described in the USCensusDataDescription.txt file. Create a choropleth map with five categories under Change Feature Styles. Add legend. Publish the map . Reference
- 14_24_Fusion_Table_Heatmap_Tornadoes.htm -
Change the display of the heatmap.
- 14_25_Fusion_Table_Heatmap_Coral_Bleaching.htm - Add a third map to the display at an intermediate scale
- Create a cross-section from Los Angeles to New York.
- Convert a shapefile of a state outline to a KML file using the mygeodata converter.
- Create a choropleth map based on a GeoJSON file.
Back to my assignments page