Open mapsandapps opened 8 years ago
I was thinking of automating the geocoding step once an address is entered in that row. But I'm currently relying on the lack of a geocode to allow me to show several events at the same location in my list of concerts, but only show that location once on the map (rather than needlessly stack up markers).
If I do automate the geocoding (assuming that's possible, but it seems like it is), I'd probably then add a column for a "Hide from Map" flag to the Points sheet, and use that to determine whether or not to render a marker for that row.
Last thought is just that the form responses live on a different worksheet, and when the form is used, we could just always automatically generate a geocode based on the address, then copy that row and append it to the "Points" sheet (without the timestamp column). If people want address data without geocodes, they can edit directly on the spreadsheet. It's probably a rare case.
@oddlyaromatic What do you mean by "it seems like it is" possible to automate geocoding? TBH, I haven't looked into this at all, so I have no idea about whether or how to automate the geocoding.
If I remember it rightly, the geocoding function accepts 3 table cell references as arguments (or accepts an an array, where each element is an array of 3 cells, if multiple rows are selected) - the "source" cell containing the address, and the empty cells where it will put the latitude and longitude. The way I see it I would write a function that loops through all rows in the sheet and if the latitude and longitude fields are blank but the address field has data, run the geocoding function for that row. So the user doesn't have to select the fields and initiate the script. It could run on every edit, or on a timer, or whatever.
What I plan to do for my project is the solution where we do all that on a separate worksheet, where form results are stored, and then append to the main Points worksheet. That way, we don't accidentally mess with anything that was already set (or left blank on purpose) in the Points sheet. And the function could just run on every edit because an "edit" would be the form appending a complete row after somebody submitted it, not just a user keypress where the function would run many times for nothing.
When it's up and running I'll post the example and hopefully all will be working and make sense. Might be a little while. Maintaining this feature could be tricky, since moving or renaming columns would need an edit to the function, so I think I have a ways to go before this is a general solution.
What to do about geocoding?