how do i decode/encode the url parameters for the new google maps? -
im trying figure out how extract lat/long of start/end in google maps directions link looks this:
im guessing "!" separator between variables followed xy x number , y lower case letter, can not quite figure out how reliably extract coordinates number/order of variables changes xy prefixes.
ideas? thanks
well, old, hey. i've been working on bit myself, here's i've figured out:
the data encoded javascript array, trick when trying generate own data string ensure formatting keeps structure of array intact. this, let's @ each step represents.
as you're correctly figured out, each exclamation point defines start of value definition. first character, int value, inner count, , (i believe) acts identifier, although i'm not 100% on this. seems pretty flexible in terms of can have here, long it's int. second character, however, more important. defines data type of value. don't know if i've found data types yet, ones have figured out are:
m: matrix f: float d: double i: integer b: boolean e: enum (as integer) s: string u: unsigned int x: hexdecimal value?
the remaining characters hold value itself, string hold string, boolean '1' or '0', , on. however, there's important gotcha: matrix data type.
the value of matrix integer. length of matrix, measured in number of values. is, matrix !1mx, next x value definitions belong matrix. includes nested matrix definitions, matrix of form [[1,2]]
!1m3!1m2!1i1!2i2
(outer matrix has 3 children, inner matrix has 2). means that, in order remove value list, must check matrix ancestors and, if exist, update values reflect missing member.
the x data type anomaly. i'm going guess it's hexdecimal encoded purposes, in particular situation (making call attribution info), appear use x data type store lat/long information, , not encoded in hex, unsigned long value set value = coordinate<0 ? (430+coordinate)*1e7 : coordinate*1e7
an example (pulled directly google maps) of x data type being used in way: https://www.google.com/maps/vt?pb=!1m8!4m7!2u7!5m2!1x405712614!2x3250870890!6m2!1x485303036!2x3461808386!2m1!1e0!2m20!1e2!2spsm!4m2!1sgid!2sznfcvopry49wpv6it72cvw!4m2!1ssp!2s1!8m11!13m9!2sa!15b1!18m5!2b1!3b0!4b1!5b0!6b0!19b1!19u12!3m1!5e1105!4e5!18m1!1b1
for context of question asked, it's important note there no reliable identifiers in structure. google reads values in specific order, keep in mind when building own encoded data order matters; you'll need research/testing determine order. reading, best hope rebuild matrix structure, scan looks lat/long values (i.e. matrix containing 2 children of type double (or x?))
Comments
Post a Comment