deptofdefense / move.mil

The entry point website to the Defense Personal Property System (DPS).
https://www.move.mil
Other
15 stars 15 forks source link

Use data from free_zipcode_data to power location search for ZIP codes #396

Closed jamesatheyDDS closed 6 years ago

jamesatheyDDS commented 6 years ago

Checklist

I have…

Summary of Changes

This pull request utilizes data from the GitHub project free_zipcode_data to power the ZIP code search functionality in the locator maps instead of relying on Google for it.

In the unlikely event of the user appending ?query=62225 (as an example) to the locator map URL, or following a link to the page with that in the URL, the results will now say "Displaying results near Scott Air Force Base, IL 62225" (the city and state associated with the ZIP code) instead of "Displaying results near 38.5426987, -89.8551818" (the lat / lng associated with the ZIP code).

That said, if the user follows the normal route of typing "62225" in the search box, the page will still show the coordinates instead of the city state. Addressing that will require a more extensive change to the locations_controller.rb.

Testing

To verify the changes proposed in this pull request…

  1. clone this repo,
  2. git checkout my_zipcode_gem,
  3. set up development dependencies according to CONTRIBUTING.md,
  4. run bin/rails server, and
  5. load up http://localhost:3000 in the Web browser of your choice.

Screenshots

Results from searching for 62225 - same as before screen shot 2018-03-22 at 12 18 27 pm
Results with ?query=62225 in the URL screen shot 2018-03-22 at 12 18 02 pm
jamesatheyDDS commented 6 years ago

@jgarber623-gov Given your comments on the my_zipcode_gem-supplied models, one could argue that I should just ditch the gem entirely, since we're not using its downloader task, or large parts of the models it provides, or any of the County functionality. I could refactor this PR to just use the CSV files from the free_zipcode_data project, trim down the models to just the code we need, and remove all of the extra dependencies my_zipcode_gem wants to introduce.

jamesatheyDDS commented 6 years ago

@jgarber623-gov The PR is much shorter now.