Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Geocoded Search and redirect WordPress

  • SOLVED

Hi all,

I'm trying to put together a custom search functionality which takes a geocoded address, runs it through the google civics API to grab the lower legislative branch open civic data code. In turn, I plan on having a page for each Congressional district -- which would have a custom field with the associated OCD data string that a geocoded search would return.

Here's a bit more of a data breakdown. For reference, here's the google civics API info:
https://developers.google.com/civic-information/docs/v2/representatives/representativeInfoByAddress#try-it

Note the parameters:
includeOffices = true
levels = country
roles = legislatorLowerBody

You'll see the response which google Civic returns contains the following:

divisions": {
"ocd-division/country:us/state:va/cd:10": {
"name": "Virginia's 10th congressional district",

I have all this data ready to go. There is a custom field attached to each district (named "ocd)" which has the related OCD string (in the above example that would be ocd-division/country:us/state:va/cd:10)

I can build the geocoded form myself. What I need is the backend function which handles the request, gets the desired result from the google civic API, and then redirects you to the matching district page based on the returned OCD value from the google civics API.

Any help here would be appreciated ASAP.

Thank you!

Answers (2)

2018-09-06

Fahad Murtaza answers:

I can help. Sending you a message.


Fahad Murtaza comments:

Send you an email on the email you shared last time.


Andrew Clemente comments:

Thanks for your help!

2018-09-06

Arnav Joy answers:

is your site live?


Andrew Clemente comments:

Yes (have not made the geosearch active yet)
https://democracyscorecard.org