Sneaky Wombat
Sneaky Wombat

Reputation: 1848

modifying google maps elevation return data

I'm wondering if there is a preferred way to slightly modify the return results of elevation data from google's maps v3 elevations api. Given two points, each with a lat/lng, i'd like to add 20 meters to each point. If the response below is the elevation of one point,

{
  "status": "OK",
  "results": [ {
    "location": {
      "lat": 45.371093,
      "lng": -114.381159
    },
    "elevation": 2255.52
  } ]
}

I was thinking of just modifying the return result above - the elevation key data. I can't seem to find or think of any other way. it seems to work but feels like a hack.

Upvotes: 1

Views: 286

Answers (1)

Sean Mickey
Sean Mickey

Reputation: 7716

It's understandable to feel a bit iffy about messing with data that you have gathered from Google, but I think you are fine in this case. Whenever I have the same concern, I check myself by making sure of two things:

  1. You must remain solidly within the TOS constraints (which you say you have)
  2. You must try to make sure that you: Don’t modify objects you don’t own.

In your scenario, you have a set of JSON data that you have retrieved from Google and as long as you don't modify the data and then pass it through to the user (or if you do, make it clear that it has been modified), you are free to work with the result data to satisfy a requirement or implement a use case in the context of a Google Map.

In your scenario, the response from the ElevationService has simply become application state data that you are using to make some calculations. It is a completely detached data set and you can always go retrieve the data again if needed. It doesn't belong to Google in the same way a JavaScript library, map tile overlay, or even an image file all clearly belong to Google. Many applications make calls to the Geocoder or make calls to the Places API and then adjust the data to: change the bounds of the map, set the center of the map, add a custom overlay that is generated on-the-fly to the map - all based on result data that has been adjusted in some way.

Of course, you can't change the values and then display them in an InfoWindow or use them as a marker label; in those cases, you are making the data available to the user. As long as you stay on the good side of the TOS and don't monkey with stuff you don't own, it feels like you are okay.

Upvotes: 1

Related Questions