javascript - 在 Google map javascript API 上画线

标签 javascript google-maps google-maps-api-3

首先很抱歉提出这样一个直接的问题,我想使用javascript在谷歌地图中画一条线。我有一个如下所示的数组,但我不知道如何为这些坐标绘制线条。

$luxian =   array();
$luxian[0] = "117.82601481119,35.520710018055*117.82749740937,35.523964274812";
$luxian[1] = "117.82755348854,35.524426161498*117.82840903478,35.525907227735*117.82851349195,35.52612885859*117.82862091751,35.526346457302*117.82871425816,35.526519881807*117.82882463423,35.526713633235*117.82912224113,35.527249853019*117.82936083635,35.527637281861*117.8295777657,35.527956257082*117.82959887314,35.527996447758*117.82964460687,35.528084204972*117.82966841963,35.528128503632*117.82972307115,35.52822018494*117.82978582455,35.528310080246*117.82990400261,35.52845177136*117.82999756158,35.528552133698*117.83009598521,35.52865337273*117.83014276143,35.528698800257*117.83023713009,35.528794275308*117.8304918434,35.529042557891*117.83059730198,35.529145761049*117.83070357636,35.529252224087*117.83091342166,35.52945667934*117.83096398997,35.529504574745*117.83109216669,35.52962188705*117.8311392124,35.529657518823*117.83156384486,35.530100799832*117.83166310986,35.530203031533*117.83171693299,35.530255827083*117.83182133704,35.530360013618*117.83198254442,35.530519729401*117.83222192856,35.53075448916*117.83225302898,35.530777944285*117.83224194027,35.530768850646*117.83232256693,35.530865917129*117.83242482361,35.53097193098*117.83253140792,35.531079347389*117.83258821924,35.531138115664*117.83264367753,35.531194422866*117.83275216328,35.531306729475*117.83382351239,35.532295382903*117.83402361954,35.532636823132*117.8347117142,35.533501531193*117.834863828,35.5336629671*117.83535724095,35.534137771158*117.83478511666,35.534520381511*117.83468262976,35.534512504632*117.83433491556,35.534507104583*117.8343349828,35.534581180906";
$luxian[2] = "117.83535724095,35.534137771158*117.83559629285,35.534410974548";
$luxian[3] = "117.83559629285,35.534410974548*117.83642012405,35.534951814146*117.83666409631,35.535215894638*117.83661009513,35.535029265199*117.83697421406,35.535006751517*117.83721201313,35.534985486238*117.83738216649,35.534946507764*117.83769119111,35.534962645599*117.83790232624,35.535032731492*117.83833733476,35.53515361727*117.83868574452,35.535236532202*117.83901199701,35.535327323366*117.83926898551,35.535429761456*117.83951384003,35.535567334115*117.83977308187,35.53572936344*117.83997925535,35.535873370189*117.84063135148,35.536221226176*117.84132305853,35.536508914883*117.84165362919,35.536620910474*117.84214159122,35.536678108372*117.84239978837,35.536666655527*117.84269237452,35.536604251683*117.84293536865,35.536513382065*117.84316644567,35.536411565169*117.84331493548,35.536379730076*117.84359117618,35.536446182241*117.84378236108,35.536554405992*117.84403872953,35.536796786407*117.84413368824,35.536890068161*117.84435993181,35.537066095916*117.84461023856,35.537146063224*117.84487436485,35.537193972907";
$luxian[4] = "117.84487436485,35.537193972907*117.84489839819,35.537399409632*117.84457972167,35.537613521087*117.8443068158,35.537738630212*117.84414232927,35.537820768424*117.84406306015,35.538014052987*117.84415668092,35.538132020099*117.84433218176,35.538257201083*117.84444290125,35.538390371004*117.84443815979,35.538562658433*117.84440928361,35.53872865849*117.84433985952,35.539044894845*117.84438007806,35.539515191067*117.844610709,35.539753303442";
$luxian[5] = "117.84487436485,35.537193972907*117.84513877002,35.537226891961";
$luxian[6] = "117.84513877002,35.537226891961*117.84523526805,35.537180878861*117.84536974707,35.53714981909*117.84553133594,35.537100856933*117.84569970026,35.537037221925*117.84596595686,35.536938874715*117.84621921793,35.536845340461*117.84637649771,35.536786205469*117.84652130912,35.536730846648*117.84673664062,35.536650212889*117.84688310958,35.536611896969*117.84695580646,35.536595851883*117.84716443082,35.536572113327*117.84734702616,35.536556768162*117.84744956024,35.536516240264*117.84752845837,35.536439911459*117.84748626954,35.536290991537*117.84742758311,35.536205036836*117.8473944169,35.536133978291*117.84743203834,35.536024049209*117.84753293418,35.535969676141*117.84765855334,35.535945110868*117.84779126379,35.535955795004*117.84791830728,35.535997403152*117.8480958627,35.536069847075*117.84821152161,35.536115507918*117.84846287651,35.53613755978*117.84862867453,35.536079964334*117.84885916058,35.536105763799*117.84907997791,35.536234103587*117.84924187032,35.536334340163*117.84944338503,35.536405674452*117.84963814285,35.536499783483*117.85007467428,35.53669342636*117.85024856378,35.536796992494*117.8504743388,35.536905483975*117.85097549437,35.536951706347*117.85117624513,35.536966546271*117.85130906904,35.536952636036*117.85158966016,35.536908683333*117.85188332254,35.536873814708*117.85208630121,35.536892000419*117.85232007414,35.537001416332*117.85250792539,35.537097210978*117.85280889733,35.537262025915*117.85320259995,35.537457098306*117.85345983115,35.537581043616*117.85376279819,35.537765392653*117.85388870817,35.537822578699*117.85408773486,35.537858603368*117.8542383579,35.537869444347*117.85439061471,35.53787591167*117.85461059691,35.53790300455*117.85484718596,35.537938878282*117.85506231363,35.537982745573*117.85527446437,35.538029582098*117.85547439854,35.538088693064*117.85571654525,35.538204386538*117.85605366846,35.538362871551*117.85617695685,35.538449677905*117.85637399852,35.538576496191*117.85653782006,35.538651767305*117.85697800494,35.538662776836*117.85739427643,35.538652161115*117.85750829481,35.53866485072*117.85760027977,35.538682638678*117.85778184189,35.538762446755*117.85787168621,35.538818495092*117.85798197282,35.538913394768*117.85816719322,35.539126333838*117.85822742481,35.539238566274*117.85825439211,35.539270295098*117.85832463973,35.53931241152*117.85841064785,35.53932125081*117.85849145716,35.539292154328*117.85859858958,35.539161827983*117.85868232332,35.539039619856*117.85877151206,35.538930369635*117.85891539588,35.538800421872*117.85911461197,35.538759913353*117.85927276864,35.538764617522*117.8597110584,35.538770905842*117.85993429345,35.538761737708*117.86020166804,35.538779130106*117.86042114464,35.538807101849*117.86057800171,35.538832021075*117.86078442169,35.538855214534*117.86103877989,35.538880209039*117.86141759879,35.538891875675*117.86163384893,35.538901524816*117.86189206427,35.538925778045*117.86202636222,35.538950842461*117.86216856333,35.538976602188*117.86225791904,35.538994384646*117.86239714368,35.539037257759*117.86249115211,35.539078026586*117.86253421152,35.53910402551*117.86260644732,35.539167064879*117.86270078761,35.539279720043*117.86274907199,35.539367233365*117.8627889185,35.539463545287*117.86284025098,35.539618032513*117.86289239648,35.539767351154*117.86293578275,35.539861710183*117.86299388204,35.53995884599*117.86306805692,35.540058737778*117.863189418,35.540232031676*117.86326256094,35.540407901542*117.86333102625,35.540520885879*117.86341016614,35.54070100441*117.86356586431,35.54088056115*117.86371203196,35.541063497037*117.86385056859,35.541240019178*117.86397085024,35.541414354996*117.86407914361,35.541587772966*117.86434090636,35.541846821829*117.86448245268,35.542026774444*117.86451165811,35.542098239542*117.86445342563,35.542220119722*117.86439242584,35.542278277685*117.86435432073,35.542343961999*117.86442688693,35.542469862434*117.86450375835,35.542511856345*117.86471119134,35.542601538564*117.86484252389,35.54257513776*117.86502289867,35.542527089667*117.86512101443,35.542538345702*117.86523223862,35.542588466245*117.86529877484,35.542647407282*117.8654040361,35.542743734251*117.86555456297,35.542874354714*117.86562355929,35.542940300506*117.86568574301,35.543007163854*117.86571198245,35.543124780226*117.86569895248,35.5432080077*117.86572407336,35.543281686984*117.86580150951,35.54333148661*117.86590453038,35.543322548088*117.86600071852,35.543281153169*117.86614680084,35.54326040021*117.86622423315,35.543296074873*117.86626245951,35.543402369544*117.86621129266,35.543526631256*117.86617836518,35.543613974853*117.86619154597,35.543774116388*117.86632978028,35.543839754231*117.8663962825,35.543828657565*117.86651320345,35.543801559848*117.86662246488,35.543726554831*117.86669990789,35.543772250269*117.866736755,35.543850611902*117.86676489291,35.543952175149*117.86679003376,35.544056770676*117.86682745685,35.54418829955*117.86686157554,35.544263718114*117.86705220028,35.544396291558*117.86710238339,35.544437530754*117.867339799,35.544389163774*117.86742104253,35.544395972941*117.86750315072,35.54448253228*117.86753540029,35.54462308698*117.86754475014,35.544765916898*117.86755163996,35.54489874829*117.86755169003,35.544989095469*117.86752884122,35.545082532236*117.86741137797,35.545147676572*117.8673091569,35.545165357066*117.86717177657,35.545193915649*117.8670504865,35.545230072846*117.86696735839,35.545258823003*117.86686625046,35.545307394941*117.866707617,35.545337352764*117.86660838268,35.545315069548*117.86643719702,35.545309123565*117.86633308769,35.545337912081*117.86622979004,35.545352574171*117.86608424458,35.545364370679*117.8660111937,35.545357653302*117.86579566076,35.545471457516*117.86585782619,35.545514437887*117.86606935269,35.545550726442*117.86622284944,35.54562806705*117.86636434674,35.545687680357*117.86644342571,35.545747466219*117.86660183862,35.54582849846*117.866756164,35.545905786183*117.8668464104,35.545940416428*117.86701300463,35.546011518844*117.86719134197,35.546117145105*117.86727070448,35.546182864555*117.86737706478,35.546265231826*117.86740625272,35.546301651928*117.86752678956,35.546381609284*117.86764183196,35.546372390005*117.86769198595,35.546353656113*117.867846281,35.546326685992*117.86795969881,35.546330772405*117.86806603845,35.546352877936*117.86815711796,35.546388256631*117.86820132524,35.54646836819*117.86813211279,35.546548746678*117.86800672416,35.546602113731*117.86785654798,35.546697938184*117.86776142577,35.546752689654*117.8676701217,35.546808188205*117.86752375332,35.546872999436*117.86744743224,35.54689948426*117.86734437525,35.546882180903*117.8671398867,35.546816875883*117.86683691086,35.546573265225*117.86677175258,35.546556137536*117.86672269699,35.546578902793*117.86671261512,35.546587204124*117.86671561503,35.546590140305*117.8667085431,35.546622268415*117.86676064964,35.546709334419*117.86684110883,35.546802181941*117.86694528293,35.546891387085*117.86705763481,35.546977470055*117.86723924035,35.547084394475*117.86736958417,35.547160943525*117.8674587523,35.547210487783*117.8676553682,35.5473342246*117.86776066239,35.547470037627*117.86782125682,35.547632089134*117.86787227047,35.547705309816*117.86799254421,35.547803423458*117.86810191271,35.547899271189*117.86818020364,35.548001873402*117.86821322337,35.548074301953*117.86818246061,35.548187135531*117.86803391161,35.548287010961*117.86795600576,35.548459498267*117.86802801061,35.548533179706*117.86804520258,35.548573859873*117.86808640886,35.548672197966*117.86811317376,35.548794107983*117.8681233065,35.548914938577*117.8681394384,35.549040552144*117.86821392981,35.549207241311*117.86825294539,35.549284722368*117.86835033196,35.549433117884*117.86841251901,35.549500169349*117.86858815724,35.549646968034*117.86871661839,35.5497655245*117.86885190346,35.549903220682*117.86895936312,35.549995263088*117.86915380892,35.550096668586*117.86929723974,35.550108051229*117.86948265033,35.550069600858*117.86962936576,35.550104784427*117.86976766569,35.55025730523*117.86981486596,35.550339504565*117.86981680263,35.550433609744*117.86974973987,35.550499608566*117.86960332591,35.550567517124*117.86950489898,35.550610448324*117.86941192885,35.550661421259*117.86936448129,35.550657081001*117.86922544431,35.550758755369*117.86913714648,35.550936603513*117.86911427636,35.551066128131*117.86914813169,35.551236734022*117.86914353836,35.551405825521*117.86911740184,35.551572300125*117.86911743199,35.551701703811*117.86915454271,35.551822064263*117.86923992215,35.551969541007*117.86932502708,35.552109966096*117.86933104985,35.552225972957*117.86917373573,35.552324971363*117.86893406817,35.552372190286*117.8688498259,35.552430048183*117.86881164952,35.552411705812*117.8688127265,35.552341696184*117.86894909264,35.552517343093*117.86913071386,35.552643922101*117.86918199599,35.552754000911*117.86915583369,35.552836646476*117.86904541608,35.55292072869*117.86890909269,35.552983272832*117.86878585631,35.553029582736*117.86874795653,35.55303022466*117.86860535496,35.553022055121*117.8685161931,35.552998600403*117.86830243641,35.553002734122*117.8681500571,35.553182429722*117.86814325432,35.553269624379*117.86818444691,35.553432789503*117.86825343486,35.553498641735*117.86831479495,35.553608838348*117.86830472273,35.553730811269*117.86826465383,35.553811780803*117.86819159759,35.553915003361*117.8681482621,35.55404404142*117.86805012335,35.554150933401*117.86783038588,35.554203955858*117.8677052508,35.554215248941*117.86750679128,35.554311836704*117.86739747973,35.554394741326*117.86727917251,35.554469106719*117.86719794351,35.55456863313*117.86715270385,35.554735389602*117.86714071807,35.554860913015*117.86716689674,35.554994495881*117.86716581565,35.55516134597*117.86713011054,35.555290238408*117.86695646724,35.555382303673*117.86681090227,35.555409068984*117.86662254563,35.555475302512*117.86650043244,35.555600684308*117.8664584592,35.555765472381*117.86629382691,35.556013318836*117.86614773012,35.556217184338*117.86602235015,35.556316546359*117.86586889926,35.556380261799*117.86567348021,35.556384397746*117.8654129311,35.556352899047*117.86523551311,35.556325788538*117.86506709314,35.556321581866*117.8649060358,35.556295275748*117.86476841842,35.556223843049*117.86466323131,35.556066192277*117.86458011716,35.555914443674*117.86448474295,35.555883317349*117.86428446362,35.555917490964*117.86416620753,35.556019607814*117.86401716377,35.556087988252*117.86384469132,35.55605768415*117.86369837915,35.55595618316*117.8635733204,35.555803093598";
$luxian[7] = "117.8635733204,35.555803093598*117.86337961522,35.556119186148*117.86356324229,35.55641955935*117.86387465802,35.556615514908*117.86401905871,35.556877616416*117.86403322556,35.556923252365*117.86419942807,35.557112861516*117.86433266536,35.557251675058*117.86435963521,35.557360322179*117.86418958809,35.557609145396*117.86405414716,35.557854459546*117.86389990436,35.558117397083*117.86378463197,35.558309227086*117.86341594833,35.558770252318*117.86315547188,35.55896871844*117.86299226862,35.559107459601*117.86288792222,35.55917375128*117.86281981006,35.559229223939*117.86274379051,35.559335527905*117.86267049495,35.559445316643*117.86262852153,35.559580167148*117.86258029164,35.559663835867*117.8624642315,35.559768778269*117.86234599472,35.559871571544*117.86227079163,35.559998997942*117.86235901655,35.560137762057*117.86254641032,35.560197853071*117.8627335374,35.56026199409*117.86285582526,35.560376115352*117.86295795275,35.560505699749*117.86307206667,35.560641075966*117.86317718809,35.560792303501*117.86325450576,35.561009018139*117.86320242498,35.561190135471*117.86309504202,35.561364979306*117.8629658735,35.561512996888*117.86277842627,35.561607024266*117.86257220612,35.56164324215*117.86235891852,35.561656473713*117.86207044766,35.561729006704*117.86189989664,35.561897834964*117.861902877,35.561950687445*117.86194809704,35.561925129035*117.86131911834,35.562339729132*117.86094842701,35.562537877726*117.86034983921,35.562806827266*117.8601594949,35.562889437445*117.85995441097,35.563102392329*117.85991407938,35.56321082776";
$luxian[8] = "117.85991407938,35.56321082776*117.85980125598,35.563326853216";
$luxian[9] = "117.85980125598,35.563326853216*117.85953722698,35.563574935473*117.85936757262,35.563733888321*117.85937255228,35.563831818992*117.85947990596,35.5638875667*117.85970667935,35.563958898768*117.85974675638,35.564124404303*117.85956907662,35.564246480915*117.85927803955,35.564294850837*117.85907637752,35.564217162792*117.8589148306,35.564211985386*117.85875124005,35.564311797423*117.8587481811,35.564429816158*117.85897389921,35.564530280502*117.85919159659,35.56464079628*117.85930490523,35.564833470816*117.85930781316,35.565065405423*117.85924847107,35.565367044694*117.85922638363,35.565391294359*117.859067793,35.565491086801*117.85890620881,35.565566897146*117.85881486877,35.565635907816*117.85873355157,35.565730797194*117.85865325809,35.565785676088*117.85853483672,35.565847966*117.85844548589,35.56596692115*117.85834611352,35.566065981028*117.85828686485,35.566180600648*117.85832994362,35.566302118616*117.8584804694,35.566232500002*117.85860996464,35.566094105549*117.85858091118,35.566007437625*117.85853979345,35.565970893247*117.85875248553,35.565998546948*117.85892810769,35.565933596779*117.85908665939,35.565907810975";
$luxian[10] = "117.8635733204,35.555803093598*117.86349485374,35.555738302886";
$luxian[11] = "117.86349485374,35.555738302886*117.86337569672,35.555771374965";
$luxian[12] = "117.86337569672,35.555771374965*117.86330037186,35.555731448339*117.86322203512,35.555693560974*117.86304929625,35.555608001032";
$luxian[13] = "117.86349485374,35.555738302886*117.86356594991,35.555355874953*117.86354714935,35.555321965223*117.86353597784,35.555298253943*117.86351908308,35.555237460563*117.86349074501,35.555168964269*117.86350981393,35.555125558299*117.86352289029,35.55510529634*117.86349891236,35.555061694479*117.86345368202,35.554991269513*117.86343951397,35.554976552385*117.86342970562,35.554970724763*117.86341689969,35.55495381776*117.86340273171,35.554939100307*117.86336350097,35.554951596606*117.86325125212,35.554883477311*117.86323735504,35.554841627212*117.86325832689,35.554764558935*117.86327738997,35.5546687995*117.86326240004,35.55459603969*117.86323432679,35.554453476368*117.86321306225,35.554298879562*117.86324220798,35.554252349117*117.8633443579,35.554119597952*117.8634797435,35.553955166988*117.86359499774,35.554026483888*117.86366093197,35.554030415535*117.86376719184,35.55404189822*117.86389442957,35.554017531072*117.86393665685,35.553972153854*117.86398242968,35.553954122711*117.86403964828,35.553949215071*117.86410776932,35.553968288899*117.86417071065,35.553958138465*117.86419195781,35.553904654601*117.8642633451,35.553878370752*117.86426334415,35.553870503706*117.86427396858,35.553850271872*117.86427696198,35.553818216736*117.86431320312,35.553822562753*117.86433036204,35.553760456797";
$luxian[14] = "117.86442329804,35.553899054951*117.86452363339,35.55395055583";
$luxian[15] = "117.86452363339,35.55395055583*117.8647978804,35.553983437387*117.8650158746,35.553958132326*117.86527003377,35.553847243479";
$luxian[16] = "117.86527003377,35.553847243479*117.86535336958,35.553776185598";
$luxian[17] = "117.86535336958,35.553776185598*117.86538225181,35.553725554192*117.86537625337,35.553704758177*117.86538224677,35.553686490148*117.86538224298,35.553657463378*117.86541439509,35.553604068201*117.86543646701,35.553577684744*117.8654648121,35.553586199105*117.86549561027,35.553595488933*117.86552368161,35.553593155494*117.8655558416,35.553593742339*117.86561089271,35.553573898624*117.86565394248,35.553483707373*117.86574904856,35.553389990804*117.86579046914,35.553340513747*117.86570407115,35.553344031798*117.8656830819,35.553323470075*117.86511972189,35.553136835498*117.86512652869,35.553097395746*117.86505649421,35.553120709352";
$luxian[18] = "117.86505649421,35.553120709352*117.86514560985,35.553125317417";
$luxian[19] = "117.86514560985,35.553125317417*117.86505241089,35.553148984815*117.86503741783,35.553120999951*117.86502542384,35.553101379026*117.86499653339,35.553079844773*117.86498535742,35.553062923951*117.86493820432,35.55301562324*117.86490523049,35.553018293565*117.8648692557,35.55299984875*117.86476704738,35.552898577151*117.86474496885,35.552866898674*117.86473379541,35.552862997776*117.86453458166,35.552777278113*117.864513325,35.552766473227*117.86446726797,35.552736505775*117.86454737482,35.552698143435*117.86450322279,35.552656754479*117.86439803889,35.552648556068*117.86435580454,35.552657051042*117.86419287032,35.55272185848*117.86415962165,35.552688438484*117.86416261156,35.552648244484*117.86406449995,35.552542802285*117.86408438834,35.552530573619*117.86399119241,35.552479040376*117.86394405168,35.552461825234*117.86384485431,35.552363168183*117.86377564942,35.552366615757*117.86373777772,35.552367978947*117.86362441885,35.552283892161*117.86342116617,35.552255071725*117.86338302551,35.552261585156*117.86333289313,35.552245480698*117.86316561105,35.552212046532*117.86305443911,35.552110798519*117.86299204247,35.552056604879*117.86286208062,35.551973512012*117.86295819002,35.551733977395*117.8629611686,35.551656889949*117.86290173716,35.55147378889*117.86286272825,35.551261100822*117.86266329663,35.551156170769*117.86215748558,35.551236064634*117.86206651133,35.551233493092*117.86208230476,35.551217003174*117.86208338545,35.551183077403*117.86210840522,35.551036514951*117.86232875419,35.551007213735*117.86216829792,35.550924477248*117.86209309259,35.550818603359*117.86196395599,35.550703410618*117.86179589874,35.550672010524*117.86161830685,35.550612773995*117.86134699319,35.5504044387*117.86114869767,35.550271350761*117.86118053782,35.550200947881*117.86108436839,35.550074130313*117.86097628181,35.550146859328*117.8609204741,35.550198571253*117.86080231128,35.550257307488*117.86068795202,35.550278819065*117.86076422129,35.550363048662*117.86077109091,35.550571857858*117.86072314367,35.550495412813*117.86073734677,35.550644445505*117.86070738251,35.550604941278*117.86069130749,35.550572316208*117.86067115996,35.550580435746*117.86066407999,35.550579439082*117.86064232034,35.550661912436*117.86068426279,35.550693400705*117.86061429537,35.550736053404*117.86060123034,35.550753578848*117.86060204499,35.550745701242*117.86056202071,35.550754066622*117.86013642307,35.550650773864*117.8599202487,35.550643882111";
$luxian[20] = "117.85593732544,35.565119195748*117.85671580022,35.564618703519";
$luxian[21] = "117.86108436839,35.550074130313*117.8608602359,35.550014310871";
$luxian[22] = "117.8608602359,35.550014310871*117.86082129345,35.550005578398*117.86077309171,35.549992620612*117.86073086892,35.549942147476*117.86065271491,35.549927119399*117.8603676099,35.549861200115*117.86024725282,35.549824963806*117.86006534552,35.549722179982*117.85997985547,35.549718325909*117.85969953052,35.549191006149*117.85957146618,35.549641780074*117.85945028471,35.549522466457*117.85936833538,35.549490317843*117.85938030462,35.549466305314*117.85905087389,35.549298614832*117.85865262945,35.54919454267*117.85867627976,35.549115334127*117.85864471907,35.549146609964*117.85839725461,35.548964555915*117.85833899886,35.54892530373*117.85797104577,35.54887576804*117.85782681229,35.548855567759*117.85755063088,35.548883903015*117.85731256031,35.548913697319*117.85687638213,35.548785839619*117.85673026151,35.548710184466*117.85671339787,35.548718483226*117.85616522408,35.548614485036*117.85579421679,35.548598236286*117.85593807959,35.548551669106*117.85551809121,35.54841205122*117.85527488954,35.548227428317*117.85429408629,35.548172706378*117.85428919211,35.548171657369*117.85423399686,35.54815931295*117.85414617235,35.548132010525*117.85383926993,35.548179778049*117.85357046843,35.548278209596*117.85242537403,35.54806722522*117.8523413489,35.547926082251*117.85212740936,35.547707240558*117.85196650553,35.547587102695*117.85181973319,35.547460356593*117.85173543993,35.547304787662*117.85141695926,35.54712865321*117.85119633698,35.54704015491*117.85102817185,35.546993161611*117.85080240914,35.546897279217*117.84973191523,35.546420215019*117.8495442981,35.546430022356*117.8493406686,35.54643170219*117.84915112414,35.54634458737*117.84897922567,35.546238402878*117.8488632496,35.546119850193*117.84863079429,35.54594049575*117.84824929762,35.545672916968*117.84813543672,35.545409940636*117.84825216117,35.545444467515";
$luxian[23] = "117.84825216117,35.545444467515*117.8485753549,35.545306287014*117.84863617336,35.545334917263*117.84872713257,35.545379755741*117.8488229617,35.545390118277*117.84896766543,35.545414732153*117.84996617762,35.545740080274*117.85008405916,35.545792847613*117.8502796405,35.545897678825*117.85043856108,35.545988779259*117.85060539434,35.546137884238*117.85074123742,35.546220078398*117.85096022662,35.546352088248*117.85206283877,35.546731974502*117.85228191452,35.546881348641*117.85243765652,35.546965386761*117.85257658386,35.547108374616*117.8525956711,35.547249341804*117.8527278191,35.547415681917*117.85294856048,35.547563825759";
$luxian[24] = "117.84825216117,35.545444467515*117.84828116745,35.545379571914";
$luxian[25] = "117.84828116745,35.545379571914*117.84826108762,35.545388561303*117.84814327598,35.545351866727*117.84720514559,35.544840501833*117.8470604403,35.544683783178*117.84685894975,35.544376761406*117.84664005325,35.543983967068*117.84650236858,35.54374414384*117.8457037861,35.542816536213*117.84566383668,35.542691429135*117.8455631832,35.542635459188*117.84552113295,35.54261344676*117.84547311372,35.542586543423*117.84545141243,35.542577569866*117.84543649084,35.542568330955*117.84535756372,35.542550617513*117.84510613535,35.542474902869*117.84510533049,35.54248792529*117.84493690458,35.542431806245*117.84484010384,35.542429764237*117.8447473604,35.542408998508*117.84468661711,35.542394790118*117.84463372851,35.542367025613*117.84444695347,35.542003657851*117.84440816282,35.541971567251*117.84410005698,35.541767431583*117.84407915576,35.541727228725*117.84406395504,35.541698162668*117.8440471092,35.54164223154*117.84402282907,35.541421860315*117.84400597559,35.541355617986*117.84398697492,35.541319758715*117.84422994445,35.541047617784*117.84441426953,35.541013803256*117.84447229508,35.54102449546*117.84484987944,35.54088838652*117.84493032381,35.540769392535*117.84517146154,35.540503809246*117.8452243194,35.540475924546*117.84526633436,35.540452637749*117.8453770088,35.540496709513*117.84538274425,35.54055179475*117.8453976912,35.540594950589*117.84539879941,35.540626968309*117.84547304452,35.540916001568*117.84548614484,35.54103132708*117.84557502552,35.541310597053*117.84559188375,35.541372472722*117.84574393912,35.541627356105*117.84577055577,35.541681366498*117.84578279946,35.541737538124*117.84586243476,35.541981503528*117.8458687097,35.542035500174*117.84602945868,35.542302553701*117.8460555277,35.542347602508*117.84618801269,35.54252454154";
$luxian[26] = "117.84566383668,35.542691429135*117.84618801269,35.54252454154";
$luxian[27] = "117.84618801269,35.54252454154*117.84611131136,35.542617856735*117.84611946241,35.542638750813*117.84619358364,35.542746754908*117.84626033805,35.542786922309*117.84633098935,35.542978753843*117.84650614715,35.543276661702*117.84656881672,35.543283708339*117.84679332403,35.5435253948*117.84679862295,35.54375954036*117.84682440733,35.543777437336*117.847097955,35.543885818694*117.84708984818,35.543940087501*117.84722372662,35.544130726619*117.84722088333,35.544370029654*117.84745346892,35.54444931672*117.84767773326,35.544659878095*117.84824892838,35.544994093971*117.84852831345,35.545155263017";
$luxian[28] = "117.84852831345,35.545155263017*117.8485753549,35.545306287014";
$luxian[29] = "117.8453770088,35.540496709513*117.84497535866,35.539710461427";
$luxian[30] = "117.84497535866,35.539710461427*117.84493292086,35.539554144582";

