Convert Local Live Polygon coordinate to Lat/Long

First off, MS release of Local.Live is great in the sense that users can now zoom in, highlight an area, and then share that highlighted area via the polygon feature of scratch pad.

My question: Is there a way to go from local.live's coded polygon coordinates to lat/long

We'd really like to collect polygons drawn on local.live and re-use them in a VE implementation. However, the polygon points are encoded and VE wants lat/long points. Ultimately we could try to re-build WLL, but trying to build the scratch pad looks tricky.

For example, given this URL:

http://local.live.com/ v=2&sp=Polygon.pfy1bp5c6008_pfy19f5c63q3_pfxt1f5c63t0_pfxsrx5c5zst_pfxty85c5z46_pfy0j75c5z2t_pfy19f5c5zkz_pfy1bp5c6035_pfy1bp5c6008_Test%20field____%230000FF_%23008000_2pt_Single_Solid_pfxywp5c60kg

how could I rebuild that polygon my own VE page



Answer this question

Convert Local Live Polygon coordinate to Lat/Long

  • RoyC#newbie

    Interesting....

    I'm doing some performance improvements at the moment and one idea to test was to encode the lat/lon values sent to make them smaller. (we were sending in the order of 340K of pushpins/lines etc javascript down the wire!) Sounds like this is a handy way to do it.

    John.



  • Reaction

    I'll run up a test today. My application has a certain function that draws a heap of polylines, the data gets transmitted to the client using AJAX but a few hundred polylines with 6 or 7 points ends up with 1200 long numbers. If javascript has a really fast decoder and .net a really fast encoder I could easily halve the data sent down the wire.

    That said i'm also testing the effects of using IIS compression that could compress the ajax data significantly. With that in mind this may not be worthwhile unless i see a good size reduction.

    I'll let you know how i go.

    John.



  • Ganwold

    looks like base64 encoding to me...

  • Alex-MyRpg

    Some very interesting finds on the internet:

    first up is this article talking about MS taking a patient on their polygon encoding.

    http://www.findarticles.com/p/articles/mi_zdext/is_200502/ai_n9482898

    The folks over at Slashdot picked up on something interesting this weekend: Microsoft has applied for a patent that covers "Compact text encoding of latitude/longitude coordinates."

    The patent application was posted last week, Microsoft filed the patent back on July 31, 2003.

    The abstract from the Microsoft patent application boils it down:

    "Methods are disclosed for encoding latitude/longitude coordinates within a URL in a relatively compact form. The method includes converting latitude and longitude coordinates from floating-point numbers to non-negative integers. A set of base-N string representations are generated for the integers (N represents the number of characters in an implementation-defined character set being utilized). The latitude string and longitude string are then concatenated to yield a single output string. The output string is utilized as a geographic indicator with a URL."

    And the 2nd great find is the open method from Google maps:

    http://www.google.com/apis/maps/documentation/polylinealgorithm.html

    John.



  • ZhenYuan

    i think that depends on the speed of your line, and the amount of data to be transferred, AND how expensive the encoding/decoding is.

    What kind of encoding are you thinking of how much KB's are saved im curious...



  • SIPS

    Ok this is very cool.

    So the algorithm from Google transforms this:

    (-27.490237346548827,153.10309767723086)
    (-27.490332520885609,153.10371994972229)
    (-27.490808391335637,153.10368776321414)
    (-27.491074877889265,153.10377359390262)
    (-27.491531710480697,153.1036984920502)
    (-27.491417502510544,153.10288310050964)

    into this:

    `exfDi}me\R{B|ADt@QxANW`D

    If you can't see the point stop reading now.....personally i'm going to start making some changing in the way i send data to my VE clients.

    John.



  • Convert Local Live Polygon coordinate to Lat/Long