google-maps-builder icon indicating copy to clipboard operation
google-maps-builder copied to clipboard

Generate Coordinates from Address Fields in Existing Metadata

Open JustinSainton opened this issue 10 years ago • 10 comments

First off, OMG, I love you guys like a fat kid loves cake (I am both a fat kid, and I love cake, so I speak from a place of some authority on the matter).

So running into this issue on a project (I believe this may only apply to the Pro version). We have a couple hundred Custom Post Types with address information on them. They have no actual longitude/latitude information, which is a bummer.

I'm not sure if it would be within the scope of the Pro plugin to have a conversion tool in place that would generate the coordinates based on existing meta, but that would sure be handy. If it something you'd find useful, I'm happy to contribute what I'm building to get the job done.

JustinSainton avatar Aug 27 '15 23:08 JustinSainton

I think this is similar to #106. I'm looking forward to this feature, too. What seems tricky to me is making it flexible enough to handle posts with a single field for the entire address or multiple fields for street address, city, state, zip. Do you then select the field(s) in the Mashup Group like you do lat/lng?

@DevinWalker can you clarify how this might work?

kevinwhoffman avatar Aug 28 '15 00:08 kevinwhoffman

@kevinwhoffman Indeed, this is probably a dupe!

JustinSainton avatar Aug 28 '15 00:08 JustinSainton

@JustinSainton is your address data in a single or multiple meta keys?

First, we'll be supporting addresses in single fields since that's what Google expects when getting geocode results. Then up next is the option to select multiple address meta keys since I realize a lot of plugins (like EDD and ACF).

Then, we'll add support for outside data sources from APIs and more... but I'm getting ahead of myself here..

DevinWalker avatar Aug 28 '15 01:08 DevinWalker

@DevinWalker Multiple meta keys.

Sounds like y'all are on the right track :)

JustinSainton avatar Aug 28 '15 01:08 JustinSainton

Since we're collaborating over here let's just work from this one...

DevinWalker avatar Aug 28 '15 01:08 DevinWalker

You may already be aware but an ACF map field stores the location in a serialized array containing the street address, latitude and longitude in one meta_value. The unserialized version looks like this:

array(
  'address' => 'Street, City, State, Country',
  'lat' => '123',
  'lng' => '123',
)

Because of that format, ACF maps might require special attention, but I think it's also safe to assume if you have an ACF map value, you have the lat/lng values built in and don't need to worry about converting a street address.

kevinwhoffman avatar Aug 28 '15 02:08 kevinwhoffman

@kevinwhoffman is that built into the Pro version or standard? Also, there are LOT of possibilities with the various third-party Google Maps Add-ons.

DevinWalker avatar Aug 28 '15 02:08 DevinWalker

Google Map field is part of ACF standard and Pro. Just wanted to point out one example of a unique format. Originally I was only considering one string or multiple strings, but there are arrays to consider, too.

kevinwhoffman avatar Aug 28 '15 02:08 kevinwhoffman

@DevinWalker Given that ACF Google Map fields store lat/lng in an array within a single custom field, is there a way to generate a mashup map using posts that already have ACF map data? Or do I need to find a way to split that array into separate lat and lng fields so that the mashup markers are recognized?

kevinwhoffman avatar Jan 21 '16 17:01 kevinwhoffman

This is a valuable feature but we need a plan before beginning development. Moving this to Product Backlog for now.

kevinwhoffman avatar Sep 20 '18 01:09 kevinwhoffman