实际上,这个数组是针对包含许多曲线和弯头的路径的。我在百度 map 上成功画了一条线。但我不知道如何在谷歌地图上绘制它。我在谷歌搜索过。但找不到好的解决办法。再次抱歉,我的问题是空白的,请帮助我。提前致谢。

最佳答案

循环数组,将每对坐标添加为新的 LatLng,然后将其作为路径传递给 Polyline 构造函数。像这样的东西:

<!DOCTYPE html>
<html>
<head>
<title>Draw a polyline given many coordinates</title>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map { height: 80% }
</style>
<script src="http://maps.googleapis.com/maps/api/js?libraries=geometry"></script>

<script>
    function initialize() {             
        var map = new google.maps.Map(document.getElementById("map"), {
            zoom: 13,
            center: {lat: 35.520710018055, lng: 117.82601481119},
            mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        $luxian =   [];
        $luxian[0] = "117.82601481119,35.520710018055*117.82749740937,35.523964274812";
        $luxian[1] = "117.82755348854,35.524426161498*117.82840903478,35.525907227735*117.82851349195,35.52612885859*117.82862091751,35.526346457302*117.82871425816,35.526519881807*117.82882463423,35.526713633235*117.82912224113,35.527249853019*117.82936083635,35.527637281861*117.8295777657,35.527956257082*117.82959887314,35.527996447758*117.82964460687,35.528084204972*117.82966841963,35.528128503632*117.82972307115,35.52822018494*117.82978582455,35.528310080246*117.82990400261,35.52845177136*117.82999756158,35.528552133698*117.83009598521,35.52865337273*117.83014276143,35.528698800257*117.83023713009,35.528794275308*117.8304918434,35.529042557891*117.83059730198,35.529145761049*117.83070357636,35.529252224087*117.83091342166,35.52945667934*117.83096398997,35.529504574745*117.83109216669,35.52962188705*117.8311392124,35.529657518823*117.83156384486,35.530100799832*117.83166310986,35.530203031533*117.83171693299,35.530255827083*117.83182133704,35.530360013618*117.83198254442,35.530519729401*117.83222192856,35.53075448916*117.83225302898,35.530777944285*117.83224194027,35.530768850646*117.83232256693,35.530865917129*117.83242482361,35.53097193098*117.83253140792,35.531079347389*117.83258821924,35.531138115664*117.83264367753,35.531194422866*117.83275216328,35.531306729475*117.83382351239,35.532295382903*117.83402361954,35.532636823132*117.8347117142,35.533501531193*117.834863828,35.5336629671*117.83535724095,35.534137771158*117.83478511666,35.534520381511*117.83468262976,35.534512504632*117.83433491556,35.534507104583*117.8343349828,35.534581180906";
        $luxian[2] = "117.83535724095,35.534137771158*117.83559629285,35.534410974548";
        $luxian[3] = "117.83559629285,35.534410974548*117.83642012405,35.534951814146*117.83666409631,35.535215894638*117.83661009513,35.535029265199*117.83697421406,35.535006751517*117.83721201313,35.534985486238*117.83738216649,35.534946507764*117.83769119111,35.534962645599*117.83790232624,35.535032731492*117.83833733476,35.53515361727*117.83868574452,35.535236532202*117.83901199701,35.535327323366*117.83926898551,35.535429761456*117.83951384003,35.535567334115*117.83977308187,35.53572936344*117.83997925535,35.535873370189*117.84063135148,35.536221226176*117.84132305853,35.536508914883*117.84165362919,35.536620910474*117.84214159122,35.536678108372*117.84239978837,35.536666655527*117.84269237452,35.536604251683*117.84293536865,35.536513382065*117.84316644567,35.536411565169*117.84331493548,35.536379730076*117.84359117618,35.536446182241*117.84378236108,35.536554405992*117.84403872953,35.536796786407*117.84413368824,35.536890068161*117.84435993181,35.537066095916*117.84461023856,35.537146063224*117.84487436485,35.537193972907";
        $luxian[4] = "117.84487436485,35.537193972907*117.84489839819,35.537399409632*117.84457972167,35.537613521087*117.8443068158,35.537738630212*117.84414232927,35.537820768424*117.84406306015,35.538014052987*117.84415668092,35.538132020099*117.84433218176,35.538257201083*117.84444290125,35.538390371004*117.84443815979,35.538562658433*117.84440928361,35.53872865849*117.84433985952,35.539044894845*117.84438007806,35.539515191067*117.844610709,35.539753303442";
        $luxian[5] = "117.84487436485,35.537193972907*117.84513877002,35.537226891961";
        $luxian[6] = "117.84513877002,35.537226891961*117.84523526805,35.537180878861*117.84536974707,35.53714981909*117.84553133594,35.537100856933*117.84569970026,35.537037221925*117.84596595686,35.536938874715*117.84621921793,35.536845340461*117.84637649771,35.536786205469*117.84652130912,35.536730846648*117.84673664062,35.536650212889*117.84688310958,35.536611896969*117.84695580646,35.536595851883*117.84716443082,35.536572113327*117.84734702616,35.536556768162*117.84744956024,35.536516240264*117.84752845837,35.536439911459*117.84748626954,35.536290991537*117.84742758311,35.536205036836*117.8473944169,35.536133978291*117.84743203834,35.536024049209*117.84753293418,35.535969676141*117.84765855334,35.535945110868*117.84779126379,35.535955795004*117.84791830728,35.535997403152*117.8480958627,35.536069847075*117.84821152161,35.536115507918*117.84846287651,35.53613755978*117.84862867453,35.536079964334*117.84885916058,35.536105763799*117.84907997791,35.536234103587*117.84924187032,35.536334340163*117.84944338503,35.536405674452*117.84963814285,35.536499783483*117.85007467428,35.53669342636*117.85024856378,35.536796992494*117.8504743388,35.536905483975*117.85097549437,35.536951706347*117.85117624513,35.536966546271*117.85130906904,35.536952636036*117.85158966016,35.536908683333*117.85188332254,35.536873814708*117.85208630121,35.536892000419*117.85232007414,35.537001416332*117.85250792539,35.537097210978*117.85280889733,35.537262025915*117.85320259995,35.537457098306*117.85345983115,35.537581043616*117.85376279819,35.537765392653*117.85388870817,35.537822578699*117.85408773486,35.537858603368*117.8542383579,35.537869444347*117.85439061471,35.53787591167*117.85461059691,35.53790300455*117.85484718596,35.537938878282*117.85506231363,35.537982745573*117.85527446437,35.538029582098*117.85547439854,35.538088693064*117.85571654525,35.538204386538*117.85605366846,35.538362871551*117.85617695685,35.538449677905*117.85637399852,35.538576496191*117.85653782006,35.538651767305*117.85697800494,35.538662776836*117.85739427643,35.538652161115*117.85750829481,35.53866485072*117.85760027977,35.538682638678*117.85778184189,35.538762446755*117.85787168621,35.538818495092*117.85798197282,35.538913394768*117.85816719322,35.539126333838*117.85822742481,35.539238566274*117.85825439211,35.539270295098*117.85832463973,35.53931241152*117.85841064785,35.53932125081*117.85849145716,35.539292154328*117.85859858958,35.539161827983*117.85868232332,35.539039619856*117.85877151206,35.538930369635*117.85891539588,35.538800421872*117.85911461197,35.538759913353*117.85927276864,35.538764617522*117.8597110584,35.538770905842*117.85993429345,35.538761737708*117.86020166804,35.538779130106*117.86042114464,35.538807101849*117.86057800171,35.538832021075*117.86078442169,35.538855214534*117.86103877989,35.538880209039*117.86141759879,35.538891875675*117.86163384893,35.538901524816*117.86189206427,35.538925778045*117.86202636222,35.538950842461*117.86216856333,35.538976602188*117.86225791904,35.538994384646*117.86239714368,35.539037257759*117.86249115211,35.539078026586*117.86253421152,35.53910402551*117.86260644732,35.539167064879*117.86270078761,35.539279720043*117.86274907199,35.539367233365*117.8627889185,35.539463545287*117.86284025098,35.539618032513*117.86289239648,35.539767351154*117.86293578275,35.539861710183*117.86299388204,35.53995884599*117.86306805692,35.540058737778*117.863189418,35.540232031676*117.86326256094,35.540407901542*117.86333102625,35.540520885879*117.86341016614,35.54070100441*117.86356586431,35.54088056115*117.86371203196,35.541063497037*117.86385056859,35.541240019178*117.86397085024,35.541414354996*117.86407914361,35.541587772966*117.86434090636,35.541846821829*117.86448245268,35.542026774444*117.86451165811,35.542098239542*117.86445342563,35.542220119722*117.86439242584,35.542278277685*117.86435432073,35.542343961999*117.86442688693,35.542469862434*117.86450375835,35.542511856345*117.86471119134,35.542601538564*117.86484252389,35.54257513776*117.86502289867,35.542527089667*117.86512101443,35.542538345702*117.86523223862,35.542588466245*117.86529877484,35.542647407282*117.8654040361,35.542743734251*117.86555456297,35.542874354714*117.86562355929,35.542940300506*117.86568574301,35.543007163854*117.86571198245,35.543124780226*117.86569895248,35.5432080077*117.86572407336,35.543281686984*117.86580150951,35.54333148661*117.86590453038,35.543322548088*117.86600071852,35.543281153169*117.86614680084,35.54326040021*117.86622423315,35.543296074873*117.86626245951,35.543402369544*117.86621129266,35.543526631256*117.86617836518,35.543613974853*117.86619154597,35.543774116388*117.86632978028,35.543839754231*117.8663962825,35.543828657565*117.86651320345,35.543801559848*117.86662246488,35.543726554831*117.86669990789,35.543772250269*117.866736755,35.543850611902*117.86676489291,35.543952175149*117.86679003376,35.544056770676*117.86682745685,35.54418829955*117.86686157554,35.544263718114*117.86705220028,35.544396291558*117.86710238339,35.544437530754*117.867339799,35.544389163774*117.86742104253,35.544395972941*117.86750315072,35.54448253228*117.86753540029,35.54462308698*117.86754475014,35.544765916898*117.86755163996,35.54489874829*117.86755169003,35.544989095469*117.86752884122,35.545082532236*117.86741137797,35.545147676572*117.8673091569,35.545165357066*117.86717177657,35.545193915649*117.8670504865,35.545230072846*117.86696735839,35.545258823003*117.86686625046,35.545307394941*117.866707617,35.545337352764*117.86660838268,35.545315069548*117.86643719702,35.545309123565*117.86633308769,35.545337912081*117.86622979004,35.545352574171*117.86608424458,35.545364370679*117.8660111937,35.545357653302*117.86579566076,35.545471457516*117.86585782619,35.545514437887*117.86606935269,35.545550726442*117.86622284944,35.54562806705*117.86636434674,35.545687680357*117.86644342571,35.545747466219*117.86660183862,35.54582849846*117.866756164,35.545905786183*117.8668464104,35.545940416428*117.86701300463,35.546011518844*117.86719134197,35.546117145105*117.86727070448,35.546182864555*117.86737706478,35.546265231826*117.86740625272,35.546301651928*117.86752678956,35.546381609284*117.86764183196,35.546372390005*117.86769198595,35.546353656113*117.867846281,35.546326685992*117.86795969881,35.546330772405*117.86806603845,35.546352877936*117.86815711796,35.546388256631*117.86820132524,35.54646836819*117.86813211279,35.546548746678*117.86800672416,35.546602113731*117.86785654798,35.546697938184*117.86776142577,35.546752689654*117.8676701217,35.546808188205*117.86752375332,35.546872999436*117.86744743224,35.54689948426*117.86734437525,35.546882180903*117.8671398867,35.546816875883*117.86683691086,35.546573265225*117.86677175258,35.546556137536*117.86672269699,35.546578902793*117.86671261512,35.546587204124*117.86671561503,35.546590140305*117.8667085431,35.546622268415*117.86676064964,35.546709334419*117.86684110883,35.546802181941*117.86694528293,35.546891387085*117.86705763481,35.546977470055*117.86723924035,35.547084394475*117.86736958417,35.547160943525*117.8674587523,35.547210487783*117.8676553682,35.5473342246*117.86776066239,35.547470037627*117.86782125682,35.547632089134*117.86787227047,35.547705309816*117.86799254421,35.547803423458*117.86810191271,35.547899271189*117.86818020364,35.548001873402*117.86821322337,35.548074301953*117.86818246061,35.548187135531*117.86803391161,35.548287010961*117.86795600576,35.548459498267*117.86802801061,35.548533179706*117.86804520258,35.548573859873*117.86808640886,35.548672197966*117.86811317376,35.548794107983*117.8681233065,35.548914938577*117.8681394384,35.549040552144*117.86821392981,35.549207241311*117.86825294539,35.549284722368*117.86835033196,35.549433117884*117.86841251901,35.549500169349*117.86858815724,35.549646968034*117.86871661839,35.5497655245*117.86885190346,35.549903220682*117.86895936312,35.549995263088*117.86915380892,35.550096668586*117.86929723974,35.550108051229*117.86948265033,35.550069600858*117.86962936576,35.550104784427*117.86976766569,35.55025730523*117.86981486596,35.550339504565*117.86981680263,35.550433609744*117.86974973987,35.550499608566*117.86960332591,35.550567517124*117.86950489898,35.550610448324*117.86941192885,35.550661421259*117.86936448129,35.550657081001*117.86922544431,35.550758755369*117.86913714648,35.550936603513*117.86911427636,35.551066128131*117.86914813169,35.551236734022*117.86914353836,35.551405825521*117.86911740184,35.551572300125*117.86911743199,35.551701703811*117.86915454271,35.551822064263*117.86923992215,35.551969541007*117.86932502708,35.552109966096*117.86933104985,35.552225972957*117.86917373573,35.552324971363*117.86893406817,35.552372190286*117.8688498259,35.552430048183*117.86881164952,35.552411705812*117.8688127265,35.552341696184*117.86894909264,35.552517343093*117.86913071386,35.552643922101*117.86918199599,35.552754000911*117.86915583369,35.552836646476*117.86904541608,35.55292072869*117.86890909269,35.552983272832*117.86878585631,35.553029582736*117.86874795653,35.55303022466*117.86860535496,35.553022055121*117.8685161931,35.552998600403*117.86830243641,35.553002734122*117.8681500571,35.553182429722*117.86814325432,35.553269624379*117.86818444691,35.553432789503*117.86825343486,35.553498641735*117.86831479495,35.553608838348*117.86830472273,35.553730811269*117.86826465383,35.553811780803*117.86819159759,35.553915003361*117.8681482621,35.55404404142*117.86805012335,35.554150933401*117.86783038588,35.554203955858*117.8677052508,35.554215248941*117.86750679128,35.554311836704*117.86739747973,35.554394741326*117.86727917251,35.554469106719*117.86719794351,35.55456863313*117.86715270385,35.554735389602*117.86714071807,35.554860913015*117.86716689674,35.554994495881*117.86716581565,35.55516134597*117.86713011054,35.555290238408*117.86695646724,35.555382303673*117.86681090227,35.555409068984*117.86662254563,35.555475302512*117.86650043244,35.555600684308*117.8664584592,35.555765472381*117.86629382691,35.556013318836*117.86614773012,35.556217184338*117.86602235015,35.556316546359*117.86586889926,35.556380261799*117.86567348021,35.556384397746*117.8654129311,35.556352899047*117.86523551311,35.556325788538*117.86506709314,35.556321581866*117.8649060358,35.556295275748*117.86476841842,35.556223843049*117.86466323131,35.556066192277*117.86458011716,35.555914443674*117.86448474295,35.555883317349*117.86428446362,35.555917490964*117.86416620753,35.556019607814*117.86401716377,35.556087988252*117.86384469132,35.55605768415*117.86369837915,35.55595618316*117.8635733204,35.555803093598";
        $luxian[7] = "117.8635733204,35.555803093598*117.86337961522,35.556119186148*117.86356324229,35.55641955935*117.86387465802,35.556615514908*117.86401905871,35.556877616416*117.86403322556,35.556923252365*117.86419942807,35.557112861516*117.86433266536,35.557251675058*117.86435963521,35.557360322179*117.86418958809,35.557609145396*117.86405414716,35.557854459546*117.86389990436,35.558117397083*117.86378463197,35.558309227086*117.86341594833,35.558770252318*117.86315547188,35.55896871844*117.86299226862,35.559107459601*117.86288792222,35.55917375128*117.86281981006,35.559229223939*117.86274379051,35.559335527905*117.86267049495,35.559445316643*117.86262852153,35.559580167148*117.86258029164,35.559663835867*117.8624642315,35.559768778269*117.86234599472,35.559871571544*117.86227079163,35.559998997942*117.86235901655,35.560137762057*117.86254641032,35.560197853071*117.8627335374,35.56026199409*117.86285582526,35.560376115352*117.86295795275,35.560505699749*117.86307206667,35.560641075966*117.86317718809,35.560792303501*117.86325450576,35.561009018139*117.86320242498,35.561190135471*117.86309504202,35.561364979306*117.8629658735,35.561512996888*117.86277842627,35.561607024266*117.86257220612,35.56164324215*117.86235891852,35.561656473713*117.86207044766,35.561729006704*117.86189989664,35.561897834964*117.861902877,35.561950687445*117.86194809704,35.561925129035*117.86131911834,35.562339729132*117.86094842701,35.562537877726*117.86034983921,35.562806827266*117.8601594949,35.562889437445*117.85995441097,35.563102392329*117.85991407938,35.56321082776";
        $luxian[8] = "117.85991407938,35.56321082776*117.85980125598,35.563326853216";
        $luxian[9] = "117.85980125598,35.563326853216*117.85953722698,35.563574935473*117.85936757262,35.563733888321*117.85937255228,35.563831818992*117.85947990596,35.5638875667*117.85970667935,35.563958898768*117.85974675638,35.564124404303*117.85956907662,35.564246480915*117.85927803955,35.564294850837*117.85907637752,35.564217162792*117.8589148306,35.564211985386*117.85875124005,35.564311797423*117.8587481811,35.564429816158*117.85897389921,35.564530280502*117.85919159659,35.56464079628*117.85930490523,35.564833470816*117.85930781316,35.565065405423*117.85924847107,35.565367044694*117.85922638363,35.565391294359*117.859067793,35.565491086801*117.85890620881,35.565566897146*117.85881486877,35.565635907816*117.85873355157,35.565730797194*117.85865325809,35.565785676088*117.85853483672,35.565847966*117.85844548589,35.56596692115*117.85834611352,35.566065981028*117.85828686485,35.566180600648*117.85832994362,35.566302118616*117.8584804694,35.566232500002*117.85860996464,35.566094105549*117.85858091118,35.566007437625*117.85853979345,35.565970893247*117.85875248553,35.565998546948*117.85892810769,35.565933596779*117.85908665939,35.565907810975";
        $luxian[10] = "117.8635733204,35.555803093598*117.86349485374,35.555738302886";
        $luxian[11] = "117.86349485374,35.555738302886*117.86337569672,35.555771374965";
        $luxian[12] = "117.86337569672,35.555771374965*117.86330037186,35.555731448339*117.86322203512,35.555693560974*117.86304929625,35.555608001032";
        $luxian[13] = "117.86349485374,35.555738302886*117.86356594991,35.555355874953*117.86354714935,35.555321965223*117.86353597784,35.555298253943*117.86351908308,35.555237460563*117.86349074501,35.555168964269*117.86350981393,35.555125558299*117.86352289029,35.55510529634*117.86349891236,35.555061694479*117.86345368202,35.554991269513*117.86343951397,35.554976552385*117.86342970562,35.554970724763*117.86341689969,35.55495381776*117.86340273171,35.554939100307*117.86336350097,35.554951596606*117.86325125212,35.554883477311*117.86323735504,35.554841627212*117.86325832689,35.554764558935*117.86327738997,35.5546687995*117.86326240004,35.55459603969*117.86323432679,35.554453476368*117.86321306225,35.554298879562*117.86324220798,35.554252349117*117.8633443579,35.554119597952*117.8634797435,35.553955166988*117.86359499774,35.554026483888*117.86366093197,35.554030415535*117.86376719184,35.55404189822*117.86389442957,35.554017531072*117.86393665685,35.553972153854*117.86398242968,35.553954122711*117.86403964828,35.553949215071*117.86410776932,35.553968288899*117.86417071065,35.553958138465*117.86419195781,35.553904654601*117.8642633451,35.553878370752*117.86426334415,35.553870503706*117.86427396858,35.553850271872*117.86427696198,35.553818216736*117.86431320312,35.553822562753*117.86433036204,35.553760456797";
        $luxian[14] = "117.86442329804,35.553899054951*117.86452363339,35.55395055583";
        $luxian[15] = "117.86452363339,35.55395055583*117.8647978804,35.553983437387*117.8650158746,35.553958132326*117.86527003377,35.553847243479";
        $luxian[16] = "117.86527003377,35.553847243479*117.86535336958,35.553776185598";
        $luxian[17] = "117.86535336958,35.553776185598*117.86538225181,35.553725554192*117.86537625337,35.553704758177*117.86538224677,35.553686490148*117.86538224298,35.553657463378*117.86541439509,35.553604068201*117.86543646701,35.553577684744*117.8654648121,35.553586199105*117.86549561027,35.553595488933*117.86552368161,35.553593155494*117.8655558416,35.553593742339*117.86561089271,35.553573898624*117.86565394248,35.553483707373*117.86574904856,35.553389990804*117.86579046914,35.553340513747*117.86570407115,35.553344031798*117.8656830819,35.553323470075*117.86511972189,35.553136835498*117.86512652869,35.553097395746*117.86505649421,35.553120709352";
        $luxian[18] = "117.86505649421,35.553120709352*117.86514560985,35.553125317417";
        $luxian[19] = "117.86514560985,35.553125317417*117.86505241089,35.553148984815*117.86503741783,35.553120999951*117.86502542384,35.553101379026*117.86499653339,35.553079844773*117.86498535742,35.553062923951*117.86493820432,35.55301562324*117.86490523049,35.553018293565*117.8648692557,35.55299984875*117.86476704738,35.552898577151*117.86474496885,35.552866898674*117.86473379541,35.552862997776*117.86453458166,35.552777278113*117.864513325,35.552766473227*117.86446726797,35.552736505775*117.86454737482,35.552698143435*117.86450322279,35.552656754479*117.86439803889,35.552648556068*117.86435580454,35.552657051042*117.86419287032,35.55272185848*117.86415962165,35.552688438484*117.86416261156,35.552648244484*117.86406449995,35.552542802285*117.86408438834,35.552530573619*117.86399119241,35.552479040376*117.86394405168,35.552461825234*117.86384485431,35.552363168183*117.86377564942,35.552366615757*117.86373777772,35.552367978947*117.86362441885,35.552283892161*117.86342116617,35.552255071725*117.86338302551,35.552261585156*117.86333289313,35.552245480698*117.86316561105,35.552212046532*117.86305443911,35.552110798519*117.86299204247,35.552056604879*117.86286208062,35.551973512012*117.86295819002,35.551733977395*117.8629611686,35.551656889949*117.86290173716,35.55147378889*117.86286272825,35.551261100822*117.86266329663,35.551156170769*117.86215748558,35.551236064634*117.86206651133,35.551233493092*117.86208230476,35.551217003174*117.86208338545,35.551183077403*117.86210840522,35.551036514951*117.86232875419,35.551007213735*117.86216829792,35.550924477248*117.86209309259,35.550818603359*117.86196395599,35.550703410618*117.86179589874,35.550672010524*117.86161830685,35.550612773995*117.86134699319,35.5504044387*117.86114869767,35.550271350761*117.86118053782,35.550200947881*117.86108436839,35.550074130313*117.86097628181,35.550146859328*117.8609204741,35.550198571253*117.86080231128,35.550257307488*117.86068795202,35.550278819065*117.86076422129,35.550363048662*117.86077109091,35.550571857858*117.86072314367,35.550495412813*117.86073734677,35.550644445505*117.86070738251,35.550604941278*117.86069130749,35.550572316208*117.86067115996,35.550580435746*117.86066407999,35.550579439082*117.86064232034,35.550661912436*117.86068426279,35.550693400705*117.86061429537,35.550736053404*117.86060123034,35.550753578848*117.86060204499,35.550745701242*117.86056202071,35.550754066622*117.86013642307,35.550650773864*117.8599202487,35.550643882111";
        $luxian[20] = "117.85593732544,35.565119195748*117.85671580022,35.564618703519";
        $luxian[21] = "117.86108436839,35.550074130313*117.8608602359,35.550014310871";
        $luxian[22] = "117.8608602359,35.550014310871*117.86082129345,35.550005578398*117.86077309171,35.549992620612*117.86073086892,35.549942147476*117.86065271491,35.549927119399*117.8603676099,35.549861200115*117.86024725282,35.549824963806*117.86006534552,35.549722179982*117.85997985547,35.549718325909*117.85969953052,35.549191006149*117.85957146618,35.549641780074*117.85945028471,35.549522466457*117.85936833538,35.549490317843*117.85938030462,35.549466305314*117.85905087389,35.549298614832*117.85865262945,35.54919454267*117.85867627976,35.549115334127*117.85864471907,35.549146609964*117.85839725461,35.548964555915*117.85833899886,35.54892530373*117.85797104577,35.54887576804*117.85782681229,35.548855567759*117.85755063088,35.548883903015*117.85731256031,35.548913697319*117.85687638213,35.548785839619*117.85673026151,35.548710184466*117.85671339787,35.548718483226*117.85616522408,35.548614485036*117.85579421679,35.548598236286*117.85593807959,35.548551669106*117.85551809121,35.54841205122*117.85527488954,35.548227428317*117.85429408629,35.548172706378*117.85428919211,35.548171657369*117.85423399686,35.54815931295*117.85414617235,35.548132010525*117.85383926993,35.548179778049*117.85357046843,35.548278209596*117.85242537403,35.54806722522*117.8523413489,35.547926082251*117.85212740936,35.547707240558*117.85196650553,35.547587102695*117.85181973319,35.547460356593*117.85173543993,35.547304787662*117.85141695926,35.54712865321*117.85119633698,35.54704015491*117.85102817185,35.546993161611*117.85080240914,35.546897279217*117.84973191523,35.546420215019*117.8495442981,35.546430022356*117.8493406686,35.54643170219*117.84915112414,35.54634458737*117.84897922567,35.546238402878*117.8488632496,35.546119850193*117.84863079429,35.54594049575*117.84824929762,35.545672916968*117.84813543672,35.545409940636*117.84825216117,35.545444467515";
        $luxian[23] = "117.84825216117,35.545444467515*117.8485753549,35.545306287014*117.84863617336,35.545334917263*117.84872713257,35.545379755741*117.8488229617,35.545390118277*117.84896766543,35.545414732153*117.84996617762,35.545740080274*117.85008405916,35.545792847613*117.8502796405,35.545897678825*117.85043856108,35.545988779259*117.85060539434,35.546137884238*117.85074123742,35.546220078398*117.85096022662,35.546352088248*117.85206283877,35.546731974502*117.85228191452,35.546881348641*117.85243765652,35.546965386761*117.85257658386,35.547108374616*117.8525956711,35.547249341804*117.8527278191,35.547415681917*117.85294856048,35.547563825759";
        $luxian[24] = "117.84825216117,35.545444467515*117.84828116745,35.545379571914";
        $luxian[25] = "117.84828116745,35.545379571914*117.84826108762,35.545388561303*117.84814327598,35.545351866727*117.84720514559,35.544840501833*117.8470604403,35.544683783178*117.84685894975,35.544376761406*117.84664005325,35.543983967068*117.84650236858,35.54374414384*117.8457037861,35.542816536213*117.84566383668,35.542691429135*117.8455631832,35.542635459188*117.84552113295,35.54261344676*117.84547311372,35.542586543423*117.84545141243,35.542577569866*117.84543649084,35.542568330955*117.84535756372,35.542550617513*117.84510613535,35.542474902869*117.84510533049,35.54248792529*117.84493690458,35.542431806245*117.84484010384,35.542429764237*117.8447473604,35.542408998508*117.84468661711,35.542394790118*117.84463372851,35.542367025613*117.84444695347,35.542003657851*117.84440816282,35.541971567251*117.84410005698,35.541767431583*117.84407915576,35.541727228725*117.84406395504,35.541698162668*117.8440471092,35.54164223154*117.84402282907,35.541421860315*117.84400597559,35.541355617986*117.84398697492,35.541319758715*117.84422994445,35.541047617784*117.84441426953,35.541013803256*117.84447229508,35.54102449546*117.84484987944,35.54088838652*117.84493032381,35.540769392535*117.84517146154,35.540503809246*117.8452243194,35.540475924546*117.84526633436,35.540452637749*117.8453770088,35.540496709513*117.84538274425,35.54055179475*117.8453976912,35.540594950589*117.84539879941,35.540626968309*117.84547304452,35.540916001568*117.84548614484,35.54103132708*117.84557502552,35.541310597053*117.84559188375,35.541372472722*117.84574393912,35.541627356105*117.84577055577,35.541681366498*117.84578279946,35.541737538124*117.84586243476,35.541981503528*117.8458687097,35.542035500174*117.84602945868,35.542302553701*117.8460555277,35.542347602508*117.84618801269,35.54252454154";
        $luxian[26] = "117.84566383668,35.542691429135*117.84618801269,35.54252454154";
        $luxian[27] = "117.84618801269,35.54252454154*117.84611131136,35.542617856735*117.84611946241,35.542638750813*117.84619358364,35.542746754908*117.84626033805,35.542786922309*117.84633098935,35.542978753843*117.84650614715,35.543276661702*117.84656881672,35.543283708339*117.84679332403,35.5435253948*117.84679862295,35.54375954036*117.84682440733,35.543777437336*117.847097955,35.543885818694*117.84708984818,35.543940087501*117.84722372662,35.544130726619*117.84722088333,35.544370029654*117.84745346892,35.54444931672*117.84767773326,35.544659878095*117.84824892838,35.544994093971*117.84852831345,35.545155263017";
        $luxian[28] = "117.84852831345,35.545155263017*117.8485753549,35.545306287014";
        $luxian[29] = "117.8453770088,35.540496709513*117.84497535866,35.539710461427";
        $luxian[30] = "117.84497535866,35.539710461427*117.84493292086,35.539554144582";

        var path = [];
        for (var i = 0; i < $luxian.length; i++) {
            // split this array element into another array, delimited on the *
            var subluxian = $luxian[i].split("*");

            for (var j = 0; j < subluxian.length; j++) {
                // now split it into the lat and lng
                var coords = subluxian[j].split(",");
                // add the coords into the path
                path.push(new google.maps.LatLng(parseFloat(coords[1]), parseFloat(coords[0])));
            }
        }
        var line = new google.maps.Polyline({
            path: path,
            strokeColor: "#FF0000",
            strokeOpacity: 1.0,
            strokeWeight: 1,
            geodesic: true,
            map: map
        });
    }

    google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
  <div id="map"></div>
</body>
</html>

您可能可以修改它以缩放以适合您的路径边界。

关于javascript - 在 Google map javascript API 上画线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20001490/

相关文章:

javascript - 如何使用 JavaScript 或 Selenium 检查页面上是否存在警报

css - 如何在 google map api 3 中更改标记的颜色

javascript - 如何在Google map 中搜索指定区域内的地点

javascript - Google map v3 fitBounds 缩放不一致

javascript - 带有可点击侧边栏的 Google map

javascript - AmCharts.makeChart 属性没有效果

php - 移动新 html 页面的渲染元素

javascript - JQuery 多次提取字符串

google-maps - 使用字段 "locality"进行地理编码组件过滤未按预期工作

java - 已停止申请! GOOGLE API V2 - map