0

如何更改谷歌地图JSON,以便冗余的东西不下载,并加快低带宽网络上的应用程序。例如,应用程序不支持导航,因此在JSON中不需要执行这些步骤,这些步骤也会在低带宽网络中下载并使应用程序变得缓慢。谷歌地图低带宽网络JSON

,例如: - :

{ 
"geocoded_waypoints" : [ 
    { 
    "geocoder_status" : "OK", 
    "place_id" : "ChIJbZ--gzESrjsRsmxa_tmvhlI", 
    "types" : [ "route" ] 
    }, 
    { 
    "geocoder_status" : "OK", 
    "place_id" : "Elk4NjksIDEydGggTWFpbiBSb2FkLCBLb3JhbWFuZ2FsYSAzIEJsb2NrLCBLb3JhbWFuZ2FsYSwgQmVuZ2FsdXJ1LCBLYXJuYXRha2EgNTYwMDM0LCBJbmRpYQ", 
    "types" : [ "street_address" ] 
    } 
], 
"routes" : [ 
    { 
    "bounds" : { 
     "northeast" : { 
      "lat" : 12.959155, 
      "lng" : 77.7091214 
     }, 
     "southwest" : { 
      "lat" : 12.9206335, 
      "lng" : 77.6264824 
     } 
    }, 
    "copyrights" : "Map data ©2015 Google", 
    "legs" : [ 
     { 
      "distance" : { 
       "text" : "12.5 km", 
       "value" : 12510 
      }, 
      "duration" : { 
       "text" : "29 mins", 
       "value" : 1750 
      }, 
      "end_address" : "869, 12th Main Road, Koramangala 3 Block, Koramangala, Bengaluru, Karnataka 560034, India", 
      "end_location" : { 
       "lat" : 12.9280212, 
       "lng" : 77.6267905 
      }, 
      "start_address" : "PFS Driveway, Lakshminarayana Pura, AECS Layout, Marathahalli, Bengaluru, Karnataka 560037, India", 
      "start_location" : { 
       "lat" : 12.959155, 
       "lng" : 77.70615509999999 
      }, 
      "steps" : [ 
       { 
       "distance" : { 
        "text" : "0.3 km", 
        "value" : 283 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 68 
       }, 
       "end_location" : { 
        "lat" : 12.9569421, 
        "lng" : 77.70609429999999 
       }, 
       "html_instructions" : "Head \u003cb\u003esouth\u003c/b\u003e on \u003cb\u003ePFS Driveway\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eRestricted usage road\u003c/div\u003e", 
       "polyline" : { 
        "points" : "[email protected]@[email protected][email protected]@[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.959155, 
        "lng" : 77.70615509999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "26 m", 
        "value" : 26 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 6 
       }, 
       "end_location" : { 
        "lat" : 12.9567068, 
        "lng" : 77.70613229999999 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e to stay on \u003cb\u003ePFS Driveway\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eRestricted usage road\u003c/div\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "{[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9569421, 
        "lng" : 77.70609429999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.1 km", 
        "value" : 138 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 59 
       }, 
       "end_location" : { 
        "lat" : 12.9568247, 
        "lng" : 77.70486409999999 
       }, 
       "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eMarathalli Bridge Service Rd\u003c/b\u003e", 
       "maneuver" : "turn-right", 
       "polyline" : { 
        "points" : "mranAi~gyMC^Q|E" 
       }, 
       "start_location" : { 
        "lat" : 12.9567068, 
        "lng" : 77.70613229999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "36 m", 
        "value" : 36 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 8 
       }, 
       "end_location" : { 
        "lat" : 12.9565042, 
        "lng" : 77.70486959999999 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eMunnekollal Main Rd\u003c/b\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9568247, 
        "lng" : 77.70486409999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.5 km", 
        "value" : 482 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 83 
       }, 
       "end_location" : { 
        "lat" : 12.9563276, 
        "lng" : 77.7091214 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eMarathalli Bridge Service Rd\u003c/b\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "cqanAmvgyMPkGFuCV_GHeB[email protected]][email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9565042, 
        "lng" : 77.70486959999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.8 km", 
        "value" : 838 
       }, 
       "duration" : { 
        "text" : "2 mins", 
        "value" : 142 
       }, 
       "end_location" : { 
        "lat" : 12.956896, 
        "lng" : 77.70141439999999 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eMarathalli Bridge/Old Airport Rd/Varthur Rd\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eContinue to follow Old Airport Rd/Varthur Rd\u003c/div\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "[email protected]|[email protected][email protected]~BMlCA^ARC^[email protected][email protected]`@" 
       }, 
       "start_location" : { 
        "lat" : 12.9563276, 
        "lng" : 77.7091214 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.4 km", 
        "value" : 411 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 62 
       }, 
       "end_location" : { 
        "lat" : 12.9533531, 
        "lng" : 77.7003715 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e toward \u003cb\u003eNH7\u003c/b\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "ssanAy`[email protected]@ZHpK`B" 
       }, 
       "start_location" : { 
        "lat" : 12.956896, 
        "lng" : 77.70141439999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "31 m", 
        "value" : 31 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 23 
       }, 
       "end_location" : { 
        "lat" : 12.9531397, 
        "lng" : 77.7001892 
       }, 
       "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e toward \u003cb\u003eNH7\u003c/b\u003e", 
       "maneuver" : "turn-slight-right", 
       "polyline" : { 
        "points" : "m}`nAizfyMHF^Z" 
       }, 
       "start_location" : { 
        "lat" : 12.9533531, 
        "lng" : 77.7003715 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "3.8 km", 
        "value" : 3796 
       }, 
       "duration" : { 
        "text" : "6 mins", 
        "value" : 373 
       }, 
       "end_location" : { 
        "lat" : 12.9274228, 
        "lng" : 77.6798031 
       }, 
       "html_instructions" : "Slight \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eNH7\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by VIMS Super Specialty Hospital (on the left in 550 m)\u003c/div\u003e", 
       "maneuver" : "turn-slight-left", 
       "polyline" : { 
        "points" : "c|`nAeyfyM`[email protected]@|[email protected]@[email protected]`AR~A`@fB`@dB`@[email protected]@[email protected]^HVJZJ`@[email protected]@[email protected]@`@[email protected]\\N`@[email protected][email protected]@`[email protected]@`[email protected]@[email protected]|[email protected]@fBtBtDdE`AdAbCpC`CjCtC`DpIlJxF|G^[email protected]@\\[email protected]@[email protected]@[email protected]@[email protected]@hBJR" 
       }, 
       "start_location" : { 
        "lat" : 12.9531397, 
        "lng" : 77.7001892 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "3.0 km", 
        "value" : 3010 
       }, 
       "duration" : { 
        "text" : "5 mins", 
        "value" : 270 
       }, 
       "end_location" : { 
        "lat" : 12.9237183, 
        "lng" : 77.6540827 
       }, 
       "html_instructions" : "Keep \u003cb\u003eleft\u003c/b\u003e to stay on \u003cb\u003eNH7\u003c/b\u003e", 
       "maneuver" : "keep-left", 
       "polyline" : { 
        "points" : "k{{[email protected]|I^[email protected]\\[email protected]~C`I^jAX|@[email protected]|@~BvAbEtBfFZ|@[email protected]@[email protected]@[email protected][email protected]@[email protected]][email protected]@lCaA|[email protected]@[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9274228, 
        "lng" : 77.6798031 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.4 km", 
        "value" : 438 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 66 
       }, 
       "end_location" : { 
        "lat" : 12.924442, 
        "lng" : 77.6501267 
       }, 
       "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e at \u003cb\u003eAgra Exit\u003c/b\u003e toward \u003cb\u003eSarjapur Main Rd\u003c/b\u003e", 
       "maneuver" : "turn-slight-right", 
       "polyline" : { 
        "points" : "gd{mA_y}[email protected]@[email protected]\\[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9237183, 
        "lng" : 77.6540827 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "1.8 km", 
        "value" : 1816 
       }, 
       "duration" : { 
        "text" : "5 mins", 
        "value" : 304 
       }, 
       "end_location" : { 
        "lat" : 12.9248137, 
        "lng" : 77.63406830000001 
       }, 
       "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eSarjapur Main Rd\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by Karthikshekar Hospital (on the left in 1.3 km)\u003c/div\u003e", 
       "maneuver" : "turn-slight-right", 
       "polyline" : { 
        "points" : "wh{mAi`}[email protected]`@I\\[email protected][email protected]|@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected][email protected]^@\\@[email protected]@[email protected]\\[email protected]`@[email protected][email protected]`@[[email protected]^[email protected]@[email protected]`@lELbA" 
       }, 
       "start_location" : { 
        "lat" : 12.924442, 
        "lng" : 77.6501267 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "77 m", 
        "value" : 77 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 44 
       }, 
       "end_location" : { 
        "lat" : 12.9250061, 
        "lng" : 77.6335821 
       }, 
       "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003e80 Feet Main Rd/Mahatyagi Laksmidevi Rd\u003c/b\u003e", 
       "maneuver" : "turn-right", 
       "polyline" : { 
        "points" : "ak{mA}{[email protected]]B" 
       }, 
       "start_location" : { 
        "lat" : 12.9248137, 
        "lng" : 77.63406830000001 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.6 km", 
        "value" : 579 
       }, 
       "duration" : { 
        "text" : "2 mins", 
        "value" : 101 
       }, 
       "end_location" : { 
        "lat" : 12.9245984, 
        "lng" : 77.62833669999999 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003e1st Cross Rd\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by Sandeepani (on the right)\u003c/div\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "il{mA{[email protected][email protected]@[email protected]@rB" 
       }, 
       "start_location" : { 
        "lat" : 12.9250061, 
        "lng" : 77.6335821 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.2 km", 
        "value" : 174 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 37 
       }, 
       "end_location" : { 
        "lat" : 12.9261219, 
        "lng" : 77.628711 
       }, 
       "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003e8th Main Rd\u003c/b\u003e", 
       "maneuver" : "turn-right", 
       "polyline" : { 
        "points" : "wi{[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9245984, 
        "lng" : 77.62833669999999 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.3 km", 
        "value" : 264 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 58 
       }, 
       "end_location" : { 
        "lat" : 12.9270734, 
        "lng" : 77.6264824 
       }, 
       "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003e3rd Cross Rd\u003c/b\u003e", 
       "maneuver" : "turn-left", 
       "polyline" : { 
        "points" : "gs{[email protected]@xA}@[email protected]" 
       }, 
       "start_location" : { 
        "lat" : 12.9261219, 
        "lng" : 77.628711 
       }, 
       "travel_mode" : "DRIVING" 
       }, 
       { 
       "distance" : { 
        "text" : "0.1 km", 
        "value" : 111 
       }, 
       "duration" : { 
        "text" : "1 min", 
        "value" : 46 
       }, 
       "end_location" : { 
        "lat" : 12.9280212, 
        "lng" : 77.6267905 
       }, 
       "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003e12th Main Rd\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by the park (on the right)\u003c/div\u003e\u003cdiv style=\"font-size:0.9em\"\u003eDestination will be on the right\u003c/div\u003e", 
       "maneuver" : "turn-right", 
       "polyline" : { 
        "points" : "ey{mAolxxM}D}@" 
       }, 
       "start_location" : { 
        "lat" : 12.9270734, 
        "lng" : 77.6264824 
       }, 
       "travel_mode" : "DRIVING" 
       } 
      ], 
      "via_waypoint" : [] 
     } 
    ], 
    "overview_polyline" : { 
     "points" : "[email protected]@[email protected]|[email protected]^uKHqBF[D][email protected]@lYAFErBInAUlGKfBArAA`@[email protected]@`[email protected]`@pB^[email protected]@[email protected]|AfEvB`[email protected]`[email protected]|MdOpIlJxF|[email protected][email protected]@`[email protected]|AdGdPvD`K^[email protected]|@~B~C`I^[email protected]|[email protected]@[email protected]@QhAeBxIYbB_A|[email protected]@lCaA|[email protected]@[email protected]@gAhJ][email protected]?tBJxBHbDLdCFrB?|DB|@[email protected][email protected]|MO\\[email protected]@K^[email protected]@[email protected]`[email protected]|@[email protected]@[email protected]]}D|L}D}@" 
    }, 
    "summary" : "NH7", 
    "warnings" : [], 
    "waypoint_order" : [] 
    } 
], 
"status" : "OK" 
} 

