eschwartz / backbone.googlemaps

A Backbone JS extension for interacting with the Google Maps API (v3.10)
MIT License
139 stars 55 forks source link

Pulling location data via external JSON URL? #38

Closed aaronbushnell closed 9 years ago

aaronbushnell commented 9 years ago

What's the recommended way to pull in an external JSON URL as the location data? I've been having some trouble getting my head around how to do this. :confused:

eschwartz commented 9 years ago

This library binds markers to Location and LocationCollection objects. You should be able to extend either of these objects to sync up with an API server.

Note that the data you receive must be restructured into a format that the location model expects:

{
  lat: int
  lng: int
  selected: ?boolean
  title: ?string
}

You can use parse to normalize the input data. Or you could use some kind of Backbone View Model extension.

You could also take a look at what I'm calling the "new" version of this library, which is Aeris.js. See my note about it here. The aeris MarkerCollection object has built in support for view model transformations, and is generally more flexible (and better supported).

aaronbushnell commented 9 years ago

Thanks for the quick update. I'll check into some of these options!