Step By Step Geolocation

Day 1
Project Overview

The purpose of this project is for you to see how the geolocation element of HTML5 works. Geolocation is tied closely with Google's Map software. Google has changed usage of its map application since the writing of this lesson.

You now need to have a application program interface key and you must give them billing information if you plan to use Google Maps on your web page.

You can still complete the lesson without the API key, you just can't put it up on your web site.

The application you will be developing is a Trade Show web application located your geographical area.

A sample project is already provided for you so that you can model your own application after it. The app example is to promote a surfing and watersports trade show.

It was created paying attention to the responsive design models suited for viewing on cell phones, tablets as well as computers.

It includes: places to stay, restaurants in the vicinity, places to surf, an animation of a surfer, and scrolling pictures of things to do when not involved in the trade show.

It also contains a Google map based on lattitude and longitude for the area, where you can make reservations and plan your trip to the trade show

The last part of the project includes the trade show's events an agenda for the two days and a rotating picture gallery of the the area.

It also includes a way for participants to register for the event. The project takes approximately 1 weeks (5 hours) to complete.

As you are going through the assignment, be thinking of what your trade show will be.

You should go thru the existing example to try our all the code for yourself.

Fill out the worksheet ans you go through the lesson. Work sheet for this project

After completing the surfing tradeshow application, create your ownn trade show app using the code you have already used.


Organization of Tutorial

The column at the far left contains the navigational links. Clicking on these links takes you to that particular section of the tutorial.

The middle column contains the actual tutorial instructions. The column at the far right contains the code needed for the project.

Geolocation Trade Show Application
Planning

Even though the project is all ready laid out for you, it would be a good idea to look at the planning stages of this project so that you can apply this knowledge to projects of your own creation.


Flexible box model template

  1. First, start our with the flexible box model template for the html part of the project. It features flexible boxes for the article or main section, the side box a navigational box as well as a header and a footer.
  2. The flexible model is designed to work with cascading style sheets files to make your application suited for cell phones and tablets, as well as computers.
  3. Code for the flexible box model fo the trade show application is in Figure 2 for you to use.
  4. Here is what goes in each section of the template.
  5. The header
    • In my example, the header contains: Trade Show announcement place and dates.
    • A graphic featuring a surfer on a wave that covers the entire header.
    • The text, the name and dates of the trade show are indendented
  6. The footer: copyright information.
  7. The Article - Main Section of Page.
    • Included in this section is a Google map of the area based on lattitude and longitude.
  8. Navigation Section
    • Places to stay plus and image
    • Places to eat plus and image
    • Animation of a surfer on a wave
    • Places in the area to surf
  9. Aside - Side News
    • Schedule for the two days of the trade show
    • Rotating images of different places of interest
    • Link to the registration page for participants
Color Scheme

When you create your own app, decide on a color scheme for the header, footer, article, aside, navigation and borders for each. RGB - red, green blue was used in this example. You can also use hex-decimal numbers to represent the colors or in some case the name of the color.

You can also decide on color for ordered , unordered lists, both background and text colors.


Wikipeia RGB colors




Day 2

Materials, Files and Pictures Needed

You need a number of things before beginning your own project. You will need the following items.

  1. Names, addresses for restaurants in your area.
  2. Places of interest
  3. An agenda for your event
You will need the following files that are in the textareas to the right

Here are the pictures for the trade show app.

Hover over each picture to reveal the name of the picture file. Right click each one and save as name indicated into your working folder.

You will need to locate the following pictures for your own app.

How to get the picture files for your own app.

  1. Search the Intenet for appropriate pictures.
  2. Right-click each picture.
  3. Save image as
  4. Select the folder being used to store this project
  5. Pick a descriptive name for each one.
  6. .jpg is a good format to save under
  7. Continue until all pictures have been saved into your folder.



How to get copies of all files needed for the project.
  1. Click the button below the textarea box containing the code you need.
  2. All the text is selected and put on the clipboard.
  3. Open Notepad++.
  4. Select New File.
  5. Paste the information from the clipboard into the new file.
  6. Save the file using the name of the style files listed above each batch of code.
  7. For example, save the code for the Style1 file as 'Style1.css'. These file are all linked to your main html5 web page.
  8. Remember case matters.


Day 3
Teacher Responsibilities

