How to add click listener on polyline of google map


#1

Hi All,

I add polyline to map and then add listener on it to monitor click event, but I tried ‘POLYLINE_CLICK’, ‘MAP_CLICK’, ‘OVERLAY_CLICK’, none of them works, how should I do this, thanks.

        this.mainMap.addPolyline({
            points: points,
            fillColor: '#19A2E9',
            strokeColor: '#2C9ED8',
            'width': 10,
            clickable: true

        }).then(tripPolygon => {

            **tripPolygon.on(GoogleMapsEvent.MAP_CLICK).subscribe(()=>{**
                console.log('clicked me !!!!');    
            });
     });

#2

Use GoogleMapsEvent.POLYLINE_CLICK instead ofGoogleMapsEvent.MAP_CLICK


#3

I tried but nothing captured


#4

one thing is I should put evevt on map object or polyline object ? I mean I should do map.on(event,function)or polylineInstance.on(event,function)? thanks


#5

tried so many things, but does not work.

Tried POLYLINE_CLICK, MAP_CLICK, OVERLAY_CLICK, but looks like nothing captured. where is wrong, any help, thanks.

        this.mainMap.addPolyline({
            points: points,
            fillColor: '#19A2E9',
            strokeColor: '#2C9ED8',
            'width': 10,
            clickable: true

        }).then(tripPolygon => {

            console.log('trip poly gon clickable is '+tripPolygon.getClickable());
            tripPolygon.on(GoogleMapsEvent.POLYLINE_CLICK).subscribe(()=>{
                console.log('clicked me !!!!');    
            });

});


#6

Please share your project files on GitHub.


#7

===========update , the following reply inforamtion is not right, need to test it further. =============

Hi mate, thanks for your kindly help.
I simplified my project and finally I found the real reason.

The reason is because on the polyLine there are too many points and most of time you click on the points but not polyline, so the POLYLINE_CLICK event can not be fired.

So which event I should capture when the POLYLINE CLICKED?thanks

try the code :

------------- only 3 points to make polyline , which is working------------------
let points = [{“lat”:-33.76869,“lng”:151.0368},{“lat”:-33.81477,“lng”:151.00173},{“lat”:-33.81467,“lng”:151.00127}];

                console.log(JSON.stringify(points));
                
                this.mainMap.addPolyline({
                    points: points,
                    fillColor: '#19A2E9',
                    strokeColor: '#2C9ED8',
                    'width': 10,
                    clickable: true
    
                }).then(tripPolygon => {
                        tripPolygon.on(GoogleMapsEvent.POLYLINE_CLICK).subscribe(()=>{
                            console.log('you clicked me ');    
                        });
                });       

