Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.16 KB | None | 0 0
  1. Ja robie POST- request z czymś takim:
  2.  
  3. {
  4.     "startPosition": {"lat":52.2288242, "lng":21.0130819},
  5.     "endPosition" : {"lat":52.2285690, "lng":21.0155288},
  6.     "travelMode": "DRIVING",
  7.     "waypointPointsOfInterest" : [
  8.         { "timeToSpend" : 600, "place_id":"ChIJ2X3Sqe7MHkcRA8bKf48xRgU" },
  9.         { "timeToSpend" : 1200, "place_id":"ChIJZ6Mm9CvNHkcR8X0Q_rNKHTY" }
  10.     ],
  11.     "pointsOfInterestKeyword" : "restaurant"
  12. }
  13.  
  14. Ty zwracasz mi coś takiego:
  15. {
  16.     "travelTime" : 3600,
  17.     "travelObject" : "....",
  18.     "pointsOfInterestNearRoute" : ["ChIJv0QRf_HMHkcRv7d7R28ht3Q", "ChIJG_KN3PXMHkcR0MY-dNAZ2VQ", "ChIJ3-Fh5WbMHkcRaurfiNBDOVE"]
  19. }
  20.  
  21. travelTime powinno byc w SEKUDNACH. Google maps zwykle zwraca jako czas unix timestamp czyli ilośćsekund od 1970, więc jestem zdania żebyśmy przekazywali sobie czas w sekundach.
  22.  
  23. W travelObject powinna być jedna trasa określana przez DirectionsApi, czyli jeden element z array "routes". Przykładowo znajduje się on w
  24. https://maps.googleapis.com/maps/api/directions/json?origin=Piaseczno&destination=Warszawa&mode=driving&key=AIzaSyDCLwOaPymlOIpbOZcVZLzhqLZVHxaIbf8
  25.  
  26. pointsOfInterestNearRoute - no niech będzie array skłądający się z  place_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement