Automattic / WP-Job-Manager

Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
https://wpjobmanager.com
GNU General Public License v3.0
897 stars 368 forks source link

[discussion] GeoLocation Providers, Handling, and Debugging #2122

Open tripflex opened 3 years ago

tripflex commented 3 years ago

Wanted to get the discussion regarding geolocation organized into a single issue so they can be addressed, and so I can try and help with some PRs to enhance the current geolocation handling.

Few things I think will be most important:

My thoughts regarding debug could be handled a few different ways

  1. Add button in Settings to test geolocation api, and show errors This would make it easy to get around how geolocation is handled now, where it's not done immediately (to prevent delay for user on frontend)
  2. Add button in new writepanel in admin area, to trigger geolocation on single listing (and show success or error message) Similar to above, but this would also allow admins to see specific error on listings (if there is one), while also providing the ability to "test" geolocation (would probably just have to add something in docs to point users to using this for debugging)
  3. Output errors from geolocation directly into error log

Personally I think the error log method/handling should be added either way (and can be maybe enabled via a filter or setting), and I like the ability to do it from admin area, but would this cause confusion as to geolocation is still generated when a listing is saved?

Maybe we could have a new writepanel that shows some information about the geolocation data (if geolocation is enabled), showing like a green status if listing has geolocation data, with a few details from it. Could then possibly have a button to "Force Regenerate" which could show error/success since concern of delay for admin is not big issue compared to user on frontend.

I think debugging is probably going to be one of the most required handlings here, mainly because I see a ton of clients having issues with geolocation not being generated (almost always due to key restrictions). Because there isn't any way to view any of this (natively) or know what the "issue" is, most users assume it's the plugin and not something with their API key or restrictions on it.

Maybe we could add another tab to settings area specifically for GeoLocation, to define the provider to use, have debug information, and even the button to trigger updating all listings that have not been set.

@jom @gkaragia @renatho thoughts, suggestions, concerns, opinions?

For reference, here's some "slow geocode" i came up with a few years ago for a clients (probably no use, but just in case): https://gist.github.com/tripflex/a13cf9ece1d6cec01c16e3bf8be08721

Related: https://github.com/Automattic/WP-Job-Manager/issues/1753 https://github.com/Automattic/WP-Job-Manager/issues/2097 https://github.com/Automattic/WP-Job-Manager/issues/1966 https://github.com/Automattic/WP-Job-Manager/issues/1069

Braehler commented 3 years ago

@tripflex great idea. I know, that the DEV of GeoMyWP for WPJM has a little plugin that provides Client-Side geocoder to WP Job Manager plugin to overcome the OVER_QUERY_LIMIT, and other geocoding issues. A few day ago he did a fix for me regarding a geolcation issue which I wasn´t able to fix, even with the help of the little plugin Because there were no errors logs or success messages available. The golcation was not updating in the database. Maybe contacting him would make sense? And additional geolocation providers would also be great

tripflex commented 3 years ago

To add to this as well, may want to address the handling of geocoding responses, as some specific locations (like UK) require the different values from administrative_area_level_1 and administrative_area_level_2, and with current handling, both those values are set on the same fields (meaning if administrative_area_level_1 comes first, then administrative_area_level_2 will overwrite it)

Gnodesign commented 3 years ago

If this ever gets worked on GeoApify should definitely be added to the list.

Gnodesign commented 10 months ago

Is there any news on this issue?

I believe this should be a priority for the next updates. Most of the themes are using map functionalities, and Google Maps is not the best choice for handling geolocations.