Skip to main content

How do I Geocode location with either address or Lat / long

Rails • Asked by Joe Minock

I'm building a portfolio app where a user can share all of the locations that they like to work from. A location can be a home, office, coffee shop, park or some random place in the wilderness. Given the prior criteria, I'm trying to figure out how best to geocode the location given either an address input or lat /long. I know there are many gems out there that do it, but many seem to be out of date.

Any and all help is appreciated.

Ideally, I'd like to have a user be able to enter either an address or lat, long into the address field and have the location processed from that input.

Okay ladies and gents, I'm going to self resolve this one. I had found documentation that made the Geocoder Gem look out of date. After further review, it is actually quite current.

Specific to my ask. you can enter a major landmark, address, or lat/long into an "address" field and it will identify the location. Pretty cool!

Yeah, I was going to suggest the geocoder gem. It's probably the only one I've used over the last few years and it works rather well. Documentation isn't super duper great, but it's not bad.

Let me know if you have any questions on it!

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.