The teacher needs to make certain that the students' computers have Notepad++ and Google's Chrome installed as a browser. The other browsers such as Internet Explorer and Mozilla's FireFox will work nicely too.

The teacher needs to verify that certain parts of the project are completed and that the software performs as it was designed.

There is a sign off worksheet that should be completed to come up with the student's grades. Checkoff the required material each day on the worksheet.


Work sheet for this project
Day 4 Getting Your Location

For your project, you will need to find your current position based on longitude and lattitude since your project counts on the fact that your participants in the trade show, want to stay and eat at local places.

Longitude is a geographic coordinate specifying East-West position. The distance of a degree is about 69 miles or 60 nautical miles.

Lattitude is a geographic coordinate specifying North-South position.

The program in figure 1 has the code needed for you to determine your location.

  1. Click on the button at the bottom of the textarea box. By clicking the button, the code is selected and put on the clipboard.
  2. Now open up Notepad++
  3. Click on new file.
  4. Paste the code into the editor.
  5. Save your file using an html extension.
  6. Make sure that you have enabled location on your computer.
    • Go to Start
    • Settings
    • Privacy
    • Location
    • Turn settings on
  7. Execute the program by clicking on the button Try it
  8. Your longitude and lattitude should appear.
  9. Write down these coordinates, as you will need them for this project.
Day 5 HTML5 code for project
  1. The HTML5 code for the project is in Figure 2.
  2. Click the button below the text to put it on the clipboard.
  3. Open Notepad++
  4. Create a new file.
  5. Paste the information into the editor.
  6. Save the file in your working folder and use an .html extension.

What does the code mean?

Day 6 Styling the application

Before running the html application, we need to get the style sheets that format the web page for different devices.

The files that accomplish this are:


Day 7 Animated Picture

To create an animation insert the name of the picture as the background-image, background-image: url('wave.jpg');.

You can change the size of the animation by adjusting the height and width.

Borders and the color of the border can be modified.

Play with the other numbers to get different effects.

The code is located in the main HTML file.

Day 8 Rotation Pictures

The banner currently cycles pictures of Santa Barbara points of interest.

Follow these steps to use your own pictures.

  1. First load the HTML file into Notepad ++.
  2. Examine the code. There a total of 11 pictures in the array.
  3. They are numbered 0 through 10.
  4. Change the names of the picture files to your own.
Day 9 Application Program Interface Key

As of June 22, 2014, Google requires an Application Program Interface (API) key to use its map program on your website. You first need to have a Google account and then sign up for the key.

Google also requires billing information, since after a point they will charge you.

To get the API key, click on this link. Google Developers web page

Even without the key, you can still see how the program works and complete your assignment.

When you run it using Notepad++ the center section, Article, displays the map briefly. and then an error message saying 'oops something went wrong. See the javaScript console'

There are three sections of code, all in the HTML section, that need to be changed:

  1. The style section setting the size of the map. It needs no changes, but you can change the size if you want.
  2. The script section that loads and uses Google maps. If you get a key, you need to put that API key in the appropriate line.
  3. The third section is within script tags and it is where you will enter your longitude and lattitude coordinates.

After making the changes, save the file.


Day 10 Testing the application

Using Notepad++ run the program. It should look like the following image.




Day 11 Registration Section

The application also contains a registration form for attendees. There is link on the trade show app to the registration form. After the form has been filled in, the submit button is clicked, the form is sent to the web host and tied to the web page and an email account.

If you fill out the form and submit it, it will go to my email account.

For the infomation on the form to go to you, you need to arrange with your web hosting company to have them set up form processing.

We can examine the code

It is an HTML form.

After the regular html, language, head and header and body tags, a form name is assigned with the action attribute equal to our website .

The code is in the cgi/form mail folder.

Common gateway interface as used here is (a script standard for writing interactive programs generated by visitors to web pages).

A section called customer info is created and all the code is between those tags.

The legend is the title of the form.

There are fields for first name, last name, email, address, city state and zip.

All fields are required and have placeholders.

After the information fields, a button is created.

input type=hidden value=jerry@janetbelch.com name = recipient

This line is necessary to correctly process the form.

Here is the information that you will receive after clicking the submit button.




Trade Show Application key
Registration Form Key


Day 12 Your Turn

Now take what you have learned and create your own app for a tradeshow of your own choosing.