How to get value in JS object? - javascript

I just give an example of a script that suddenly stopped working. The problem is that i cant get any values from this object, although in the past there were no problems.
var points = '{"points":{"point":[{"lat":"55.68504841066897","lon":"21.128827091306448"},{"lat":"55.68509585224092","lon":"21.128621818497777"},{"lat":"55.68510725162923","lon":"21.128564486280084"},{"lat":"55.685256784781814","lon":"21.128428364172578"},{"lat":"55.68540941923857","lon":"21.12827841192484"},{"lat":"55.68553472869098","lon":"21.12819341942668"},{"lat":"55.68563086912036","lon":"21.128090489655733"},{"lat":"55.685754250735044","lon":"21.128079341724515"},{"lat":"55.685868579894304","lon":"21.12806241028011"},{"lat":"55.686048371717334","lon":"21.127971885725856"},{"lat":"55.68620461039245","lon":"21.12780307419598"},{"lat":"55.686277113854885","lon":"21.127677345648408"},{"lat":"55.68637593649328","lon":"21.12757139839232"},{"lat":"55.68648599088192","lon":"21.127493027597666"},{"lat":"55.68663602694869","lon":"21.127418177202344"},{"lat":"55.68679201416671","lon":"21.12734558992088"},{"lat":"55.686920089647174","lon":"21.12726939842105"},{"lat":"55.68693928420544","lon":"21.127255652099848"},{"lat":"55.68705772049725","lon":"21.127218855544925"},{"lat":"55.68714472465217","lon":"21.127141742035747"},{"lat":"55.6871934235096","lon":"21.12712439149618"},{"lat":"55.68733625113964","lon":"21.127151465043426"},{"lat":"55.68751168437302","lon":"21.12717761658132"},{"lat":"55.687646800652146","lon":"21.127120200544596"},{"lat":"55.68781033158302","lon":"21.127034788951278"},{"lat":"55.687981490045786","lon":"21.12691568210721"},{"lat":"55.68808760493994","lon":"21.126865474507213"},{"lat":"55.68817662075162","lon":"21.126789785921574"},{"lat":"55.68830654025078","lon":"21.12668802961707"},{"lat":"55.688458336517215","lon":"21.126597672700882"},{"lat":"55.68859001621604","lon":"21.126522067934275"},{"lat":"55.68873468786478","lon":"21.126421485096216"},{"lat":"55.689044734463096","lon":"21.126208417117596"},{"lat":"55.68912017159164","lon":"21.126169441267848"},{"lat":"55.68925394676626","lon":"21.1261201556772"},{"lat":"55.68945947103202","lon":"21.12605821341276"},{"lat":"55.68962057121098","lon":"21.125976908951998"},{"lat":"55.68978569470346","lon":"21.125826286152005"},{"lat":"55.68990069441497","lon":"21.125754453241825"},{"lat":"55.68995366804302","lon":"21.125659067183733"},{"lat":"55.69000102579594","lon":"21.1256090272218"},{"lat":"55.69016573019326","lon":"21.1255088634789"},{"lat":"55.690477369353175","lon":"21.12531390041113"},{"lat":"55.69060888141394","lon":"21.125247851014137"},{"lat":"55.69067928940058","lon":"21.12515070475638"},{"lat":"55.6907766032964","lon":"21.124989185482264"},{"lat":"55.69090216420591","lon":"21.1248526442796"},{"lat":"55.69097299128771","lon":"21.124745020642877"},{"lat":"55.691056391224265","lon":"21.124557433649898"},{"lat":"55.69115781225264","lon":"21.124385772272944"},{"lat":"55.6912134680897","lon":"21.124245207756758"},{"lat":"55.691240122541785","lon":"21.124201118946075"},{"lat":"55.69127884693444","lon":"21.124075977131724"},{"lat":"55.69134992547333","lon":"21.12395158968866"},{"lat":"55.69142796099186","lon":"21.123761823400855"},{"lat":"55.691470289602876","lon":"21.123608015477657"},{"lat":"55.691630467772484","lon":"21.123296124860644"},{"lat":"55.69177580997348","lon":"21.123084481805563"},{"lat":"55.691883098334074","lon":"21.12299303524196"},{"lat":"55.691998517140746","lon":"21.122908294200897"},{"lat":"55.692141177132726","lon":"21.122815422713757"},{"lat":"55.6923047080636","lon":"21.12273939885199"},{"lat":"55.692533031105995","lon":"21.122592883184552"},{"lat":"55.69262858480215","lon":"21.122528091073036"},{"lat":"55.692712320014834","lon":"21.1224711779505"},{"lat":"55.69280887953937","lon":"21.122405463829637"},{"lat":"55.69282790645957","lon":"21.12241141498089"},{"lat":"55.69290057756007","lon":"21.122407307848334"},{"lat":"55.69293066859245","lon":"21.12237486988306"},{"lat":"55.69301373325288","lon":"21.122297504916787"},{"lat":"55.69308330304921","lon":"21.122258696705103"},{"lat":"55.69318933412433","lon":"21.121885618194938"},{"lat":"55.693208780139685","lon":"21.121837757527828"},{"lat":"55.69326653145254","lon":"21.121622258797288"},{"lat":"55.693393936380744","lon":"21.121310954913497"},{"lat":"55.693441880866885","lon":"21.121110962703824"},{"lat":"55.69349527359009","lon":"21.120854392647743"},{"lat":"55.69358579814434","lon":"21.120616095140576"},{"lat":"55.69369417615235","lon":"21.12032457254827"},{"lat":"55.69377011619508","lon":"21.120052495971322"},{"lat":"55.693774642422795","lon":"21.120002456009388"},{"lat":"55.693801464512944","lon":"21.11992777325213"},{"lat":"55.693983267992735","lon":"21.119664330035448"},{"lat":"55.69409340620041","lon":"21.119460901245475"},{"lat":"55.69415652193129","lon":"21.11929250881076"},{"lat":"55.69417831487954","lon":"21.119207181036472"},{"lat":"55.69424897432327","lon":"21.118967961519957"},{"lat":"55.694260792806745","lon":"21.118934266269207"},{"lat":"55.69426699541509","lon":"21.118877101689577"},{"lat":"55.69431468844414","lon":"21.11856361851096"},{"lat":"55.69434058852494","lon":"21.118531934916973"},{"lat":"55.69443111307919","lon":"21.118354992941022"},{"lat":"55.69457972422242","lon":"21.1182370595634"},{"lat":"55.69472850300372","lon":"21.118099931627512"},{"lat":"55.694737220183015","lon":"21.118061039596796"},{"lat":"55.69480947218835","lon":"21.117927934974432"},{"lat":"55.69499395787716","lon":"21.117815114557743"},{"lat":"55.69512295536697","lon":"21.11766935326159"},{"lat":"55.69523921236396","lon":"21.11754127778113"},{"lat":"55.695358319208026","lon":"21.117476485669613"},{"lat":"55.695498967543244","lon":"21.117387553676963"},{"lat":"55.69560918956995","lon":"21.11733608879149"},{"lat":"55.69572452455759","lon":"21.117292754352093"},{"lat":"55.695821000263095","lon":"21.11724623478949"},{"lat":"55.695909429341555","lon":"21.117141377180815"},{"lat":"55.696009173989296","lon":"21.117025455459952"},{"lat":"55.69604102522135","lon":"21.117006093263626"},{"lat":"55.696090226992965","lon":"21.116960495710373"},{"lat":"55.69625677540898","lon":"21.116869132965803"},{"lat":"55.69637831300497","lon":"21.116807106882334"},{"lat":"55.69654083810747","lon":"21.11673066392541"},{"lat":"55.696675116196275","lon":"21.116644330322742"},{"lat":"55.69678684696555","lon":"21.116551458835602"},{"lat":"55.69688340649009","lon":"21.116469986736774"},{"lat":"55.697014667093754","lon":"21.116367476060987"},{"lat":"55.69704534485936","lon":"21.11634660512209"},{"lat":"55.69713561795652","lon":"21.116271084174514"},{"lat":"55.69718171842396","lon":"21.116163125261664"},{"lat":"55.69733996875584","lon":"21.116052316501737"},{"lat":"55.697473073378205","lon":"21.11595081165433"},{"lat":"55.697658313438296","lon":"21.115931114181876"},{"lat":"55.69781731814146","lon":"21.115811336785555"},{"lat":"55.69795947521925","lon":"21.115705221891403"},{"lat":"55.698050586506724","lon":"21.115594832226634"},{"lat":"55.69814337417483","lon":"21.115462817251682"},{"lat":"55.69816265255213","lon":"21.115436078980565"},{"lat":"55.69827714934945","lon":"21.11534840427339"},{"lat":"55.69821269251406","lon":"21.115194596350193"},{"lat":"55.69802870973945","lon":"21.11485881730914"},{"lat":"55.69793617352843","lon":"21.114696208387613"},{"lat":"55.69779242388904","lon":"21.114436956122518"},{"lat":"55.697687985375524","lon":"21.114247357472777"},{"lat":"55.69759452715516","lon":"21.11412481404841"},{"lat":"55.697459829971194","lon":"21.113973017781973"},{"lat":"55.69730476476252","lon":"21.11382189206779"},{"lat":"55.69720124825835","lon":"21.113727260380983"},{"lat":"55.697076106444","lon":"21.113614523783326"},{"lat":"55.6967859249562","lon":"21.11329223960638"},{"lat":"55.69665038958192","lon":"21.113007087260485"},{"lat":"55.69655232131481","lon":"21.112801395356655"},{"lat":"55.69646816700697","lon":"21.112644569948316"},{"lat":"55.696425419300795","lon":"21.11255052499473"},{"lat":"55.69636255502701","lon":"21.112362518906593"},{"lat":"55.69635140709579","lon":"21.112339636310935"},{"lat":"55.69623523391783","lon":"21.112123718485236"},{"lat":"55.696120569482446","lon":"21.111881816759706"},{"lat":"55.696040857583284","lon":"21.11167528666556"},{"lat":"55.69595008157194","lon":"21.11142022535205"},{"lat":"55.695875734090805","lon":"21.11120472662151"},{"lat":"55.69572854787111","lon":"21.110760234296322"},{"lat":"55.69564430974424","lon":"21.11053735949099"},{"lat":"55.69553685374558","lon":"21.11026863567531"},{"lat":"55.69546644575894","lon":"21.110082305967808"},{"lat":"55.695343650877476","lon":"21.109795225784183"},{"lat":"55.69524306803942","lon":"21.1095180362463"},{"lat":"55.69515866227448","lon":"21.109181251376867"},{"lat":"55.695100324228406","lon":"21.108942283317447"},{"lat":"55.69498088210821","lon":"21.1084093619138"},{"lat":"55.69490510970354","lon":"21.108084814623"},{"lat":"55.69484299980104","lon":"21.107756663113832"},{"lat":"55.69478918798268","lon":"21.10747955739498"},{"lat":"55.694745602086186","lon":"21.10724243335426"},{"lat":"55.6946914549917","lon":"21.106920819729567"},{"lat":"55.69466907531023","lon":"21.10674454830587"},{"lat":"55.69461132399738","lon":"21.106461994349957"},{"lat":"55.6945738568902","lon":"21.106215063482523"},{"lat":"55.69453219883144","lon":"21.10587878152728"},{"lat":"55.69449230097234","lon":"21.1055772844702"},{"lat":"55.694455252960324","lon":"21.105288863182068"},{"lat":"55.69440764375031","lon":"21.104955095797777"},{"lat":"55.69435643032193","lon":"21.10461462289095"},{"lat":"55.694305300712585","lon":"21.10427993349731"},{"lat":"55.69425861351192","lon":"21.103936610743403"},{"lat":"55.69421645253897","lon":"21.10363251529634"},{"lat":"55.69416725076735","lon":"21.10329195857048"},{"lat":"55.6941232457757","lon":"21.102952240034938"},{"lat":"55.69407915696502","lon":"21.10261511988938"},{"lat":"55.694058453664184","lon":"21.102374475449324"},{"lat":"55.69406448863447","lon":"21.102328961715102"},{"lat":"55.69408108480275","lon":"21.102257715538144"},{"lat":"55.694214943796396","lon":"21.10212218016386"},{"lat":"55.69423698820174","lon":"21.10211681574583"},{"lat":"55.69442750886083","lon":"21.102087311446667"},{"lat":"55.6946084741503","lon":"21.102057807147503"},{"lat":"55.69477544166148","lon":"21.10203324817121"},{"lat":"55.69497543387115","lon":"21.102013969793916"},{"lat":"55.695172073319554","lon":"21.101996451616287"},{"lat":"55.695517072454095","lon":"21.1019354313612"},{"lat":"55.69569854065776","lon":"21.101907016709447"},{"lat":"55.69586425088346","lon":"21.101873824372888"},{"lat":"55.6960675958544","lon":"21.101846415549517"},{"lat":"55.69624001160264","lon":"21.10184323042631"},{"lat":"55.69641628302634","lon":"21.10182219184935"},{"lat":"55.696614012122154","lon":"21.101797549054027"},{"lat":"55.696769915521145","lon":"21.101831747218966"},{"lat":"55.696862032637","lon":"21.101882876828313"},{"lat":"55.69701533764601","lon":"21.10196049325168"},{"lat":"55.69717912003398","lon":"21.102033918723464"},{"lat":"55.69730317220092","lon":"21.102072978392243"},{"lat":"55.697391014546156","lon":"21.102091083303094"},{"lat":"55.69750685244799","lon":"21.102119330316782"},{"lat":"55.69768438115716","lon":"21.10213140025735"},{"lat":"55.69789099507034","lon":"21.102197282016277"},{"lat":"55.69806341081858","lon":"21.102357544004917"},{"lat":"55.698223086073995","lon":"21.10252090729773"},{"lat":"55.69837689399719","lon":"21.102673541754484"},{"lat":"55.69846322759986","lon":"21.102789379656315"},{"lat":"55.69862592034042","lon":"21.102938996627927"},{"lat":"55.69877210073173","lon":"21.10307989642024"},{"lat":"55.698943845927715","lon":"21.103275194764137"},{"lat":"55.69907653145492","lon":"21.103442329913378"},{"lat":"55.69917334243655","lon":"21.10357333905995"},{"lat":"55.69931994192302","lon":"21.10376344062388"},{"lat":"55.6994594167918","lon":"21.103932755067945"},{"lat":"55.69959998130798","lon":"21.104121347889304"},{"lat":"55.69972101598978","lon":"21.104257218539715"},{"lat":"55.69983718916774","lon":"21.104403315111995"},{"lat":"55.699925953522325","lon":"21.104517225176096"},{"lat":"55.70000440813601","lon":"21.10463515855372"},{"lat":"55.700119407847524","lon":"21.104831881821156"},{"lat":"55.700194761157036","lon":"21.104944869875908"},{"lat":"55.700298361480236","lon":"21.105100521817803"},{"lat":"55.70035099983215","lon":"21.105193058028817"},{"lat":"55.700479159131646","lon":"21.105334293097258"},{"lat":"55.70057806558907","lon":"21.10552154481411"},{"lat":"55.70067437365651","lon":"21.105648279190063"},{"lat":"55.70073002949357","lon":"21.105717681348324"},{"lat":"55.7008218113333","lon":"21.10586704686284"},{"lat":"55.70086129009724","lon":"21.10593887977302"},{"lat":"55.70092448964715","lon":"21.106116073206067"},{"lat":"55.700939912348986","lon":"21.106153121218085"},{"lat":"55.70101895369589","lon":"21.106260158121586"},{"lat":"55.70112104527652","lon":"21.10640600323677"},{"lat":"55.701140239834785","lon":"21.106439866125584"},{"lat":"55.70122975856066","lon":"21.10659702681005"},{"lat":"55.70134676992893","lon":"21.106788301840425"},{"lat":"55.70149462670088","lon":"21.107030119746923"},{"lat":"55.7015554793179","lon":"21.107191806659102"},{"lat":"55.70156687870622","lon":"21.10722776502371"},{"lat":"55.70158204995096","lon":"21.10726405866444"},{"lat":"55.70164759643376","lon":"21.107506547123194"},{"lat":"55.7017439045012","lon":"21.10772917047143"},{"lat":"55.701823867857456","lon":"21.107928659766912"},{"lat":"55.701906429603696","lon":"21.108162263408303"},{"lat":"55.701991338282824","lon":"21.108396286144853"},{"lat":"55.702030481770635","lon":"21.10861010849476"},{"lat":"55.702101895585656","lon":"21.108935242518783"},{"lat":"55.70214254781604","lon":"21.10925668850541"},{"lat":"55.702180517837405","lon":"21.109491800889373"},{"lat":"55.70218571461737","lon":"21.109543684870005"},{"lat":"55.70222376845777","lon":"21.109786089509726"},{"lat":"55.702235251665115","lon":"21.109872004017234"},{"lat":"55.702300211414695","lon":"21.11002128571272"},{"lat":"55.70232384838164","lon":"21.110096806660295"},{"lat":"55.702370032668114","lon":"21.110205352306366"},{"lat":"55.702406242489815","lon":"21.11027291044593"},{"lat":"55.70246893912554","lon":"21.110466783866286"},{"lat":"55.70252032019198","lon":"21.11060667783022"},{"lat":"55.70260698907077","lon":"21.11077280715108"},{"lat":"55.70267706178129","lon":"21.110882526263595"},{"lat":"55.70276850834489","lon":"21.111083775758743"},{"lat":"55.702775130048394","lon":"21.111104981973767"},{"lat":"55.70286297239363","lon":"21.11128494143486"},{"lat":"55.70300118997693","lon":"21.111558778211474"},{"lat":"55.70306338369846","lon":"21.111747287213802"},{"lat":"55.70311635732651","lon":"21.111963791772723"},{"lat":"55.70317846722901","lon":"21.1121497862041"},{"lat":"55.70320604369044","lon":"21.112229246646166"},{"lat":"55.70331039838493","lon":"21.112473662942648"},{"lat":"55.70332858711481","lon":"21.112521775066853"},{"lat":"55.703394301235676","lon":"21.112708607688546"},{"lat":"55.70343998260796","lon":"21.112926369532943"},{"lat":"55.70347133092582","lon":"21.113010859116912"},{"lat":"55.703507205471396","lon":"21.113134576007724"},{"lat":"55.70362228900194","lon":"21.113395588472486"},{"lat":"55.70369663648307","lon":"21.11357068642974"},{"lat":"55.70374617353082","lon":"21.11371041275561"},{"lat":"55.703856060281396","lon":"21.11395927146077"},{"lat":"55.70397935807705","lon":"21.114195305854082"},{"lat":"55.704098884016275","lon":"21.11435799859464"},{"lat":"55.70410215295851","lon":"21.11437937244773"},{"lat":"55.70409829728305","lon":"21.114418348297477"},{"lat":"55.703970389440656","lon":"21.114557068794966"},{"lat":"55.70385723374784","lon":"21.114660082384944"},{"lat":"55.703788083046675","lon":"21.11475228331983"},{"lat":"55.70375807583332","lon":"21.11479042097926"},{"lat":"55.70371499285102","lon":"21.114920508116484"},{"lat":"55.70367744192481","lon":"21.115069873631"},{"lat":"55.70365657098591","lon":"21.115141035988927"},{"lat":"55.70362321101129","lon":"21.115276655182242"},{"lat":"55.70356797426939","lon":"21.115418979898095"},{"lat":"55.70342883467674","lon":"21.11560095101595"},{"lat":"55.70326941087842","lon":"21.115726176649332"},{"lat":"55.70318986661732","lon":"21.11577990464866"},{"lat":"55.703066401183605","lon":"21.11588199622929"},{"lat":"55.70296254940331","lon":"21.115961372852325"},{"lat":"55.70288476534188","lon":"21.116036139428616"},{"lat":"55.702633475884795","lon":"21.11627426929772"},{"lat":"55.70257036015391","lon":"21.116339899599552"},{"lat":"55.70243281312287","lon":"21.116461688652635"},{"lat":"55.70231202989817","lon":"21.116568725556135"},{"lat":"55.7021548692137","lon":"21.116699567064643"},{"lat":"55.70210105739534","lon":"21.11675119958818"},{"lat":"55.702026626095176","lon":"21.11681615933776"},{"lat":"55.70182361640036","lon":"21.1170213483274"},{"lat":"55.701650362461805","lon":"21.117181023582816"},{"lat":"55.701496470719576","lon":"21.117324270308018"},{"lat":"55.70132212713361","lon":"21.117485286667943"},{"lat":"55.70119564421475","lon":"21.117601543664932"},{"lat":"55.70102406665683","lon":"21.117759877815843"},{"lat":"55.70085408166051","lon":"21.117912847548723"},{"lat":"55.7006854377687","lon":"21.118055507540703"},{"lat":"55.70051050744951","lon":"21.118215937167406"},{"lat":"55.70034110918641","lon":"21.11837100237608"},{"lat":"55.70016961544752","lon":"21.11850938759744"},{"lat":"55.70001899264753","lon":"21.11847502179444"},{"lat":"55.69988773204386","lon":"21.118254913017154"},{"lat":"55.699858982115984","lon":"21.118093393743038"},{"lat":"55.699802823364735","lon":"21.11786289140582"},{"lat":"55.69972487166524","lon":"21.117673041298985"},{"lat":"55.69963292218745","lon":"21.117400294169784"},{"lat":"55.69957634434104","lon":"21.117237601429224"},{"lat":"55.69949244149029","lon":"21.117088235914707"},{"lat":"55.69936495274305","lon":"21.116900900378823"},{"lat":"55.69922732189298","lon":"21.116730496287346"},{"lat":"55.69912137463689","lon":"21.11659931950271"},{"lat":"55.698979469016194","lon":"21.11641307361424"},{"lat":"55.69888559170067","lon":"21.116287261247635"},{"lat":"55.69878492504358","lon":"21.11615516245365"},{"lat":"55.698687359690666","lon":"21.116036558523774"},{"lat":"55.69857311435044","lon":"21.115854252129793"},{"lat":"55.69844554178417","lon":"21.115700444206595"},{"lat":"55.69828896783292","lon":"21.11554043367505"},{"lat":"55.698210345581174","lon":"21.115515874698758"},{"lat":"55.69815058261156","lon":"21.115539092570543"},{"lat":"55.69802971556783","lon":"21.115668760612607"},{"lat":"55.697909854352474","lon":"21.115807816386223"},{"lat":"55.69778932258487","lon":"21.11594687215984"},{"lat":"55.6977547891438","lon":"21.11598316580057"},{"lat":"55.69764833897352","lon":"21.1160128377378"},{"lat":"55.69745027460158","lon":"21.116042342036963"},{"lat":"55.69733301177621","lon":"21.116149881854653"},{"lat":"55.69723980501294","lon":"21.116232946515083"},{"lat":"55.6972227897495","lon":"21.116261025890708"},{"lat":"55.69715363904834","lon":"21.116349454969168"},{"lat":"55.69708792492747","lon":"21.116425143554807"},{"lat":"55.69701340980828","lon":"21.11648985184729"},{"lat":"55.69685759022832","lon":"21.11659051850438"},{"lat":"55.696704955771565","lon":"21.11672094091773"},{"lat":"55.696525666862726","lon":"21.116858907043934"},{"lat":"55.69639013148844","lon":"21.116948761045933"},{"lat":"55.696241771802306","lon":"21.11704431474209"},{"lat":"55.69608804769814","lon":"21.117151686921716"},{"lat":"55.695942621678114","lon":"21.117259142920375"},{"lat":"55.69578764028847","lon":"21.117350086569786"},{"lat":"55.69563358090818","lon":"21.11743139103055"},{"lat":"55.69551539607346","lon":"21.11752233467996"},{"lat":"55.69535999558866","lon":"21.117640854790807"},{"lat":"55.69524130783975","lon":"21.11772115342319"},{"lat":"55.69511708803475","lon":"21.117845540866256"},{"lat":"55.694992281496525","lon":"21.117994571104646"},{"lat":"55.694970237091184","lon":"21.118015022948384"},{"lat":"55.694850040599704","lon":"21.11820629797876"},{"lat":"55.694762114435434","lon":"21.118307802826166"},{"lat":"55.69462230429053","lon":"21.118422215804458"},{"lat":"55.69453161209822","lon":"21.118590272963047"},{"lat":"55.69442725740373","lon":"21.11873108893633"},{"lat":"55.6943547539413","lon":"21.118875006213784"},{"lat":"55.69434025324881","lon":"21.118914736434817"},{"lat":"55.694283256307244","lon":"21.119155883789062"},{"lat":"55.694209076464176","lon":"21.11935520544648"},{"lat":"55.69414118304849","lon":"21.11953985877335"},{"lat":"55.69409332238138","lon":"21.119693918153644"},{"lat":"55.69401637651026","lon":"21.119905896484852"},{"lat":"55.69391302764416","lon":"21.12019557505846"},{"lat":"55.69383021444082","lon":"21.120406966656446"},{"lat":"55.69374010898173","lon":"21.120611736550927"},{"lat":"55.69366995245218","lon":"21.12077794969082"},{"lat":"55.69358906708658","lon":"21.120989341288805"},{"lat":"55.69350776262581","lon":"21.121180281043053"},{"lat":"55.693437019363046","lon":"21.12135705538094"},{"lat":"55.693372059613466","lon":"21.12154170870781"},{"lat":"55.6933462433517","lon":"21.121611446142197"},{"lat":"55.693264938890934","lon":"21.121894922107458"},{"lat":"55.69322261027992","lon":"21.12200832925737"},{"lat":"55.693137031048536","lon":"21.122179068624973"},{"lat":"55.69298422895372","lon":"21.122334888204932"},{"lat":"55.69281131029129","lon":"21.12247746437788"},{"lat":"55.69267409853637","lon":"21.122561115771532"},{"lat":"55.692514926195145","lon":"21.122676534578204"},{"lat":"55.69232985377312","lon":"21.1228184401989"},{"lat":"55.692206136882305","lon":"21.122904773801565"},{"lat":"55.692184595391154","lon":"21.122915083542466"},{"lat":"55.692057609558105","lon":"21.12300770357251"},{"lat":"55.69194286130369","lon":"21.123074255883694"},{"lat":"55.69183398038149","lon":"21.12316000275314"},{"lat":"55.69173591211438","lon":"21.12329293973744"},{"lat":"55.6916831061244","lon":"21.12344096414745"},{"lat":"55.69161462597549","lon":"21.123603070154786"},{"lat":"55.69151639007032","lon":"21.123859137296677"},{"lat":"55.69143156521022","lon":"21.12404546700418"},{"lat":"55.6913479976356","lon":"21.124228527769446"},{"lat":"55.69128379225731","lon":"21.124351155012846"},{"lat":"55.69121061824262","lon":"21.124528096988797"},{"lat":"55.6911252066493","lon":"21.124728843569756"},{"lat":"55.69101808592677","lon":"21.124975690618157"},{"lat":"55.690926387906075","lon":"21.125151123851538"},{"lat":"55.690736873075366","lon":"21.125306021422148"},{"lat":"55.69059781730175","lon":"21.12537802197039"},{"lat":"55.69040486589074","lon":"21.125512551516294"},{"lat":"55.69023320451379","lon":"21.12565152347088"},{"lat":"55.69006850011647","lon":"21.125793596729636"},{"lat":"55.6899353954941","lon":"21.125906417146325"},{"lat":"55.689752670004964","lon":"21.12604052759707"},{"lat":"55.68956717848778","lon":"21.126177571713924"},{"lat":"55.689404821023345","lon":"21.126235406845808"},{"lat":"55.68924145773053","lon":"21.12626734189689"},{"lat":"55.6890619173646","lon":"21.126314364373684"},{"lat":"55.68879344500601","lon":"21.12650128081441"},{"lat":"55.688646510243416","lon":"21.126614101231098"},{"lat":"55.68847116082907","lon":"21.126740835607052"},{"lat":"55.688291201367974","lon":"21.126871844753623"},{"lat":"55.688115768134594","lon":"21.127001428976655"},{"lat":"55.68796212784946","lon":"21.127109890803695"},{"lat":"55.687809493392706","lon":"21.127204187214375"},{"lat":"55.68767613731325","lon":"21.12729043699801"},{"lat":"55.68748771212995","lon":"21.127318432554603"},{"lat":"55.68730900995433","lon":"21.127259843051434"},{"lat":"55.68715847097337","lon":"21.127320528030396"},{"lat":"55.6869635079056","lon":"21.12742287106812"},{"lat":"55.68678547628224","lon":"21.127511132508516"},{"lat":"55.686605935916305","lon":"21.127605764195323"},{"lat":"55.6864420697093","lon":"21.127705005928874"},{"lat":"55.68629245273769","lon":"21.127832075580955"},{"lat":"55.68617376498878","lon":"21.127942381426692"},{"lat":"55.6860120780766","lon":"21.128108175471425"},{"lat":"55.68582398816943","lon":"21.12822954542935"},{"lat":"55.68569775670767","lon":"21.128230299800634"},{"lat":"55.68557999096811","lon":"21.12821345217526"},{"lat":"55.685403468087316","lon":"21.128289978951216"},{"lat":"55.68525896407664","lon":"21.128417551517487"},{"lat":"55.68512233905494","lon":"21.12855593673885"},{"lat":"55.68504153750837","lon":"21.12874218262732"},{"lat":"55.68503189831972","lon":"21.12878618761897"},{"lat":"55.68502544425428","lon":"21.12883354537189"}]}}';
points = JSON.parse(points);
console.log(points); // Here is my full object, i can navigate it and also copy full path
console.log(points.point[0]); // produces TypeError: points.point is undefined

