Closed rjcorwin closed 8 years ago
The way I do this is have a long, lat and zoom set up as hidden fields.
Then using googles api
https://developers.google.com/maps/documentation/javascript/examples/event-simple
schema extract
longitude : {
type: 'Hidden'
},
latitude : {
type: 'Hidden'
},
zoom : {
type: 'Hidden'
}
and processing code
form.getEditor("latitude").setValue(myMarker.getPosition().lat());
form.getEditor("longitude").setValue(myMarker.getPosition().lng());
form.getEditor("zoom").setValue(map.getZoom());
form.trigger("lnglat:change")
This seems to work pretty well for me. You could extend this to allow an array and set the value to be an array of ordered coorniate pairs for area shapes too
@rjsteinert I have developed a custom editor to manage a bounding box field. It uses leafletjs with two plugins (Draw and Pan). I have taken the date field editor as a example.
Here you have a gist with the code: https://gist.github.com/bielfrontera/de36b1f510000ccbaf48
Looks like question was answered. Will close this now.
Has anyone heard of a plugin for Backbone-Forms that allows would render a field as a map that you can select geocoordinates on? In particular I have a need to allow folks to select areas on a map (fields on farms).