------------------- lots of points to make route smooth , but unable to capture the POLYLINE_CLICK-----------------

  let points = [{"lat":-33.76869,"lng":151.0368},{"lat":-33.7687,"lng":151.03676000000002},{"lat":-33.7687,"lng":151.03664},{"lat":-33.768710000000006,"lng":151.03654},{"lat":-33.768730000000005,"lng":151.03642000000002},{"lat":-33.76912,"lng":151.03400000000002},{"lat":-33.769130000000004,"lng":151.03398},{"lat":-33.769130000000004,"lng":151.03397},{"lat":-33.769130000000004,"lng":151.03396},{"lat":-33.76914,"lng":151.03395},{"lat":-33.76915,"lng":151.03395},{"lat":-33.76915,"lng":151.03394},{"lat":-33.76916,"lng":151.03394},{"lat":-33.76917,"lng":151.03394},{"lat":-33.76919,"lng":151.03393000000003},{"lat":-33.76921,"lng":151.03394},{"lat":-33.76924,"lng":151.03394},{"lat":-33.769290000000005,"lng":151.03395},{"lat":-33.76957,"lng":151.03400000000002},{"lat":-33.76957,"lng":151.03400000000002},{"lat":-33.76953,"lng":151.03325},{"lat":-33.769510000000004,"lng":151.03315},{"lat":-33.76946,"lng":151.03227},{"lat":-33.769450000000006,"lng":151.03216},{"lat":-33.76944,"lng":151.03211000000002},{"lat":-33.76943,"lng":151.03207},{"lat":-33.769420000000004,"lng":151.03202000000002},{"lat":-33.769400000000005,"lng":151.03196000000003},{"lat":-33.769380000000005,"lng":151.0319},{"lat":-33.76935,"lng":151.03184000000002},{"lat":-33.7693,"lng":151.03174},{"lat":-33.769220000000004,"lng":151.03159000000002},{"lat":-33.76907,"lng":151.03133000000003},{"lat":-33.76897,"lng":151.03115000000003},{"lat":-33.76897,"lng":151.03115000000003},{"lat":-33.769040000000004,"lng":151.03109},{"lat":-33.76907,"lng":151.03105000000002},{"lat":-33.76908,"lng":151.03103000000002},{"lat":-33.7691,"lng":151.031},{"lat":-33.76912,"lng":151.03096000000002},{"lat":-33.76914,"lng":151.03091},{"lat":-33.76916,"lng":151.03084},{"lat":-33.76917,"lng":151.03077000000002},{"lat":-33.76923,"lng":151.03046},{"lat":-33.7693,"lng":151.03015000000002},{"lat":-33.76937,"lng":151.02985},{"lat":-33.769400000000005,"lng":151.02974},{"lat":-33.76943,"lng":151.02961000000002},{"lat":-33.769450000000006,"lng":151.02955},{"lat":-33.769470000000005,"lng":151.02948},{"lat":-33.76948,"lng":151.02945000000003},{"lat":-33.7695,"lng":151.02942000000002},{"lat":-33.769510000000004,"lng":151.02939},{"lat":-33.76953,"lng":151.02937},{"lat":-33.76957,"lng":151.02932},{"lat":-33.76961,"lng":151.02927000000003},{"lat":-33.76962,"lng":151.02926000000002},{"lat":-33.769740000000006,"lng":151.02916000000002},{"lat":-33.769740000000006,"lng":151.02915000000002},{"lat":-33.76979,"lng":151.02911},{"lat":-33.76986,"lng":151.02905},{"lat":-33.770140000000005,"lng":151.02884},{"lat":-33.770880000000005,"lng":151.02822},{"lat":-33.771010000000004,"lng":151.02811000000003},{"lat":-33.77123,"lng":151.02793000000003},{"lat":-33.771640000000005,"lng":151.02762},{"lat":-33.77216,"lng":151.02720000000002},{"lat":-33.772360000000006,"lng":151.02704},{"lat":-33.772380000000005,"lng":151.02703000000002},{"lat":-33.77239,"lng":151.02701000000002},{"lat":-33.77241,"lng":151.02699},{"lat":-33.77243,"lng":151.02696},{"lat":-33.772450000000006,"lng":151.02692000000002},{"lat":-33.772490000000005,"lng":151.02688},{"lat":-33.77252,"lng":151.02686},{"lat":-33.77253,"lng":151.02685000000002},{"lat":-33.77254,"lng":151.02683000000002},{"lat":-33.77272,"lng":151.02669},{"lat":-33.772890000000004,"lng":151.02656000000002},{"lat":-33.772920000000006,"lng":151.02653},{"lat":-33.77295,"lng":151.02652},{"lat":-33.772980000000004,"lng":151.0265},{"lat":-33.77302,"lng":151.02648000000002},{"lat":-33.773070000000004,"lng":151.02646000000001},{"lat":-33.773120000000006,"lng":151.02644},{"lat":-33.77317,"lng":151.02642},{"lat":-33.773230000000005,"lng":151.02641},{"lat":-33.77329,"lng":151.02640000000002},{"lat":-33.77333,"lng":151.02640000000002},{"lat":-33.77337,"lng":151.02640000000002},{"lat":-33.773430000000005,"lng":151.02640000000002},{"lat":-33.7736,"lng":151.02640000000002},{"lat":-33.77365,"lng":151.02640000000002},{"lat":-33.77369,"lng":151.02640000000002},{"lat":-33.773720000000004,"lng":151.02640000000002},{"lat":-33.77375,"lng":151.02639000000002},{"lat":-33.7738,"lng":151.02639000000002},{"lat":-33.77385,"lng":151.02638000000002},{"lat":-33.77396,"lng":151.02635},{"lat":-33.774,"lng":151.02634},{"lat":-33.77405,"lng":151.02632},{"lat":-33.77416,"lng":151.02627},{"lat":-33.774240000000006,"lng":151.02623},{"lat":-33.774280000000005,"lng":151.02621000000002},{"lat":-33.774330000000006,"lng":151.02617},{"lat":-33.77451,"lng":151.02605000000003},{"lat":-33.7746,"lng":151.02596000000003},{"lat":-33.774710000000006,"lng":151.02586000000002},{"lat":-33.77479,"lng":151.02575000000002},{"lat":-33.77485,"lng":151.02568000000002},{"lat":-33.77487,"lng":151.02564},{"lat":-33.77492,"lng":151.02557000000002},{"lat":-33.77496,"lng":151.02551000000003},{"lat":-33.77498,"lng":151.02546},{"lat":-33.77501,"lng":151.02540000000002},{"lat":-33.775040000000004,"lng":151.02534},{"lat":-33.77507,"lng":151.02529},{"lat":-33.77508,"lng":151.02524000000003},{"lat":-33.7751,"lng":151.02519},{"lat":-33.775150000000004,"lng":151.02504000000002},{"lat":-33.775180000000006,"lng":151.02493},{"lat":-33.77519,"lng":151.02488000000002},{"lat":-33.775200000000005,"lng":151.02481},{"lat":-33.775220000000004,"lng":151.02471},{"lat":-33.77523,"lng":151.02453},{"lat":-33.77523,"lng":151.02442000000002},{"lat":-33.77523,"lng":151.02431},{"lat":-33.77523,"lng":151.02427},{"lat":-33.77523,"lng":151.02423000000002},{"lat":-33.775220000000004,"lng":151.02416000000002},{"lat":-33.775220000000004,"lng":151.02411},{"lat":-33.775220000000004,"lng":151.02411},{"lat":-33.77521,"lng":151.02406000000002},{"lat":-33.77521,"lng":151.02403},{"lat":-33.775200000000005,"lng":151.024},{"lat":-33.77519,"lng":151.02397000000002},{"lat":-33.775180000000006,"lng":151.02395},{"lat":-33.77514,"lng":151.02386},{"lat":-33.775110000000005,"lng":151.02378000000002},{"lat":-33.77508,"lng":151.02369000000002},{"lat":-33.77508,"lng":151.02366},{"lat":-33.7751,"lng":151.02359},{"lat":-33.775110000000005,"lng":151.02354000000003},{"lat":-33.77512,"lng":151.02344000000002},{"lat":-33.775110000000005,"lng":151.02336000000003},{"lat":-33.7751,"lng":151.02327000000002},{"lat":-33.775090000000006,"lng":151.0231},{"lat":-33.77506,"lng":151.02267},{"lat":-33.77503,"lng":151.02224},{"lat":-33.77501,"lng":151.02198},{"lat":-33.77501,"lng":151.02193000000003},{"lat":-33.77501,"lng":151.02166000000003},{"lat":-33.77501,"lng":151.02138000000002},{"lat":-33.77501,"lng":151.02085000000002},{"lat":-33.775020000000005,"lng":151.02023000000003},{"lat":-33.775020000000005,"lng":151.01986000000002},{"lat":-33.77503,"lng":151.01951000000003},{"lat":-33.77503,"lng":151.0192},{"lat":-33.775040000000004,"lng":151.01866},{"lat":-33.775040000000004,"lng":151.01835000000003},{"lat":-33.77505,"lng":151.0181},{"lat":-33.77507,"lng":151.01701},{"lat":-33.77507,"lng":151.01690000000002},{"lat":-33.77508,"lng":151.01680000000002},{"lat":-33.7751,"lng":151.01668},{"lat":-33.77512,"lng":151.01657},{"lat":-33.775150000000004,"lng":151.01643},{"lat":-33.77521,"lng":151.01629000000003},{"lat":-33.77526,"lng":151.01617000000002},{"lat":-33.775290000000005,"lng":151.01609000000002},{"lat":-33.77535,"lng":151.01598},{"lat":-33.775470000000006,"lng":151.0158},{"lat":-33.775600000000004,"lng":151.01557000000003},{"lat":-33.77599,"lng":151.01496},{"lat":-33.776630000000004,"lng":151.01397},{"lat":-33.7768,"lng":151.0137},{"lat":-33.77691,"lng":151.01353},{"lat":-33.77729,"lng":151.01294000000001},{"lat":-33.777570000000004,"lng":151.01250000000002},{"lat":-33.777640000000005,"lng":151.0124},{"lat":-33.77772,"lng":151.01228},{"lat":-33.77772,"lng":151.01228},{"lat":-33.777770000000004,"lng":151.01219},{"lat":-33.777840000000005,"lng":151.01208000000003},{"lat":-33.77789,"lng":151.01201},{"lat":-33.777930000000005,"lng":151.01194},{"lat":-33.77803,"lng":151.01181000000003},{"lat":-33.77812,"lng":151.01171000000002},{"lat":-33.77821,"lng":151.01161000000002},{"lat":-33.778290000000005,"lng":151.01155},{"lat":-33.77836,"lng":151.0115},{"lat":-33.77843,"lng":151.01145000000002},{"lat":-33.7785,"lng":151.01141},{"lat":-33.77857,"lng":151.01137},{"lat":-33.77864,"lng":151.01134000000002},{"lat":-33.77872,"lng":151.01131},{"lat":-33.778800000000004,"lng":151.01128},{"lat":-33.77888,"lng":151.01126000000002},{"lat":-33.77893,"lng":151.01125000000002},{"lat":-33.779,"lng":151.01124000000002},{"lat":-33.779070000000004,"lng":151.01123},{"lat":-33.77913,"lng":151.01122},{"lat":-33.779270000000004,"lng":151.01122},{"lat":-33.77942,"lng":151.01121},{"lat":-33.779900000000005,"lng":151.01118000000002},{"lat":-33.780210000000004,"lng":151.01116000000002},{"lat":-33.78045,"lng":151.01115000000001},{"lat":-33.7807,"lng":151.01114},{"lat":-33.780950000000004,"lng":151.01112},{"lat":-33.78101,"lng":151.01112},{"lat":-33.781060000000004,"lng":151.01111},{"lat":-33.7811,"lng":151.01111},{"lat":-33.781150000000004,"lng":151.0111},{"lat":-33.78119,"lng":151.01109000000002},{"lat":-33.781220000000005,"lng":151.01108000000002},{"lat":-33.78125,"lng":151.01106000000001},{"lat":-33.781290000000006,"lng":151.01105},{"lat":-33.781490000000005,"lng":151.01093},{"lat":-33.781530000000004,"lng":151.01090000000002},{"lat":-33.781530000000004,"lng":151.01090000000002},{"lat":-33.78163,"lng":151.01084},{"lat":-33.78177,"lng":151.01075},{"lat":-33.78199,"lng":151.01061},{"lat":-33.78208,"lng":151.01056000000003},{"lat":-33.7822,"lng":151.01048},{"lat":-33.78228,"lng":151.01043},{"lat":-33.78238,"lng":151.01037000000002},{"lat":-33.78246,"lng":151.0103},{"lat":-33.78255,"lng":151.01023},{"lat":-33.782630000000005,"lng":151.01016},{"lat":-33.78273,"lng":151.01007},{"lat":-33.782830000000004,"lng":151.00997},{"lat":-33.78295,"lng":151.00987},{"lat":-33.783080000000005,"lng":151.00974000000002},{"lat":-33.7832,"lng":151.00963000000002},{"lat":-33.78331,"lng":151.00954000000002},{"lat":-33.783370000000005,"lng":151.00948000000002},{"lat":-33.78345,"lng":151.00942},{"lat":-33.783530000000006,"lng":151.00937000000002},{"lat":-33.7836,"lng":151.00933},{"lat":-33.78379,"lng":151.00923},{"lat":-33.783970000000004,"lng":151.00913},{"lat":-33.784090000000006,"lng":151.00906},{"lat":-33.78418,"lng":151.00902000000002},{"lat":-33.78427,"lng":151.00897},{"lat":-33.78436,"lng":151.00892000000002},{"lat":-33.784440000000004,"lng":151.00888},{"lat":-33.78454,"lng":151.00883000000002},{"lat":-33.78459,"lng":151.00881},{"lat":-33.78472,"lng":151.00876000000002},{"lat":-33.784800000000004,"lng":151.00874000000002},{"lat":-33.78502,"lng":151.00868},{"lat":-33.785650000000004,"lng":151.00854},{"lat":-33.78589,"lng":151.00849000000002},{"lat":-33.78609,"lng":151.00844},{"lat":-33.78615,"lng":151.00843},{"lat":-33.78622,"lng":151.00841000000003},{"lat":-33.78631,"lng":151.00838000000002},{"lat":-33.78633,"lng":151.00837},{"lat":-33.786410000000004,"lng":151.00833},{"lat":-33.786570000000005,"lng":151.00825},{"lat":-33.78674,"lng":151.00815},{"lat":-33.786820000000006,"lng":151.00811000000002},{"lat":-33.78689,"lng":151.00806},{"lat":-33.78696,"lng":151.00802000000002},{"lat":-33.787060000000004,"lng":151.00795000000002},{"lat":-33.787290000000006,"lng":151.00779},{"lat":-33.7875,"lng":151.00765},{"lat":-33.78755,"lng":151.00761},{"lat":-33.787600000000005,"lng":151.00757000000002},{"lat":-33.78765,"lng":151.00752},{"lat":-33.787690000000005,"lng":151.00748000000002},{"lat":-33.78774,"lng":151.00741000000002},{"lat":-33.78781,"lng":151.00733000000002},{"lat":-33.78788,"lng":151.00722000000002},{"lat":-33.78799,"lng":151.00704000000002},{"lat":-33.78799,"lng":151.00704000000002},{"lat":-33.788070000000005,"lng":151.00692},{"lat":-33.78822,"lng":151.00665},{"lat":-33.78835,"lng":151.00644000000003},{"lat":-33.788430000000005,"lng":151.00633000000002},{"lat":-33.788520000000005,"lng":151.0062},{"lat":-33.78886,"lng":151.00574},{"lat":-33.789030000000004,"lng":151.00549},{"lat":-33.78915,"lng":151.00533000000001},{"lat":-33.789570000000005,"lng":151.00475},{"lat":-33.78962,"lng":151.00468},{"lat":-33.789660000000005,"lng":151.00462000000002},{"lat":-33.78969,"lng":151.00457},{"lat":-33.789770000000004,"lng":151.00441},{"lat":-33.78992,"lng":151.00411000000003},{"lat":-33.79005,"lng":151.00384000000003},{"lat":-33.79019,"lng":151.00356000000002},{"lat":-33.79028,"lng":151.00337000000002},{"lat":-33.79045,"lng":151.00301000000002},{"lat":-33.790580000000006,"lng":151.00273},{"lat":-33.79064,"lng":151.00262},{"lat":-33.79074,"lng":151.00241000000003},{"lat":-33.790780000000005,"lng":151.00234},{"lat":-33.79083,"lng":151.00226},{"lat":-33.79088,"lng":151.00218},{"lat":-33.79092,"lng":151.00212000000002},{"lat":-33.79102,"lng":151.002},{"lat":-33.791090000000004,"lng":151.00192},{"lat":-33.79119,"lng":151.00182},{"lat":-33.79122,"lng":151.00179},{"lat":-33.791290000000004,"lng":151.00173},{"lat":-33.791610000000006,"lng":151.00144},{"lat":-33.79189,"lng":151.0012},{"lat":-33.79198,"lng":151.00113000000002},{"lat":-33.79207,"lng":151.00106000000002},{"lat":-33.7922,"lng":151.00097000000002},{"lat":-33.79231,"lng":151.00089},{"lat":-33.79252,"lng":151.00076},{"lat":-33.79269,"lng":151.00065},{"lat":-33.792820000000006,"lng":151.00058},{"lat":-33.79305,"lng":151.00044000000003},{"lat":-33.793260000000004,"lng":151.0003},{"lat":-33.793350000000004,"lng":151.00024000000002},{"lat":-33.793350000000004,"lng":151.00024000000002},{"lat":-33.79354,"lng":151.00021},{"lat":-33.793580000000006,"lng":151.0002},{"lat":-33.79361,"lng":151.00021},{"lat":-33.7937,"lng":151.00023000000002},{"lat":-33.793890000000005,"lng":151.00029},{"lat":-33.793940000000006,"lng":151.00033000000002},{"lat":-33.793980000000005,"lng":151.00036},{"lat":-33.794140000000006,"lng":151.00047},{"lat":-33.79424,"lng":151.00052000000002},{"lat":-33.79437,"lng":151.00059000000002},{"lat":-33.7946,"lng":151.00072},{"lat":-33.79505,"lng":151.00095000000002},{"lat":-33.795170000000006,"lng":151.00101},{"lat":-33.79552,"lng":151.00119},{"lat":-33.79576,"lng":151.00131000000002},{"lat":-33.79587,"lng":151.00137},{"lat":-33.79596,"lng":151.00142000000002},{"lat":-33.79628,"lng":151.00162},{"lat":-33.796510000000005,"lng":151.00176000000002},{"lat":-33.79659,"lng":151.00182},{"lat":-33.79666,"lng":151.00186000000002},{"lat":-33.7969,"lng":151.00202000000002},{"lat":-33.797000000000004,"lng":151.00208},{"lat":-33.797250000000005,"lng":151.00224},{"lat":-33.797250000000005,"lng":151.00224},{"lat":-33.7973,"lng":151.00212000000002},{"lat":-33.79744,"lng":151.00181},{"lat":-33.79773,"lng":151.00115000000002},{"lat":-33.7978,"lng":151.00099},{"lat":-33.7978,"lng":151.00099},{"lat":-33.79844,"lng":151.00136},{"lat":-33.79896,"lng":151.00168000000002},{"lat":-33.799130000000005,"lng":151.00179},{"lat":-33.79923,"lng":151.00185000000002},{"lat":-33.799260000000004,"lng":151.00189},{"lat":-33.7993,"lng":151.00193000000002},{"lat":-33.79934,"lng":151.00196000000003},{"lat":-33.799350000000004,"lng":151.00198},{"lat":-33.79938,"lng":151.00201},{"lat":-33.79938,"lng":151.00202000000002},{"lat":-33.79938,"lng":151.00203000000002},{"lat":-33.79938,"lng":151.00204000000002},{"lat":-33.79939,"lng":151.00205000000003},{"lat":-33.79939,"lng":151.00206},{"lat":-33.799400000000006,"lng":151.00207},{"lat":-33.799400000000006,"lng":151.00208},{"lat":-33.79941,"lng":151.00208},{"lat":-33.79941,"lng":151.00209},{"lat":-33.799420000000005,"lng":151.00209},{"lat":-33.799420000000005,"lng":151.0021},{"lat":-33.79943,"lng":151.0021},{"lat":-33.799440000000004,"lng":151.0021},{"lat":-33.79945,"lng":151.00211000000002},{"lat":-33.79946,"lng":151.00211000000002},{"lat":-33.79947,"lng":151.00211000000002},{"lat":-33.79948,"lng":151.00211000000002},{"lat":-33.79948,"lng":151.0021},{"lat":-33.799490000000006,"lng":151.0021},{"lat":-33.7995,"lng":151.0021},{"lat":-33.7995,"lng":151.00209},{"lat":-33.799510000000005,"lng":151.00209},{"lat":-33.79952,"lng":151.00208},{"lat":-33.79954,"lng":151.0021},{"lat":-33.79956,"lng":151.00211000000002},{"lat":-33.799620000000004,"lng":151.00215},{"lat":-33.79966,"lng":151.00217},{"lat":-33.7997,"lng":151.00217},{"lat":-33.799730000000004,"lng":151.00218},{"lat":-33.799820000000004,"lng":151.00223000000003},{"lat":-33.80004,"lng":151.00237},{"lat":-33.800380000000004,"lng":151.00258000000002},{"lat":-33.80059,"lng":151.00271},{"lat":-33.800650000000005,"lng":151.00275000000002},{"lat":-33.80071,"lng":151.00278},{"lat":-33.80077,"lng":151.00282},{"lat":-33.80084,"lng":151.00286},{"lat":-33.800920000000005,"lng":151.00289},{"lat":-33.801,"lng":151.00291},{"lat":-33.80129,"lng":151.00295},{"lat":-33.80147,"lng":151.00298},{"lat":-33.801770000000005,"lng":151.00303000000002},{"lat":-33.802,"lng":151.00306},{"lat":-33.80239,"lng":151.00312000000002},{"lat":-33.802490000000006,"lng":151.00314},{"lat":-33.80257,"lng":151.00315},{"lat":-33.80266,"lng":151.00316},{"lat":-33.80276,"lng":151.00317},{"lat":-33.80284,"lng":151.00318000000001},{"lat":-33.80286,"lng":151.00320000000002},{"lat":-33.8029,"lng":151.00322},{"lat":-33.80294,"lng":151.00324},{"lat":-33.802980000000005,"lng":151.00325},{"lat":-33.803020000000004,"lng":151.00325},{"lat":-33.803070000000005,"lng":151.00326},{"lat":-33.803110000000004,"lng":151.00326},{"lat":-33.80319,"lng":151.00324},{"lat":-33.803250000000006,"lng":151.00323},{"lat":-33.80333,"lng":151.00321000000002},{"lat":-33.803630000000005,"lng":151.00312000000002},{"lat":-33.80393,"lng":151.00302000000002},{"lat":-33.804210000000005,"lng":151.00294000000002},{"lat":-33.804570000000005,"lng":151.00283000000002},{"lat":-33.80465,"lng":151.00281},{"lat":-33.80485,"lng":151.00275000000002},{"lat":-33.80519,"lng":151.00264},{"lat":-33.805710000000005,"lng":151.00249000000002},{"lat":-33.80584,"lng":151.00244},{"lat":-33.80623,"lng":151.00233},{"lat":-33.80632,"lng":151.00230000000002},{"lat":-33.80655,"lng":151.00223000000003},{"lat":-33.806670000000004,"lng":151.00220000000002},{"lat":-33.806920000000005,"lng":151.00212000000002},{"lat":-33.807140000000004,"lng":151.00205000000003},{"lat":-33.80722,"lng":151.00202000000002},{"lat":-33.807320000000004,"lng":151.00199},{"lat":-33.80745,"lng":151.00195000000002},{"lat":-33.80807,"lng":151.00175000000002},{"lat":-33.8082,"lng":151.00172},{"lat":-33.80834,"lng":151.00168000000002},{"lat":-33.80847,"lng":151.00165},{"lat":-33.80921,"lng":151.00142000000002},{"lat":-33.80951,"lng":151.00133000000002},{"lat":-33.809630000000006,"lng":151.00130000000001},{"lat":-33.809670000000004,"lng":151.00127},{"lat":-33.8097,"lng":151.00126},{"lat":-33.80988,"lng":151.0012},{"lat":-33.809990000000006,"lng":151.00117},{"lat":-33.81013,"lng":151.00114000000002},{"lat":-33.81049,"lng":151.00102},{"lat":-33.810680000000005,"lng":151.00095000000002},{"lat":-33.81078,"lng":151.00092},{"lat":-33.81087,"lng":151.00089},{"lat":-33.810970000000005,"lng":151.00086000000002},{"lat":-33.8113,"lng":151.00076},{"lat":-33.811640000000004,"lng":151.00065},{"lat":-33.81188,"lng":151.00059000000002},{"lat":-33.812290000000004,"lng":151.00050000000002},{"lat":-33.81284,"lng":151.00039},{"lat":-33.812960000000004,"lng":151.0003},{"lat":-33.81298,"lng":151.00029},{"lat":-33.81306,"lng":151.00027},{"lat":-33.81313,"lng":151.00025000000002},{"lat":-33.81316,"lng":151.00024000000002},{"lat":-33.81322,"lng":151.00022},{"lat":-33.81331,"lng":151.0002},{"lat":-33.813430000000004,"lng":151.00016000000002},{"lat":-33.81353,"lng":151.00013},{"lat":-33.81362,"lng":151.0001},{"lat":-33.813700000000004,"lng":151.00007000000002},{"lat":-33.81378,"lng":151.00005000000002},{"lat":-33.813880000000005,"lng":151.00001},{"lat":-33.813900000000004,"lng":151.00001},{"lat":-33.81403,"lng":150.99996000000002},{"lat":-33.814150000000005,"lng":150.99991},{"lat":-33.81423,"lng":150.99987000000002},{"lat":-33.81436,"lng":150.99986},{"lat":-33.81465,"lng":150.99975},{"lat":-33.81517,"lng":150.99959},{"lat":-33.815270000000005,"lng":150.99956},{"lat":-33.815270000000005,"lng":150.99956},{"lat":-33.81557,"lng":151.001},{"lat":-33.81566,"lng":151.00144},{"lat":-33.81566,"lng":151.00144},{"lat":-33.81542,"lng":151.00152},{"lat":-33.81519,"lng":151.00160000000002},{"lat":-33.81477,"lng":151.00173},{"lat":-33.81477,"lng":151.00173},{"lat":-33.81467,"lng":151.00127}];
               
                console.log(JSON.stringify(points));
                
                this.mainMap.addPolyline({
                    points: points,
                    fillColor: '#19A2E9',
                    strokeColor: '#2C9ED8',
                    'width': 10,
                    clickable: true
    
                }).then(tripPolygon => {
                        tripPolygon.on(GoogleMapsEvent.POLYLINE_CLICK).subscribe(()=>{
                            console.log('you clicked me ');    
                        });
                });

#8

I said Please share your project files on GitHub.


#9

Hi mate,

Thanks for your help. As it is too complicate to make the project working if I share project to you . don’t want to waste your much time.

I debugged many times and finally I found the reason, I think the ‘geodesic’ does the trick if there are a lots of points. I have to set PolyLine options as true .