Isnt it points.points.point[0]? The first 'points' is the variable, not the content.
With another varname it might be a bit more clear:
pointsJSON = JSON.parse(pointsJSON);
pointsJSON.points.point[0]

As points is your object name and with same name your are having property of the object so you can get
points.points.point[0]
First points is variable name, second one is first property of object and third one is the inner property

Related

How to access values from this complex JavaScript Object?

I am working with AbsoluteOrientationSensor
I have an object that contains the values of the accelerometer of the phone.
The values that I need are nested inside an Symbol in the Object.
How do I access those values?
The Object Name is "message".
I have already tried this
console.log(message.__sensor__.quaternion);
But I am getting the result as "undefined".
I have never worked with the Symbol data type in JavaScript before.
The Values that I want to access are the quaternion values
This is the screenshot of the Object Structure -
Thank you for your help.
From the documentation:
Properties
OrientationSensor.quaternion: Returns a four element Array whose elements contain the components of the unit quaternion representing the device's orientation.
So:
console.log(message.quaternion);
You can also see in the screenshot that the object itself has a getter quaternion.
I have never worked with the Symbol data type in JavaScript before.
Symbols are used for various reasons as property names, but if they are used, it almost always means that you, as a consumer of the API, are not supposed to access that value directly. Instead you should use the "public" API the object provides to access this data, such as in this case.
function GetSymbol(object, name) {
const string = `Symbol(${name})`
return Object.getOwnPropertySymbols(object).find(symbol => symbol.toString() === string)
}
const __sensor__ = GetSymbol(message, "__sensor__")
console.log(message[__sensor__])

