diff --git a/playground/src/app/app.component.html b/playground/src/app/app.component.html
index 2131c9b..258e3bd 100644
--- a/playground/src/app/app.component.html
+++ b/playground/src/app/app.component.html
@@ -2,14 +2,12 @@
-
+
+
+
diff --git a/playground/src/app/app.component.ts b/playground/src/app/app.component.ts
index d1653b0..d264347 100644
--- a/playground/src/app/app.component.ts
+++ b/playground/src/app/app.component.ts
@@ -1,77 +1,53 @@
-import { Component } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
+import { Http } from '@angular/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
-export class AppComponent {
+export class AppComponent implements OnInit {
public lat: Number = 24.799448;
public lng: Number = 120.979021;
- public origin: any = '大潤發新竹湳雅店';
- public destination: any = '國立新竹高級中學';
+ public origin: any = 'Taichung Main Station';
+ public destination: any = 'Taichung City Government';
- public waypoints: object = [
- {
- location: '國立新竹高級商業職業學校',
- stopover: false,
- },
- {
- location: '新竹市立建功高級中學',
- stopover: false,
- },
- ];
+ public renderRoute: object = null;
- public renderOptions = {
- suppressMarkers: true,
- };
+ public dir = [];
+ public datas = [];
- public markerOptions = {
- origin: {
- icon: 'https://i.imgur.com/7teZKif.png',
- infoWindow: `
-
origin
- Taiwan Tech
- `,
- },
- destination: {
- icon: 'https://i.imgur.com/7teZKif.png',
- infoWindow: `
- destination
- Taiwan Tech
- `,
- },
- waypoints: [
- {
- icon: 'https://i.imgur.com/7teZKif.png',
- infoWindow: `
- waypoints111
- Taiwan Tech
- `,
- },
- {
- icon: 'https://i.imgur.com/7teZKif.png',
- infoWindow: `
- waypoints222
- Taiwan Tech
- `,
- },
- ],
- };
-
- public visible: Boolean = true;
+ constructor(private http: Http) {
+ this.http.get('assets/data1.json').subscribe(result => { this.datas.push(result.json()); });
+ this.http.get('assets/data2.json').subscribe(result => { this.datas.push(result.json()); });
+ }
- public onChange(event: any) {
- console.log('onChange', event);
+ async ngOnInit() {
+ // setTimeout(() => this.direction2(), 300);
}
+ // private direction2() {
+ // this.origin = 'Taichung University of Science and Technology';
+ // this.destination = 'Taichung Main Station';
+ // }
+
public onResponse(event: any) {
- console.log('onResponse', event);
+ this.dir.push(event);
+ }
+
+ public renderfromData(index: number) {
+ // Render from memory
+ // this.renderRoute = this.dir[index];
+
+ // Render from json file (build from direction response)
+ this.renderRoute = this.datas[index - 1];
}
- public hide() {
- this.visible = !this.visible;
+ public renderNew() {
+ this.origin = 'Taichung Main Station';
+ this.destination = 'Taichung University of Science and Technology';
+ this.renderRoute = null;
}
}
diff --git a/playground/src/app/app.module.ts b/playground/src/app/app.module.ts
index b8ce9a9..3f62acc 100644
--- a/playground/src/app/app.module.ts
+++ b/playground/src/app/app.module.ts
@@ -1,5 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
+import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
@@ -12,6 +13,7 @@ import { AgmDirectionModule } from '../../../dist';
],
imports: [
BrowserModule,
+ HttpModule,
AgmCoreModule.forRoot({
apiKey: '',
}),
diff --git a/playground/src/assets/data1.json b/playground/src/assets/data1.json
new file mode 100644
index 0000000..8aac67c
--- /dev/null
+++ b/playground/src/assets/data1.json
@@ -0,0 +1,1021 @@
+{
+ "geocoded_waypoints":[
+ {
+ "geocoder_status":"OK",
+ "place_id":"ChIJPz37OBQ9aTQRtgYZL9DrtLc",
+ "types":[
+ "establishment",
+ "point_of_interest",
+ "train_station",
+ "transit_station"
+ ]
+ },
+ {
+ "geocoder_status":"OK",
+ "partial_match":true,
+ "place_id":"ChIJ7yJ5-d8XaTQRf0SmfuQ-Uoc",
+ "types":[
+ "administrative_area_level_1",
+ "political"
+ ]
+ }
+ ],
+ "routes":[
+ {
+ "bounds":{
+ "south":24.13811,
+ "west":120.67359,
+ "north":24.147740000000002,
+ "east":120.68788
+ },
+ "copyrights":"地圖資料©2018 Google",
+ "legs":[
+ {
+ "distance":{
+ "text":"2.3 公里",
+ "value":2299
+ },
+ "duration":{
+ "text":"9 分",
+ "value":548
+ },
+ "end_address":"台灣台中市",
+ "end_location":{
+ "lat":24.147741,
+ "lng":120.67364240000006
+ },
+ "start_address":"400台灣台中市中區台灣大道一段1號",
+ "start_location":{
+ "lat":24.1381354,
+ "lng":120.68633
+ },
+ "steps":[
+ {
+ "distance":{
+ "text":"0.1 公里",
+ "value":145
+ },
+ "duration":{
+ "text":"1 分",
+ "value":22
+ },
+ "end_location":{
+ "lat":24.1381375,
+ "lng":120.68775959999994
+ },
+ "polyline":{
+ "points":"knirCqpr_V?Q?cA?O@Q@U@k@CqAAQ"
+ },
+ "start_location":{
+ "lat":24.1381354,
+ "lng":120.68633
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"knirCqpr_V?Q?cA?O@Q@U@k@CqAAQ",
+ "path":[
+ {
+ "lat":24.138140000000003,
+ "lng":120.68633000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68642000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68676
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68684
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68693
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68704000000001
+ },
+ {
+ "lat":24.13811,
+ "lng":120.68726000000001
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68767000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68776000000001
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.138140000000003,
+ "lng":120.68633000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68642000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68676
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68684
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68693
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68704000000001
+ },
+ {
+ "lat":24.13811,
+ "lng":120.68726000000001
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68767000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68776000000001
+ }
+ ],
+ "instructions":"往東走新民街朝八德街前進",
+ "maneuver":"",
+ "start_point":{
+ "lat":24.1381354,
+ "lng":120.68633
+ },
+ "end_point":{
+ "lat":24.1381375,
+ "lng":120.68775959999994
+ }
+ },
+ {
+ "distance":{
+ "text":"0.2 公里",
+ "value":223
+ },
+ "duration":{
+ "text":"1 分",
+ "value":43
+ },
+ "end_location":{
+ "lat":24.1401431,
+ "lng":120.68787969999994
+ },
+ "maneuver":"turn-left",
+ "polyline":{
+ "points":"knirCoyr_Vw@EwAEiAAk@CW?qBE"
+ },
+ "start_location":{
+ "lat":24.1381375,
+ "lng":120.68775959999994
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"knirCoyr_Vw@EwAEiAAk@CW?qBE",
+ "path":[
+ {
+ "lat":24.138140000000003,
+ "lng":120.68776000000001
+ },
+ {
+ "lat":24.138420000000004,
+ "lng":120.68779
+ },
+ {
+ "lat":24.13886,
+ "lng":120.68782000000002
+ },
+ {
+ "lat":24.13923,
+ "lng":120.68783
+ },
+ {
+ "lat":24.139450000000004,
+ "lng":120.68785000000001
+ },
+ {
+ "lat":24.139570000000003,
+ "lng":120.68785000000001
+ },
+ {
+ "lat":24.140140000000002,
+ "lng":120.68788
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.138140000000003,
+ "lng":120.68776000000001
+ },
+ {
+ "lat":24.138420000000004,
+ "lng":120.68779
+ },
+ {
+ "lat":24.13886,
+ "lng":120.68782000000002
+ },
+ {
+ "lat":24.13923,
+ "lng":120.68783
+ },
+ {
+ "lat":24.139450000000004,
+ "lng":120.68785000000001
+ },
+ {
+ "lat":24.139570000000003,
+ "lng":120.68785000000001
+ },
+ {
+ "lat":24.140140000000002,
+ "lng":120.68788
+ }
+ ],
+ "instructions":"於武德街向左轉",
+ "start_point":{
+ "lat":24.1381375,
+ "lng":120.68775959999994
+ },
+ "end_point":{
+ "lat":24.1401431,
+ "lng":120.68787969999994
+ }
+ },
+ {
+ "distance":{
+ "text":"0.2 公里",
+ "value":187
+ },
+ "duration":{
+ "text":"2 分",
+ "value":91
+ },
+ "end_location":{
+ "lat":24.1401309,
+ "lng":120.68603570000005
+ },
+ "maneuver":"turn-left",
+ "polyline":{
+ "points":"{zirCgzr_VCxBAzA?hAFnA"
+ },
+ "start_location":{
+ "lat":24.1401431,
+ "lng":120.68787969999994
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"{zirCgzr_VCxBAzA?hAFnA",
+ "path":[
+ {
+ "lat":24.140140000000002,
+ "lng":120.68788
+ },
+ {
+ "lat":24.14016,
+ "lng":120.68727000000001
+ },
+ {
+ "lat":24.14017,
+ "lng":120.68681000000001
+ },
+ {
+ "lat":24.14017,
+ "lng":120.68644
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68604
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.140140000000002,
+ "lng":120.68788
+ },
+ {
+ "lat":24.14016,
+ "lng":120.68727000000001
+ },
+ {
+ "lat":24.14017,
+ "lng":120.68681000000001
+ },
+ {
+ "lat":24.14017,
+ "lng":120.68644
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68604
+ }
+ ],
+ "instructions":"於南京路向左轉",
+ "start_point":{
+ "lat":24.1401431,
+ "lng":120.68787969999994
+ },
+ "end_point":{
+ "lat":24.1401309,
+ "lng":120.68603570000005
+ }
+ },
+ {
+ "distance":{
+ "text":"0.3 公里",
+ "value":303
+ },
+ "duration":{
+ "text":"1 分",
+ "value":81
+ },
+ "end_location":{
+ "lat":24.1415133,
+ "lng":120.68367869999997
+ },
+ "maneuver":"straight",
+ "polyline":{
+ "points":"yzirCwnr_V?X?N?r@Bz@gAdAcApAcBnBg@t@"
+ },
+ "start_location":{
+ "lat":24.1401309,
+ "lng":120.68603570000005
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"yzirCwnr_V?X?N?r@Bz@gAdAcApAcBnBg@t@",
+ "path":[
+ {
+ "lat":24.140130000000003,
+ "lng":120.68604
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68591
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68583000000001
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68557000000001
+ },
+ {
+ "lat":24.140110000000004,
+ "lng":120.68527000000002
+ },
+ {
+ "lat":24.14047,
+ "lng":120.68492
+ },
+ {
+ "lat":24.140810000000002,
+ "lng":120.68451
+ },
+ {
+ "lat":24.14131,
+ "lng":120.68395000000001
+ },
+ {
+ "lat":24.14151,
+ "lng":120.68368000000001
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.140130000000003,
+ "lng":120.68604
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68591
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68583000000001
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68557000000001
+ },
+ {
+ "lat":24.140110000000004,
+ "lng":120.68527000000002
+ },
+ {
+ "lat":24.14047,
+ "lng":120.68492
+ },
+ {
+ "lat":24.140810000000002,
+ "lng":120.68451
+ },
+ {
+ "lat":24.14131,
+ "lng":120.68395000000001
+ },
+ {
+ "lat":24.14151,
+ "lng":120.68368000000001
+ }
+ ],
+ "instructions":"繼續直行走光復路",
+ "start_point":{
+ "lat":24.1401309,
+ "lng":120.68603570000005
+ },
+ "end_point":{
+ "lat":24.1415133,
+ "lng":120.68367869999997
+ }
+ },
+ {
+ "distance":{
+ "text":"0.2 公里",
+ "value":216
+ },
+ "duration":{
+ "text":"1 分",
+ "value":62
+ },
+ "end_location":{
+ "lat":24.1401116,
+ "lng":120.68221169999993
+ },
+ "maneuver":"turn-left",
+ "polyline":{
+ "points":"mcjrC_`r_Vp@t@zAxA|@dAjAnA"
+ },
+ "start_location":{
+ "lat":24.1415133,
+ "lng":120.68367869999997
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"mcjrC_`r_Vp@t@zAxA|@dAjAnA",
+ "path":[
+ {
+ "lat":24.14151,
+ "lng":120.68368000000001
+ },
+ {
+ "lat":24.141260000000003,
+ "lng":120.68341000000001
+ },
+ {
+ "lat":24.140800000000002,
+ "lng":120.68296000000001
+ },
+ {
+ "lat":24.140490000000003,
+ "lng":120.68261000000001
+ },
+ {
+ "lat":24.140110000000004,
+ "lng":120.68221000000001
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.14151,
+ "lng":120.68368000000001
+ },
+ {
+ "lat":24.141260000000003,
+ "lng":120.68341000000001
+ },
+ {
+ "lat":24.140800000000002,
+ "lng":120.68296000000001
+ },
+ {
+ "lat":24.140490000000003,
+ "lng":120.68261000000001
+ },
+ {
+ "lat":24.140110000000004,
+ "lng":120.68221000000001
+ }
+ ],
+ "instructions":"經過港口土鮀鱼羹 (位於左側) 後向左轉",
+ "start_point":{
+ "lat":24.1415133,
+ "lng":120.68367869999997
+ },
+ "end_point":{
+ "lat":24.1401116,
+ "lng":120.68221169999993
+ }
+ },
+ {
+ "distance":{
+ "text":"1.2 公里",
+ "value":1202
+ },
+ "duration":{
+ "text":"4 分",
+ "value":244
+ },
+ "end_location":{
+ "lat":24.1475623,
+ "lng":120.67364250000003
+ },
+ "maneuver":"turn-right",
+ "polyline":{
+ "points":"uzirCyvq_VkApAKNu@`AcAlAaAfAk@r@MNeAlA{@fAyBlCk@l@iB~By@`A[Xc@d@]d@EDsAjBeBhBo@x@e@l@eAnAA@yA~AiAdBwA|A"
+ },
+ "start_location":{
+ "lat":24.1401116,
+ "lng":120.68221169999993
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"uzirCyvq_VkApAKNu@`AcAlAaAfAk@r@MNeAlA{@fAyBlCk@l@iB~By@`A[Xc@d@]d@EDsAjBeBhBo@x@e@l@eAnAA@yA~AiAdBwA|A",
+ "path":[
+ {
+ "lat":24.140110000000004,
+ "lng":120.68221000000001
+ },
+ {
+ "lat":24.140490000000003,
+ "lng":120.68180000000001
+ },
+ {
+ "lat":24.14055,
+ "lng":120.68172000000001
+ },
+ {
+ "lat":24.14082,
+ "lng":120.68139000000001
+ },
+ {
+ "lat":24.141160000000003,
+ "lng":120.68100000000001
+ },
+ {
+ "lat":24.14149,
+ "lng":120.68064000000001
+ },
+ {
+ "lat":24.141710000000003,
+ "lng":120.68038000000001
+ },
+ {
+ "lat":24.14178,
+ "lng":120.68030000000002
+ },
+ {
+ "lat":24.14213,
+ "lng":120.67991
+ },
+ {
+ "lat":24.14243,
+ "lng":120.67955
+ },
+ {
+ "lat":24.143040000000003,
+ "lng":120.67884000000001
+ },
+ {
+ "lat":24.14326,
+ "lng":120.67861
+ },
+ {
+ "lat":24.143790000000003,
+ "lng":120.67797000000002
+ },
+ {
+ "lat":24.144080000000002,
+ "lng":120.67764000000001
+ },
+ {
+ "lat":24.14422,
+ "lng":120.67751000000001
+ },
+ {
+ "lat":24.1444,
+ "lng":120.67732000000001
+ },
+ {
+ "lat":24.144550000000002,
+ "lng":120.67713
+ },
+ {
+ "lat":24.14458,
+ "lng":120.67710000000001
+ },
+ {
+ "lat":24.145000000000003,
+ "lng":120.67656000000001
+ },
+ {
+ "lat":24.14551,
+ "lng":120.67603000000001
+ },
+ {
+ "lat":24.145750000000003,
+ "lng":120.67574
+ },
+ {
+ "lat":24.145940000000003,
+ "lng":120.67551000000002
+ },
+ {
+ "lat":24.14629,
+ "lng":120.67511
+ },
+ {
+ "lat":24.146300000000004,
+ "lng":120.67510000000001
+ },
+ {
+ "lat":24.14675,
+ "lng":120.67462
+ },
+ {
+ "lat":24.14712,
+ "lng":120.67411000000001
+ },
+ {
+ "lat":24.147560000000002,
+ "lng":120.67364
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.140110000000004,
+ "lng":120.68221000000001
+ },
+ {
+ "lat":24.140490000000003,
+ "lng":120.68180000000001
+ },
+ {
+ "lat":24.14055,
+ "lng":120.68172000000001
+ },
+ {
+ "lat":24.14082,
+ "lng":120.68139000000001
+ },
+ {
+ "lat":24.141160000000003,
+ "lng":120.68100000000001
+ },
+ {
+ "lat":24.14149,
+ "lng":120.68064000000001
+ },
+ {
+ "lat":24.141710000000003,
+ "lng":120.68038000000001
+ },
+ {
+ "lat":24.14178,
+ "lng":120.68030000000002
+ },
+ {
+ "lat":24.14213,
+ "lng":120.67991
+ },
+ {
+ "lat":24.14243,
+ "lng":120.67955
+ },
+ {
+ "lat":24.143040000000003,
+ "lng":120.67884000000001
+ },
+ {
+ "lat":24.14326,
+ "lng":120.67861
+ },
+ {
+ "lat":24.143790000000003,
+ "lng":120.67797000000002
+ },
+ {
+ "lat":24.144080000000002,
+ "lng":120.67764000000001
+ },
+ {
+ "lat":24.14422,
+ "lng":120.67751000000001
+ },
+ {
+ "lat":24.1444,
+ "lng":120.67732000000001
+ },
+ {
+ "lat":24.144550000000002,
+ "lng":120.67713
+ },
+ {
+ "lat":24.14458,
+ "lng":120.67710000000001
+ },
+ {
+ "lat":24.145000000000003,
+ "lng":120.67656000000001
+ },
+ {
+ "lat":24.14551,
+ "lng":120.67603000000001
+ },
+ {
+ "lat":24.145750000000003,
+ "lng":120.67574
+ },
+ {
+ "lat":24.145940000000003,
+ "lng":120.67551000000002
+ },
+ {
+ "lat":24.14629,
+ "lng":120.67511
+ },
+ {
+ "lat":24.146300000000004,
+ "lng":120.67510000000001
+ },
+ {
+ "lat":24.14675,
+ "lng":120.67462
+ },
+ {
+ "lat":24.14712,
+ "lng":120.67411000000001
+ },
+ {
+ "lat":24.147560000000002,
+ "lng":120.67364
+ }
+ ],
+ "instructions":"於台灣大道一段/台12線向右轉
經過岱妮蠶絲 自由門市(位於右手邊)
",
+ "start_point":{
+ "lat":24.1401116,
+ "lng":120.68221169999993
+ },
+ "end_point":{
+ "lat":24.1475623,
+ "lng":120.67364250000003
+ }
+ },
+ {
+ "distance":{
+ "text":"23 公尺",
+ "value":23
+ },
+ "duration":{
+ "text":"1 分",
+ "value":5
+ },
+ "end_location":{
+ "lat":24.147741,
+ "lng":120.67364240000006
+ },
+ "maneuver":"turn-right",
+ "polyline":{
+ "points":"gikrCgap_VYHII"
+ },
+ "start_location":{
+ "lat":24.1475623,
+ "lng":120.67364250000003
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"gikrCgap_VYHII",
+ "path":[
+ {
+ "lat":24.147560000000002,
+ "lng":120.67364
+ },
+ {
+ "lat":24.14769,
+ "lng":120.67359
+ },
+ {
+ "lat":24.147740000000002,
+ "lng":120.67364
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.147560000000002,
+ "lng":120.67364
+ },
+ {
+ "lat":24.14769,
+ "lng":120.67359
+ },
+ {
+ "lat":24.147740000000002,
+ "lng":120.67364
+ }
+ ],
+ "instructions":"於五權路/台1乙線向右轉",
+ "start_point":{
+ "lat":24.1475623,
+ "lng":120.67364250000003
+ },
+ "end_point":{
+ "lat":24.147741,
+ "lng":120.67364240000006
+ }
+ }
+ ],
+ "traffic_speed_entry":[
+
+ ],
+ "via_waypoint":[
+
+ ],
+ "via_waypoints":[
+
+ ]
+ }
+ ],
+ "overview_polyline":"knirCqpr_V?uA@a@BaAEcBoCKuBEiCEEtE?hAFnA?h@BnBgAdAcApAcBnBg@t@lCnChCtCwA`ByBnCmBzBsA|AuDtEk@l@iB~BuAzAaAjAyApBeBhBo@x@kB|B{A`BiAdBwA|AYHII",
+ "summary":"台灣大道一段/台12線",
+ "warnings":[
+
+ ],
+ "waypoint_order":[
+
+ ],
+ "overview_path":[
+ {
+ "lat":24.138140000000003,
+ "lng":120.68633000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68676
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68693
+ },
+ {
+ "lat":24.13811,
+ "lng":120.68726000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68776000000001
+ },
+ {
+ "lat":24.13886,
+ "lng":120.68782000000002
+ },
+ {
+ "lat":24.139450000000004,
+ "lng":120.68785000000001
+ },
+ {
+ "lat":24.140140000000002,
+ "lng":120.68788
+ },
+ {
+ "lat":24.14017,
+ "lng":120.68681000000001
+ },
+ {
+ "lat":24.14017,
+ "lng":120.68644
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68604
+ },
+ {
+ "lat":24.140130000000003,
+ "lng":120.68583000000001
+ },
+ {
+ "lat":24.140110000000004,
+ "lng":120.68527000000002
+ },
+ {
+ "lat":24.14047,
+ "lng":120.68492
+ },
+ {
+ "lat":24.140810000000002,
+ "lng":120.68451
+ },
+ {
+ "lat":24.14131,
+ "lng":120.68395000000001
+ },
+ {
+ "lat":24.14151,
+ "lng":120.68368000000001
+ },
+ {
+ "lat":24.140800000000002,
+ "lng":120.68296000000001
+ },
+ {
+ "lat":24.140110000000004,
+ "lng":120.68221000000001
+ },
+ {
+ "lat":24.14055,
+ "lng":120.68172000000001
+ },
+ {
+ "lat":24.141160000000003,
+ "lng":120.68100000000001
+ },
+ {
+ "lat":24.141710000000003,
+ "lng":120.68038000000001
+ },
+ {
+ "lat":24.14213,
+ "lng":120.67991
+ },
+ {
+ "lat":24.143040000000003,
+ "lng":120.67884000000001
+ },
+ {
+ "lat":24.14326,
+ "lng":120.67861
+ },
+ {
+ "lat":24.143790000000003,
+ "lng":120.67797000000002
+ },
+ {
+ "lat":24.14422,
+ "lng":120.67751000000001
+ },
+ {
+ "lat":24.144550000000002,
+ "lng":120.67713
+ },
+ {
+ "lat":24.145000000000003,
+ "lng":120.67656000000001
+ },
+ {
+ "lat":24.14551,
+ "lng":120.67603000000001
+ },
+ {
+ "lat":24.145750000000003,
+ "lng":120.67574
+ },
+ {
+ "lat":24.14629,
+ "lng":120.67511
+ },
+ {
+ "lat":24.14675,
+ "lng":120.67462
+ },
+ {
+ "lat":24.14712,
+ "lng":120.67411000000001
+ },
+ {
+ "lat":24.147560000000002,
+ "lng":120.67364
+ },
+ {
+ "lat":24.14769,
+ "lng":120.67359
+ },
+ {
+ "lat":24.147740000000002,
+ "lng":120.67364
+ }
+ ]
+ }
+ ],
+ "status":"OK",
+ "request":{
+ "origin":{
+ "query":"Taichung Main Station"
+ },
+ "destination":{
+ "query":"Taichung City Government"
+ },
+ "travelMode":"DRIVING",
+ "waypoints":[
+
+ ],
+ "optimizeWaypoints":true,
+ "provideRouteAlternatives":false,
+ "avoidHighways":false,
+ "avoidTolls":false
+ }
+}
\ No newline at end of file
diff --git a/playground/src/assets/data2.json b/playground/src/assets/data2.json
new file mode 100644
index 0000000..1820dac
--- /dev/null
+++ b/playground/src/assets/data2.json
@@ -0,0 +1,831 @@
+{
+ "geocoded_waypoints":[
+ {
+ "geocoder_status":"OK",
+ "place_id":"ChIJYeBiz2g9aTQRNmI_J3PdkXA",
+ "types":[
+ "establishment",
+ "point_of_interest",
+ "university"
+ ]
+ },
+ {
+ "geocoder_status":"OK",
+ "place_id":"ChIJPz37OBQ9aTQRtgYZL9DrtLc",
+ "types":[
+ "establishment",
+ "point_of_interest",
+ "train_station",
+ "transit_station"
+ ]
+ }
+ ],
+ "routes":[
+ {
+ "bounds":{
+ "south":24.13812,
+ "west":120.68027000000001,
+ "north":24.149960000000004,
+ "east":120.68633000000001
+ },
+ "copyrights":"地圖資料©2018 Google",
+ "legs":[
+ {
+ "distance":{
+ "text":"1.7 公里",
+ "value":1704
+ },
+ "duration":{
+ "text":"8 分",
+ "value":452
+ },
+ "end_address":"400台灣台中市中區台灣大道一段1號",
+ "end_location":{
+ "lat":24.1381354,
+ "lng":120.68633
+ },
+ "start_address":"404台灣台中市北區三民路三段129號",
+ "start_location":{
+ "lat":24.149964,
+ "lng":120.68412379999995
+ },
+ "steps":[
+ {
+ "distance":{
+ "text":"0.6 公里",
+ "value":638
+ },
+ "duration":{
+ "text":"2 分",
+ "value":149
+ },
+ "end_location":{
+ "lat":24.1446616,
+ "lng":120.68173520000005
+ },
+ "polyline":{
+ "points":"gxkrCwbr_VND^Lp@RhA^VHd@P~Af@xC|@h@PVHh@LlDdAt@XB@nAf@`@Rn@ZXNn@\\"
+ },
+ "start_location":{
+ "lat":24.149964,
+ "lng":120.68412379999995
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"gxkrCwbr_VND^Lp@RhA^VHd@P~Af@xC|@h@PVHh@LlDdAt@XB@nAf@`@Rn@ZXNn@\\",
+ "path":[
+ {
+ "lat":24.149960000000004,
+ "lng":120.68412000000001
+ },
+ {
+ "lat":24.149880000000003,
+ "lng":120.68409000000001
+ },
+ {
+ "lat":24.149720000000002,
+ "lng":120.68402
+ },
+ {
+ "lat":24.14947,
+ "lng":120.68392000000001
+ },
+ {
+ "lat":24.1491,
+ "lng":120.68376
+ },
+ {
+ "lat":24.14898,
+ "lng":120.68371
+ },
+ {
+ "lat":24.14879,
+ "lng":120.68362
+ },
+ {
+ "lat":24.148310000000002,
+ "lng":120.68342000000001
+ },
+ {
+ "lat":24.147540000000003,
+ "lng":120.68311000000001
+ },
+ {
+ "lat":24.147330000000004,
+ "lng":120.68302000000001
+ },
+ {
+ "lat":24.14721,
+ "lng":120.68297000000001
+ },
+ {
+ "lat":24.147000000000002,
+ "lng":120.6829
+ },
+ {
+ "lat":24.146130000000003,
+ "lng":120.68255
+ },
+ {
+ "lat":24.145860000000003,
+ "lng":120.68242000000001
+ },
+ {
+ "lat":24.145840000000003,
+ "lng":120.68241
+ },
+ {
+ "lat":24.14544,
+ "lng":120.68221000000001
+ },
+ {
+ "lat":24.145270000000004,
+ "lng":120.68211000000001
+ },
+ {
+ "lat":24.145030000000002,
+ "lng":120.68197
+ },
+ {
+ "lat":24.144900000000003,
+ "lng":120.68189000000001
+ },
+ {
+ "lat":24.144660000000002,
+ "lng":120.68174
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.149960000000004,
+ "lng":120.68412000000001
+ },
+ {
+ "lat":24.149880000000003,
+ "lng":120.68409000000001
+ },
+ {
+ "lat":24.149720000000002,
+ "lng":120.68402
+ },
+ {
+ "lat":24.14947,
+ "lng":120.68392000000001
+ },
+ {
+ "lat":24.1491,
+ "lng":120.68376
+ },
+ {
+ "lat":24.14898,
+ "lng":120.68371
+ },
+ {
+ "lat":24.14879,
+ "lng":120.68362
+ },
+ {
+ "lat":24.148310000000002,
+ "lng":120.68342000000001
+ },
+ {
+ "lat":24.147540000000003,
+ "lng":120.68311000000001
+ },
+ {
+ "lat":24.147330000000004,
+ "lng":120.68302000000001
+ },
+ {
+ "lat":24.14721,
+ "lng":120.68297000000001
+ },
+ {
+ "lat":24.147000000000002,
+ "lng":120.6829
+ },
+ {
+ "lat":24.146130000000003,
+ "lng":120.68255
+ },
+ {
+ "lat":24.145860000000003,
+ "lng":120.68242000000001
+ },
+ {
+ "lat":24.145840000000003,
+ "lng":120.68241
+ },
+ {
+ "lat":24.14544,
+ "lng":120.68221000000001
+ },
+ {
+ "lat":24.145270000000004,
+ "lng":120.68211000000001
+ },
+ {
+ "lat":24.145030000000002,
+ "lng":120.68197
+ },
+ {
+ "lat":24.144900000000003,
+ "lng":120.68189000000001
+ },
+ {
+ "lat":24.144660000000002,
+ "lng":120.68174
+ }
+ ],
+ "instructions":"往南走三民路三段朝育才街前進",
+ "maneuver":"",
+ "start_point":{
+ "lat":24.149964,
+ "lng":120.68412379999995
+ },
+ "end_point":{
+ "lat":24.1446616,
+ "lng":120.68173520000005
+ }
+ },
+ {
+ "distance":{
+ "text":"0.2 公里",
+ "value":226
+ },
+ "duration":{
+ "text":"1 分",
+ "value":47
+ },
+ "end_location":{
+ "lat":24.1431426,
+ "lng":120.68027289999998
+ },
+ "polyline":{
+ "points":"cwjrC{sq_V\\LZZ\\Zz@z@JLfAjAfAhA"
+ },
+ "start_location":{
+ "lat":24.1446616,
+ "lng":120.68173520000005
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"cwjrC{sq_V\\LZZ\\Zz@z@JLfAjAfAhA",
+ "path":[
+ {
+ "lat":24.144660000000002,
+ "lng":120.68174
+ },
+ {
+ "lat":24.14451,
+ "lng":120.68167000000001
+ },
+ {
+ "lat":24.144370000000002,
+ "lng":120.68153000000001
+ },
+ {
+ "lat":24.14422,
+ "lng":120.68139000000001
+ },
+ {
+ "lat":24.14392,
+ "lng":120.68109000000001
+ },
+ {
+ "lat":24.143860000000004,
+ "lng":120.68102
+ },
+ {
+ "lat":24.143500000000003,
+ "lng":120.68064000000001
+ },
+ {
+ "lat":24.143140000000002,
+ "lng":120.68027000000001
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.144660000000002,
+ "lng":120.68174
+ },
+ {
+ "lat":24.14451,
+ "lng":120.68167000000001
+ },
+ {
+ "lat":24.144370000000002,
+ "lng":120.68153000000001
+ },
+ {
+ "lat":24.14422,
+ "lng":120.68139000000001
+ },
+ {
+ "lat":24.14392,
+ "lng":120.68109000000001
+ },
+ {
+ "lat":24.143860000000004,
+ "lng":120.68102
+ },
+ {
+ "lat":24.143500000000003,
+ "lng":120.68064000000001
+ },
+ {
+ "lat":24.143140000000002,
+ "lng":120.68027000000001
+ }
+ ],
+ "instructions":"接著走三民路二段",
+ "maneuver":"",
+ "start_point":{
+ "lat":24.1446616,
+ "lng":120.68173520000005
+ },
+ "end_point":{
+ "lat":24.1431426,
+ "lng":120.68027289999998
+ }
+ },
+ {
+ "distance":{
+ "text":"0.8 公里",
+ "value":754
+ },
+ "duration":{
+ "text":"4 分",
+ "value":228
+ },
+ "end_location":{
+ "lat":24.1384433,
+ "lng":120.68560830000001
+ },
+ "maneuver":"turn-left",
+ "polyline":{
+ "points":"smjrCujq_Vz@eAfAqAv@_AbAmAHEFGRYRWHOdBqBh@q@fAqAjAkAx@kAz@gAh@y@@?tAoAj@s@^a@"
+ },
+ "start_location":{
+ "lat":24.1431426,
+ "lng":120.68027289999998
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"smjrCujq_Vz@eAfAqAv@_AbAmAHEFGRYRWHOdBqBh@q@fAqAjAkAx@kAz@gAh@y@@?tAoAj@s@^a@",
+ "path":[
+ {
+ "lat":24.143140000000002,
+ "lng":120.68027000000001
+ },
+ {
+ "lat":24.142840000000003,
+ "lng":120.68062
+ },
+ {
+ "lat":24.142480000000003,
+ "lng":120.68103
+ },
+ {
+ "lat":24.142200000000003,
+ "lng":120.68135000000001
+ },
+ {
+ "lat":24.14186,
+ "lng":120.68174
+ },
+ {
+ "lat":24.141810000000003,
+ "lng":120.68177000000001
+ },
+ {
+ "lat":24.14177,
+ "lng":120.68181000000001
+ },
+ {
+ "lat":24.14167,
+ "lng":120.68194000000001
+ },
+ {
+ "lat":24.14157,
+ "lng":120.68206
+ },
+ {
+ "lat":24.141520000000003,
+ "lng":120.68214
+ },
+ {
+ "lat":24.14101,
+ "lng":120.68271000000001
+ },
+ {
+ "lat":24.140800000000002,
+ "lng":120.68296000000001
+ },
+ {
+ "lat":24.14044,
+ "lng":120.68337000000001
+ },
+ {
+ "lat":24.140060000000002,
+ "lng":120.68375
+ },
+ {
+ "lat":24.139770000000002,
+ "lng":120.68413000000001
+ },
+ {
+ "lat":24.139470000000003,
+ "lng":120.68449000000001
+ },
+ {
+ "lat":24.139260000000004,
+ "lng":120.68478
+ },
+ {
+ "lat":24.13925,
+ "lng":120.68478
+ },
+ {
+ "lat":24.138820000000003,
+ "lng":120.68518000000002
+ },
+ {
+ "lat":24.1386,
+ "lng":120.68544000000001
+ },
+ {
+ "lat":24.138440000000003,
+ "lng":120.68561000000001
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.143140000000002,
+ "lng":120.68027000000001
+ },
+ {
+ "lat":24.142840000000003,
+ "lng":120.68062
+ },
+ {
+ "lat":24.142480000000003,
+ "lng":120.68103
+ },
+ {
+ "lat":24.142200000000003,
+ "lng":120.68135000000001
+ },
+ {
+ "lat":24.14186,
+ "lng":120.68174
+ },
+ {
+ "lat":24.141810000000003,
+ "lng":120.68177000000001
+ },
+ {
+ "lat":24.14177,
+ "lng":120.68181000000001
+ },
+ {
+ "lat":24.14167,
+ "lng":120.68194000000001
+ },
+ {
+ "lat":24.14157,
+ "lng":120.68206
+ },
+ {
+ "lat":24.141520000000003,
+ "lng":120.68214
+ },
+ {
+ "lat":24.14101,
+ "lng":120.68271000000001
+ },
+ {
+ "lat":24.140800000000002,
+ "lng":120.68296000000001
+ },
+ {
+ "lat":24.14044,
+ "lng":120.68337000000001
+ },
+ {
+ "lat":24.140060000000002,
+ "lng":120.68375
+ },
+ {
+ "lat":24.139770000000002,
+ "lng":120.68413000000001
+ },
+ {
+ "lat":24.139470000000003,
+ "lng":120.68449000000001
+ },
+ {
+ "lat":24.139260000000004,
+ "lng":120.68478
+ },
+ {
+ "lat":24.13925,
+ "lng":120.68478
+ },
+ {
+ "lat":24.138820000000003,
+ "lng":120.68518000000002
+ },
+ {
+ "lat":24.1386,
+ "lng":120.68544000000001
+ },
+ {
+ "lat":24.138440000000003,
+ "lng":120.68561000000001
+ }
+ ],
+ "instructions":"於成功路向左轉經過85度C咖啡蛋糕(位於左手邊 350 公尺)
",
+ "start_point":{
+ "lat":24.1431426,
+ "lng":120.68027289999998
+ },
+ "end_point":{
+ "lat":24.1384433,
+ "lng":120.68560830000001
+ }
+ },
+ {
+ "distance":{
+ "text":"59 公尺",
+ "value":59
+ },
+ "duration":{
+ "text":"1 分",
+ "value":20
+ },
+ "end_location":{
+ "lat":24.1381258,
+ "lng":120.68606750000004
+ },
+ "maneuver":"straight",
+ "polyline":{
+ "points":"gpirCalr_VHMn@eABG"
+ },
+ "start_location":{
+ "lat":24.1384433,
+ "lng":120.68560830000001
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"gpirCalr_VHMn@eABG",
+ "path":[
+ {
+ "lat":24.138440000000003,
+ "lng":120.68561000000001
+ },
+ {
+ "lat":24.13839,
+ "lng":120.68568
+ },
+ {
+ "lat":24.138150000000003,
+ "lng":120.68603000000002
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68607000000002
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.138440000000003,
+ "lng":120.68561000000001
+ },
+ {
+ "lat":24.13839,
+ "lng":120.68568
+ },
+ {
+ "lat":24.138150000000003,
+ "lng":120.68603000000002
+ },
+ {
+ "lat":24.13813,
+ "lng":120.68607000000002
+ }
+ ],
+ "instructions":"繼續直行,並繼續走成功路",
+ "start_point":{
+ "lat":24.1384433,
+ "lng":120.68560830000001
+ },
+ "end_point":{
+ "lat":24.1381258,
+ "lng":120.68606750000004
+ }
+ },
+ {
+ "distance":{
+ "text":"27 公尺",
+ "value":27
+ },
+ "duration":{
+ "text":"1 分",
+ "value":8
+ },
+ "end_location":{
+ "lat":24.1381354,
+ "lng":120.68633
+ },
+ "polyline":{
+ "points":"inirC}nr_V@C?ECi@"
+ },
+ "start_location":{
+ "lat":24.1381258,
+ "lng":120.68606750000004
+ },
+ "travel_mode":"DRIVING",
+ "encoded_lat_lngs":"inirC}nr_V@C?ECi@",
+ "path":[
+ {
+ "lat":24.13813,
+ "lng":120.68607000000002
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68609000000001
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68612000000002
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68633000000001
+ }
+ ],
+ "lat_lngs":[
+ {
+ "lat":24.13813,
+ "lng":120.68607000000002
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68609000000001
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68612000000002
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68633000000001
+ }
+ ],
+ "instructions":"從成功路靠左行駛,進入新民街",
+ "maneuver":"",
+ "start_point":{
+ "lat":24.1381258,
+ "lng":120.68606750000004
+ },
+ "end_point":{
+ "lat":24.1381354,
+ "lng":120.68633
+ }
+ }
+ ],
+ "traffic_speed_entry":[
+
+ ],
+ "via_waypoint":[
+
+ ],
+ "via_waypoints":[
+
+ ]
+ }
+ ],
+ "overview_polyline":"gxkrCwbr_VbNhExGnBjDvAhAj@n@\\\\Lx@v@fAhAnCtCbCwClC{Cf@q@HOdBqBpBcCjAkAx@kAdBaCvAoAjAuAx@sADKCo@",
+ "summary":"三民路三段和成功路",
+ "warnings":[
+
+ ],
+ "waypoint_order":[
+
+ ],
+ "overview_path":[
+ {
+ "lat":24.149960000000004,
+ "lng":120.68412000000001
+ },
+ {
+ "lat":24.147540000000003,
+ "lng":120.68311000000001
+ },
+ {
+ "lat":24.146130000000003,
+ "lng":120.68255
+ },
+ {
+ "lat":24.145270000000004,
+ "lng":120.68211000000001
+ },
+ {
+ "lat":24.144900000000003,
+ "lng":120.68189000000001
+ },
+ {
+ "lat":24.144660000000002,
+ "lng":120.68174
+ },
+ {
+ "lat":24.14451,
+ "lng":120.68167000000001
+ },
+ {
+ "lat":24.14422,
+ "lng":120.68139000000001
+ },
+ {
+ "lat":24.143860000000004,
+ "lng":120.68102
+ },
+ {
+ "lat":24.143140000000002,
+ "lng":120.68027000000001
+ },
+ {
+ "lat":24.142480000000003,
+ "lng":120.68103
+ },
+ {
+ "lat":24.14177,
+ "lng":120.68181000000001
+ },
+ {
+ "lat":24.14157,
+ "lng":120.68206
+ },
+ {
+ "lat":24.141520000000003,
+ "lng":120.68214
+ },
+ {
+ "lat":24.14101,
+ "lng":120.68271000000001
+ },
+ {
+ "lat":24.14044,
+ "lng":120.68337000000001
+ },
+ {
+ "lat":24.140060000000002,
+ "lng":120.68375
+ },
+ {
+ "lat":24.139770000000002,
+ "lng":120.68413000000001
+ },
+ {
+ "lat":24.139260000000004,
+ "lng":120.68478
+ },
+ {
+ "lat":24.138820000000003,
+ "lng":120.68518000000002
+ },
+ {
+ "lat":24.138440000000003,
+ "lng":120.68561000000001
+ },
+ {
+ "lat":24.138150000000003,
+ "lng":120.68603000000002
+ },
+ {
+ "lat":24.13812,
+ "lng":120.68609000000001
+ },
+ {
+ "lat":24.138140000000003,
+ "lng":120.68633000000001
+ }
+ ]
+ }
+ ],
+ "status":"OK",
+ "request":{
+ "origin":{
+ "query":"Taichung University of Science and Technology"
+ },
+ "destination":{
+ "query":"Taichung Main Station"
+ },
+ "travelMode":"DRIVING",
+ "waypoints":[
+
+ ],
+ "optimizeWaypoints":true,
+ "provideRouteAlternatives":false,
+ "avoidHighways":false,
+ "avoidTolls":false
+ }
+}
\ No newline at end of file