必需的JSON对于一些应用: - -

谷歌地图的源和目的地之间JSON

{ 
    "geocoded_waypoints" : [ 
     { 
     "geocoder_status" : "OK", 
     "place_id" : "ChIJbZ--gzESrjsRsmxa_tmvhlI", 
     "types" : [ "route" ] 
     }, 
     { 
     "geocoder_status" : "OK", 
     "place_id" : "Elk4NjksIDEydGggTWFpbiBSb2FkLCBLb3JhbWFuZ2FsYSAzIEJsb2NrLCBLb3JhbWFuZ2FsYSwgQmVuZ2FsdXJ1LCBLYXJuYXRha2EgNTYwMDM0LCBJbmRpYQ", 
     "types" : [ "street_address" ] 
     } 
    ], 
    "routes" : [ 
     { 
     "bounds" : { 
      "northeast" : { 
       "lat" : 12.959155, 
       "lng" : 77.7091214 
      }, 
      "southwest" : { 
       "lat" : 12.9206335, 
       "lng" : 77.6264824 
      } 
     }, 
     "copyrights" : "Map data ©2015 Google", 
"legs" : [ 
      { 
       "distance" : { 
        "text" : "12.5 km", 
        "value" : 12510 
       }, 
       "duration" : { 
        "text" : "29 mins", 
        "value" : 1750 
       }, 
       "end_address" : "869, 12th Main Road, Koramangala 3 Block, Koramangala, Bengaluru, Karnataka 560034, India", 
       "end_location" : { 
        "lat" : 12.9280212, 
        "lng" : 77.6267905 
       }, 
       "start_address" : "PFS Driveway, Lakshminarayana Pura, AECS Layout, Marathahalli, Bengaluru, Karnataka 560037, India", 
       "start_location" : { 
        "lat" : 12.959155, 
        "lng" : 77.70615509999999 
       }, 
} 
     ], 
     "overview_polyline" : { 
      "points" : "[email protected]@[email protected]|[email protected]^uKHqBF[D][email protected]@lYAFErBInAUlGKfBArAA`@[email protected]@`[email protected]`@pB^[email protected]@[email protected]|AfEvB`[email protected]`[email protected]|MdOpIlJxF|[email protected][email protected]@`[email protected]|AdGdPvD`K^[email protected]|@~B~C`I^[email protected]|[email protected]@[email protected]@QhAeBxIYbB_A|[email protected]@lCaA|[email protected]@[email protected]@gAhJ][email protected]?tBJxBHbDLdCFrB?|DB|@[email protected][email protected]|MO\\[email protected]@K^[email protected]@[email protected]`[email protected]|@[email protected]@[email protected]]}D|L}D}@" 
     }, 
     "summary" : "NH7", 
     "warnings" : [], 
     "waypoint_order" : [] 
     } 
    ], 
    "status" : "OK" 
} 
+0

你能更具体?您正在使用哪个API以及您的请求如何使用Google地图API v2中的 – Verma

+0

@Verma,请参阅我的编辑请求格式等。谢谢 –

回答

0

JSON响应的省略部分是不API中的一项功能。

如果您想请求此,请在问题追踪器这样做: https://code.google.com/p/gmaps-api-issues/issues/entry?template=Directions%20API%20-%20Feature%20Request

不过,我不希望这是API的不断一部分。首先,它听起来像是有限的使用,它可以在你自己的服务器中实现:代理对API的请求,然后修改响应。

也许你也可以使用SPDY: https://developers.google.com/speed/spdy/