0

Comment modifier google map JSON afin que les éléments redondants ne soient pas téléchargés et accélérer une application sur les réseaux à faible bande passante. Par exemple, l'application ne prend pas en charge la navigation. Par conséquent, des étapes ne sont pas requises dans JSON, qui est également téléchargée et rend l'application lente sur les réseaux à faible bande passante.Google Map JSON pour les réseaux à faible bande passante

Par exemple: -

Google Map JSON entre la source et la destination: -

{ 
"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" : "[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" 
} 

requis JSON pour une application: -

{ 
    "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

Pouvez-vous être plus précis? Quelle API vous utilisez et comment votre requête ressemble à – Verma

+0

@Verma en utilisant Google Map API v2 et s'il vous plaît se référer à mon édition pour le format de demande etc. Merci –

Répondre

0

parties Omettre de la réponse JSON n'est pas une fonctionnalité dans les API.

Si vous souhaitez en faire la demande, s'il vous plaît le faire dans le suivi des problèmes: https://code.google.com/p/gmaps-api-issues/issues/entry?template=Directions%20API%20-%20Feature%20Request

Cependant, je ne pense que ce soit jamais partie de l'API. D'une part, il semble que ce serait d'une utilisation limitée, et il peut être mis en œuvre dans votre propre serveur: les demandes de proxy à l'API, puis les réponses d'ajustement.

Peut-être vous pouvez également utiliser SPDY: https://developers.google.com/speed/spdy/