1 00:00:01,340 --> 00:00:06,800 Now that we've got our list of points successfully being saved inside of our location context I think 2 00:00:06,800 --> 00:00:11,180 we should attempt to draw that location or essentially that list of points as a Polish line. 3 00:00:11,180 --> 00:00:15,770 Once again on our map that a user can see the track or essentially the points that they have passed 4 00:00:15,770 --> 00:00:16,730 through. 5 00:00:16,730 --> 00:00:18,580 So to do so we can go back to our map. 6 00:00:18,590 --> 00:00:24,420 Dot J.S. file inside up here we've already got a reference to our location context. 7 00:00:24,420 --> 00:00:28,470 So I want to make sure that in addition to pulling off our current location I'm also going to get our 8 00:00:28,530 --> 00:00:34,560 list of locations that we have now stored after doing our recording and then going to make sure that 9 00:00:34,560 --> 00:00:39,860 from that React Native maps library I still have my import for Polish line right there. 10 00:00:39,930 --> 00:00:45,600 So between our list of locations and our Polish line we want to try to draw out our list of coordinates 11 00:00:45,870 --> 00:00:47,290 on the screen. 12 00:00:47,290 --> 00:00:49,050 Now just one little difficulty here. 13 00:00:49,050 --> 00:00:54,480 I want you to recall that the locations array right here has a bunch of different location objects every 14 00:00:54,480 --> 00:01:00,630 location object has a timestamp property and a coords property and inside that coords property is our 15 00:01:00,630 --> 00:01:03,990 longitude and latitude just to make sure that's really clear. 16 00:01:04,050 --> 00:01:09,150 Then throw down a quick council log right here of that locations array. 17 00:01:09,220 --> 00:01:16,080 Then start recording myself once again back over here get one or two points and then I'll flip back 18 00:01:16,080 --> 00:01:19,750 over my terminal and there we go. 19 00:01:19,760 --> 00:01:24,800 So inside of here once again we've got the time stamp property and then also the court's property with 20 00:01:24,800 --> 00:01:28,060 the latitude and longitude when we draw a policy line. 21 00:01:28,070 --> 00:01:33,230 We have to give it an array of latitude and longitude properties inside of objects. 22 00:01:33,260 --> 00:01:38,030 So in other words when we draw this poverty line we're not just going to throw in this big old locations 23 00:01:38,030 --> 00:01:38,690 array. 24 00:01:38,690 --> 00:01:44,320 Instead we're going to have to extract just our coords properties from each of these different locations. 25 00:01:44,360 --> 00:01:49,490 So just a little bit of code we have to write extra I'm going to delete that council log. 26 00:01:49,490 --> 00:01:56,270 Then inside of my map view right after our circle going to place a polish line once again and I'll give 27 00:01:56,270 --> 00:02:02,720 it a coordinates property so inside of here we're going to take a look at our list of different locations 28 00:02:02,720 --> 00:02:04,390 that we have recorded. 29 00:02:04,400 --> 00:02:10,040 You will then map over that array and for every location which I'm going to abbreviate just as Ello 30 00:02:10,040 --> 00:02:14,880 see I'm going to return Ello C dot courts. 31 00:02:14,900 --> 00:02:19,040 So essentially we're going to go through each of those different location objects pull off just the 32 00:02:19,040 --> 00:02:24,480 court's property and return each court's property inside of a brand new Array. 33 00:02:24,560 --> 00:02:28,420 So let's try saving this and seeing how it works. 34 00:02:28,470 --> 00:02:30,090 I'll go back go to try create. 35 00:02:30,360 --> 00:02:36,660 I'm going to start recording and as I do I can immediately see it my track being recorded. 36 00:02:36,670 --> 00:02:40,920 Now of course right now remember we've got this kind of simulated data coming in which means we're always 37 00:02:40,920 --> 00:02:43,000 going up to the top right. 38 00:02:43,020 --> 00:02:47,610 So even though we are definitely drawing each of these separate policy lines on the map correctly it's 39 00:02:47,610 --> 00:02:51,390 going to end up looking just like a very simple straight line right now. 40 00:02:51,690 --> 00:02:57,450 If you are using that data coming out of mock location right here you could add in some advanced logic 41 00:02:57,480 --> 00:03:02,370 to make sure that the longitude and latitude that we generate are not just going off in some singular 42 00:03:02,370 --> 00:03:03,510 direction. 43 00:03:03,510 --> 00:03:08,610 So if you wanted to you can maybe put in some degree of randomness inside of here or maybe you say depending 44 00:03:08,610 --> 00:03:14,160 on whether or not increment is even or odd to increase or decrease the longitude latitude and kind of 45 00:03:14,160 --> 00:03:16,560 get a zig zag like we had previously. 46 00:03:16,650 --> 00:03:21,660 But again I will definitely leave that up to you if you want to add in some more complex randomization 47 00:03:21,660 --> 00:03:22,900 logic inside of your. 48 00:03:22,920 --> 00:03:25,420 Feel free to do so OK. 49 00:03:25,450 --> 00:03:28,240 Well overall I'd say that this is definitely a good improvement. 50 00:03:28,270 --> 00:03:29,950 So let's take a quick pause right here. 51 00:03:29,950 --> 00:03:34,870 Continue in the next video and make sure that we add in the ability to actually save this list of points 52 00:03:34,870 --> 00:03:38,360 that we are recording so quick pause and I'll see you in just a minute.