Creating the MapItinerary
Creating the MapItinerary
Video Transcript
00:00All right, so let's take a small break from loading the data. And the reason is, is because
00:03we need a map. Without it, we don't have anything here, really. So one thing that we could do is we
00:09could do a couple of things in parallel, right? We could load our document at the same time as
00:14we're our data spreadsheet, at the same time as we're getting our map ready. There's no reason
00:19why that couldn't happen. So the next step that we want to do, I'm going to just stop our process.
00:23We're not going to do anything here. We're going to go back to what we do once the load is done
00:28and some sort of a TDB kind of thing to be determined. TBD would that would be TBD. Well,
00:35TDB, TBD, TBD. Let's do a TBD to be determined. All right, so what I want to do is I'm just going to
00:42scroll a little bit down here and I'm just going to create a new completely new object. And literally
00:47based on our classes that we've done so far, only we're going to use that as a wrapper, which is
00:51also something that is done a lot of times in programming, where you have the Google map
00:56itself, but we really don't want to extend the Google map. All we really want to do is create
01:00some sort of a bundler where we can mix inside both the Google map and also the data visualization
01:06API. So to do that, I'm just going to create a new function, which is going to be a new object
01:10of sort, because that's how we create objects in JavaScript. And I'm going to call it map
01:15itinerary. Now, map itinerary would be one word. I just pasted it because obviously I didn't
01:20know how to spell itinerary because my copywriters cannot write that for me and I'm bad at memorizing
01:26things. All right, so we have our map itinerary. I'm bad at memorizing words. What could you do?
01:32So Google map itinerary is going to be our object. We could, we'll just call it map itinerary.
01:38Now, for now, we're just going to create a map itinerary that is just an empty function.
01:42And this empty function, let's build it up. So first of the first, first things that we'd want
01:46to do when we create a new map itinerary is no matter what we want to sender it in a specific
01:52spot of the world. So we might want to create here some sort of a latitude longitude object
01:57that would just be accepted. So I'm just going to call this lat long. And basically,
02:02it would accept a lat long once it gets a lat long, it will create a Google map.
02:07Now that we have that established, all we really have to do is create a map. So for example,
02:12in our init function right here, I could create a new map, and I could set it to be a new map
02:18itinerary and send into it a specific spot, a specific point, a specific element. And we'll
02:24make sure to create that element right before that. So we'll create here a new point, which is going
02:28to be our center point. Center lat long, lat long. And we'll just create a new element by basically
02:39creating a new google.maps.latlong. And we will send into it information. And lucky for us,
02:47I have already set a few lat long positions in advance, but I'm going to show you how to create
02:53your own. And literally, all you have to do is go into Google Docs. Well, Google Maps, actually.
03:02And once you go into Google Maps, you will find Maps Labs. And we've talked about it also
03:07in a previous course, so we're not going to talk about it much. Besides, once you click on it,
03:11you'll have an option to enable something that enables us to see the lat long positions. I enabled
03:17both the lat long tool tip and the lat long marker. Once you do that and you actually click shift
03:22and on something, you'll get that information of that specific spot. You could even save it,
03:30but in our case, we're just going to see that information. As soon as we click on shift,
03:34we'll be able to see the information which worked for us perfectly. And when we could copy that
03:38value right into our lat long object that we are creating. In my case, I already know exactly what
03:44I want it to be. Let me just get there. Unfortunately, Dreamweaver is really bad right now.
04:00Here we go. So we set it right in the right position. We'll save it. For some reason,
04:04when we have errors, my Dreamweaver is going completely berserk. I might in the next video
04:09just move down to CS5 because I don't think it was happening in CS5 or move to a different
04:14application. We'll see. We'll take a break soon and I'll try to sort this out because it's kind
04:17of annoying already. All right. So we've set our lat long position. We called it center lat long,
04:23and we could take that lat long and send it into our map itinerary. And our map itinerary
04:28now could take over again and we could go back into our map itinerary. We have an object
04:33ready. We've created a new map itinerary. We called it map or let's call it MI map.
04:42Now let's just call it map. All right. So we called it map. The next thing I probably want to
04:46do is I want to store that lat long information for future prosperity. So I'm going to save it
04:51right into the object and I'm just going to copy that information, save it right into the object
04:59so I could use it later on when I needed and other methods of the object as we create them
05:04when we need them.