Javascript map string lookup. Can't find key even though key is in object

I must be missing something pretty standard here.
I have a map mapping string to object. What I write out:
console.log(playerMap, this.id(), playerMap[this.id()]);
What it prints out:
this does not make a lot of sense to me since the key seems to be right there.
Fiddle
Based on your Fiddle, apparently your playerMap is not yet initialised when you new FeedViewModel(), if you change your console.log to
console.log(Object.keys(playerMap).length, this.id(), playerMap[this.id()]);
you will see the object is empty
> 0 "123243df6" undefined
It's always confused when you console.log object because the object displayed is only resolved when you expand the > in the console. It is not the state of the object when you console.log'd the object.

How to get data from this objects num property using the name property as a selector

I am trying to find the value of the num property of this object using the name property to select the right object from the hashtagsl array; so I get the right num value. I need to do this knowing only what the name in the element and userid are. The end goal is variable equal to the value of num in the specific object. Here is the code creating the object to show the structure of it. Thanks in advanced.
All code shown is server side.
Meteor.users.update({"_id": this.userId},{"$push":{"profile.hashtagsl": {name: newhashtag, num: 1}}})
edit
Here it is updating incing the num property. I need to get the value of num instead of updating it.
Meteor.users.update({"_id": this.userId, "profile.hashtagsl.name":hashi},{"$inc":{"profile.hashtagsl.$.num":1}});
I think this should do it:
Meteor.users.findOne({'profile.hashtags1.name': somehashtag}).profile.hashtags1[index].num;
As you can see, accessing nested properties in a MongoDB query can be done through the dot notation. Using findOne returns an object with a similar structure, and you can access the num property as you would any other javascript object.
Edit: I forgot to add that you have to specify an index for the hashtags, since the user document has an array of hashtags.

