Title: Location autofill
Last modified: December 6, 2018

---

# Location autofill

 *  Resolved [DCuserName](https://wordpress.org/support/users/dcusername/)
 * (@dcusername)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/)
 * Really nice so far, thanks for working on this! The only thing I’m struggling
   with so far is the autofill on Locations. It’s probably just an OpenCage issue,
   but when I add the address and city, it invariably gets the rest wrong, and when
   I correct it, there’s no option to reset the map. If this is beyond your control,
   would it be possible to have an option to turn off autocomplete? Or maybe have
   fields in Settings to define some defaults? We’ll always have the same State 
   and Region for instance.
 * Thanks,
    David

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * (@duisterdenhaag)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10955434)
 * Hi David,
 * Thanks for your enthusiasm!
 * There is no option to turnoff autofill, BUT 🙂
    It is only triggered on “onFocusOut”
   on the city field. (If your cursor is in the City field and then leaves, the 
   Geocoding is called).
 * So as long as you do not touch that (or as first entry), you should be able to
   edit the other fields.
 * What do you mean “invariably gets the rest wrong”? All data is fetched live from
   the main geocode database. Btw, state and region are geographically not the same.
   😉 So why would you fill two non-required fields with the same value?
 * But again, as soon as the fields are filled, you can still edit them Just do 
   not go back to the city or else you will loose your changes.
 * Here’s an example output of the geocoding:
 *     ```
       "components:
       ISO_3166-1_alpha-2: "US"
       country: "USA"
       country_code: "us"
       county: "Clark County"
       neighbourhood: "Enterprise"
       postcode: "89119-4016"
       road: "South Las Vegas Boulevard"
       road_type: "secondary"
       state: "Nevada"
       state_code: "NV"
       suburb: "Hughes Center"
       _type: "road"
       __proto__: Object
       confidence: 9
       formatted: "South Las Vegas Boulevard, Hughes Center, NV 89119-4016, United States of America"
       geometry:
       lat: 36.0723921
       lng: -115.172611
       }"
       ```
   
 * The State field is filled by the result of “state” and the region field is filled
   by the result of “county”.
    -  This reply was modified 7 years, 6 months ago by [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/).
 *  Thread Starter [DCuserName](https://wordpress.org/support/users/dcusername/)
 * (@dcusername)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10956117)
 * Oh, what I meant was that State and Region, while different from each other, 
   will always be the same values, Oregon and Polk County respectively for us.
 * As an example of the bad behavior, if I put in Monmouth or Independence for the
   city, it won’t guess the Oregon cities, which is what I want. That in itself 
   wouldn’t be the end of the world, but when I change each field with the correct
   info, the map doesn’t update again to reflect the changes. I thought I could 
   outsmart it by filling in the fields in reverse (Polk County for Region, Oregon
   for state, then address, etc.), but when I type the city name in, it changes 
   all of the other fields.
 * Not your fault at all, but unfortunately it makes it pretty unusable for us right
   now. I’ll see if I can contact OpenCage for possible solutions, ideally it needs
   to offer options rather than picking the first match, or look forward to the 
   other fields to narrow the choice, or just have a way to turn off autofill.
 *  Plugin Author [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * (@duisterdenhaag)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10956137)
 * Hang on 🙂
 * I think I could work with that. The address is now searched by Street Name and
   City. I simply did not realise that in one country more cities with the same 
   name could be there… I think that is (rather) unique to the US. 😉
 * Let me try to add some parameters and see what I can do for you.
 * Could you please give a full address that is now troublesome?
 *  Thread Starter [DCuserName](https://wordpress.org/support/users/dcusername/)
 * (@dcusername)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10956246)
 * Ah, that makes sense, thanks for looking at it. : )
 * 278 S Main Street
    Independence Oregon Polk County 97351
 *  Plugin Author [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * (@duisterdenhaag)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10960477)
 * Okay, I’ve been busy with better searches all day.
 * It seems though that there is also a “problem” with that address itself. I’ve
   tried several OSM search engines and neither can find it. I can find the Independence
   Grill & Bar on 154 S Main Street in Dependence, Oregon. 😉
 * I guess it’s just not mapped for OSM, yet? Since OSM in open source, you can 
   add missing data on their website: openstreetmaps.org.
 * Still, I’m working on bettering the search anyway.
 * **EDIT:**
    It does find 278 South Main Street
    -  This reply was modified 7 years, 6 months ago by [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/).
 *  Thread Starter [DCuserName](https://wordpress.org/support/users/dcusername/)
 * (@dcusername)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10960821)
 * Interesting! Don’t mean to send you down a rabbit hole, hopefully this is useful
   to you in the larger context of the plugin.
 * If I try searches at openstreetmap.org, The only way to see a single result is
   to include both the city and state:
 * 278 S Main Street Independence Oregon
 * If I use only the city, it returns multiple entries. Technically I think the “
   S” abbreviation is the correct form for the address in the US though, I could
   be wrong.
 * Is it possible to include the same sort of choices that the openstreetmap.org
   search does? So a list of possible addresses, and no autofill until one is chosen?
   I don’t know if that’s a feature offered by the API, or would be a huge custom
   project, just throwing out ideas.
 *  Plugin Author [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * (@duisterdenhaag)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10960833)
 * Yes, I am working on the search to be like that. 🙂 It will first return several
   results that you can/have to choose from. Upon clicking the marker will be dragged
   there and the fields will be filled (but still editable).
 * We are on the same page. LOL
    -  This reply was modified 7 years, 6 months ago by [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/).
 *  Plugin Author [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * (@duisterdenhaag)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10964201)
 * In version 1.3 I have completely revised the location search. Please check it
   out and let me know. 🙂
 *  Plugin Author [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * (@duisterdenhaag)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10986194)
 * Hi David,
    By now version 1.6.0 had been released. Since I heard nothing back
   from you, I’m guessing everything works now. Closing this topic. 🙂
 * Please feel free to open a new topic if needed. 🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Location autofill’ is closed to new replies.

 * ![](https://ps.w.org/stonehenge-em-osm/assets/icon-256x256.jpg?rev=2143406)
 * [Events Manager - OpenStreetMaps](https://wordpress.org/plugins/stonehenge-em-osm/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stonehenge-em-osm/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stonehenge-em-osm/)
 * [Active Topics](https://wordpress.org/support/plugin/stonehenge-em-osm/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stonehenge-em-osm/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stonehenge-em-osm/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Stonehenge Creations](https://wordpress.org/support/users/duisterdenhaag/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/location-autofill/#post-10986194)
 * Status: resolved