Closed gmlnchv closed 9 years ago
There's a lot of overlap, but each has a few unique features. Autoform integration is one of the more obvious ones, of course. That said, you're required to use Autoform with that package. While this package doesn't come with Autoform integration, it's fairly trivial to set it up.
In the end, it's really just simple text fields that are having their values populated automatically by a javascript plugin that calls an API. So you'd just set up a normal text field input with Autoform like you would for any other String
and then initialize this plugin on that input when the template renders. When the form gets submitted, the value is grabbed from the input field by Autoform.
To see a concrete example, I did exactly the above for a Telescope theme a while back...
Form Template (Note the two optional hidden text fields for lat/long.)
Logic (Does the normal Geocomplete stuff and also populates the two hidden text fields with the lat/long once the location is chosen.)
Schema
(You can ignore the Telescope-specific stuff in there. Just need to define the type
)
So maybe more importantly, you can take a look at the examples of Geocomplete usage here. Most of those aren't possible with the other plugin out of the box.
So it's not really a better/worse thing. It just comes down to what you need and your preferences on how to get there.
Sorry, forgot to answer the rest of the question...
You can take a look at the section on Options. Specifically, see the available options for types
.
You can add any of those in your geocomplete config.
Template.myTemplate.onRendered(function() {
this.autorun(function () {
if (GoogleMaps.loaded()) {
$("input").geocomplete({
types: ['geocode', 'cafe', 'etc'] // default value is 'geocode'
});
}
});
});
Thanks so much for your answers, @jshimko! I think the types
options is what I have been missing.
@jshimko : This is sort of relates / an identical question. In README it says nothing about the field "name" of a place being returned. Is it possible with the current Version?
Just trying to get my head around is to how this package is different to lukemadera/meteor-autoform-googleplace in the sense that with lukemadera's package I'm able to get suggestions for local places (cafes and such) but not with meteor-geocomplete. Both packages load the same Places library but why different results?