Getting Hash and Storing in Variable

I'm trying to take the hashed value from an object. What I'm basically doing is this:
target = $('a[href^="#products"]');
targetHashed = target.hash;
$targetHashed = $(targetHashed);
console.log(targetHashed);
I'm putting the reference in "target", then getting the hashing and everything following it with ".hash" then converting the variable that contains the hashed value "targetHashed" to an object so I can do things like getting the offset, etc. Problem is that "targetHashed" is outputting undefined whenever I try to append .hash to it. Anyone know where I'm going wrong?
If you want to get the value of the href attribute of the selected elements you need to use attr so your second line would look something like.
targetHashed = target.attr('href');
But that only selects the first element, if you want to use all of them then you'll need to loop through that array.

Object in javascript stuck on last line of csv file

Im currently trying to build a choropleth on the map of Puerto Rico using D3. Using Scott Murray's Example on Choropleths, I'm trying to bind data to each municipality of Puerto Rico. I have a placeholder empty object to hold the data being fed from the CSV like so:
var properties = {};
Then, I proceed to read the CSV file by row. I assign the corresponding values to some variables like so:
properties.dataID = parseFloat(data[i].id);
properties.dataMunic_Total = parseFloat(data[i].municipio_total);
//etc.
All fine and dandy. I console.log to check whether or not the data was stored correctly:
console.log(properties.dataID);
//Displays 1, which is correct.
However, when I try to access the whole object:
console.log(properties);
it only displays the last row of the CSV file. I ran that last console.log() statement inside the first for loop, immediately after assigning the data to the object's properties, and every time the loop iterates through the console.log(), it ONLY displays the last line of the CSV file.
When I try to assign the object properties to my map's objects (municipalities), all that it ever assigns is that last line of the CSV file. So I tried setting them up individually, seeing that seems to have worked. However, JavaScript complains that the property does not exist in the object:
obj.geometries[j].properties.year[properties.dataYear - 2000].id = properties.dataID;
Uncaught TypeError: Cannot read property 'id' of undefined
I tried initializing it as if it were a new variable:
var obj.geometries[j].properties.year[properties.dataYear - 2000].id = properties.dataID;
but then I got this back on the console:
Uncaught SyntaxError: Unexpected identifier
Aside from the syntax error, I think that this is mainly due to the fact that I appended an array to each municipality so I could hold different sets of data per year... but I don't understand why JavaScript behaves this way.
My question is: why does my object behave this way? Is there something wrong with d3.csv? Am I doing something wrong?
If you want to store several properties, you need to use an array (i.e. a list). In the code you are using, you are only creating a single variable properties at a time and not saving the references to the ones you have created previously. That is, in each iteration of the loop, you are creating a new object, but losing the old one.
If you declare properties as an array and then append new property objects in the loop, you can reference them later and use them to draw the map. The code would look something like this.
var properties = [];
for(var i = 0; i < data.length; i++) {
var property = {};
property.dataID = parseFloat(data[i].id);
property.dataMunic_Total = parseFloat(data[i].municipio_total);
// ...
properties.push(property);
}
After setting up the data like this, you should be able to proceed as described in the example.

Categories

Resources