Is there a library or service that returns the US federal congressional district given a US address?
You can do this on govtrack.us. I am not sure if there is a code framework for this, but you could probably write one from this information.
Full disclosure - I work for a company that also provides congressional district data - smartystreets.com
Keep in mind that this information changes often and I have been looking for the last 4.5 years and haven't yet pinpointed an actual, absolutely reliable source for this data. All of the companies I have looked at, including mine, say that their source is the US Postal Service but no one in the US Postal Service has been willing to tell me how frequently the data is updated within their system and what their source might be. So, just be aware.
I'm one of the creators of Geocodio and we had this problem ourselves. So we made it part of our geolocation tools!
You can use the Geocodio API or spreadsheet upload to look up Congressional districts, Representative/Senator contact information, etc. Docs: https://www.geocod.io/docs/#congressional-districts
You can use the Sunlight Foundation Congress API, which is free to use. Go to: http://tryit.sunlightfoundation.com/congress You can determine congressional district by zipcode (not completely reliable since zipcodes can traverse multiple districts) or by latitude/longitude. Just use Google geocoding to retrieve lat/lng from your address, and then you can look up the congressional district.
The whoismyrepresentative.com/api site can translate a zipcode into a congressional district. You can do a call with the url below, replacing 10038 with your zipcode.
http://whoismyrepresentative.com/getall_mems.php?zip=10038&output=json
Hope that helps!
**Also note that the sunlightfoundation site returns a 404 error and govtrack.us does not have an api for searching for congressional districts.
Related
I need to get all addresses (on house number level) by their zip code - thought about OpenStreetMap but haven't found a way yet to achieve this. Their API can give me a feature of a zip code, but not the addresses in there, how to do this?
I'm open for other web services as well.
After some research it looks as still the best data available for that purpose will be the one offered by official/administrative sources.
I'm trying do some analysis on locations where people are going during winters. The approach I'm following is get tweets from a specific city (say, New York) and with the keyword Foursquare. Then use foursquare data for that user to see his/her checkins and try to trace a pattern.
So, I'm stuck in the first phase. How do I get those tweets from ONE city and with the keyword FOURSQUARE. I'm not sure if I understood how to use streaming API correctly and the ReST API isn't working (shows NOT AUTHORISED)
Could you tell me a detailed procedure for a rookie to understand the process of doing the above mentioned process. Also, let me know if you have a better approach for analysing trends in check ins.
Thanks
You want to read these:
https://dev.twitter.com/docs/api/1/get/search
https://dev.twitter.com/docs/platform-objects/places
You can give Twitter a latitude/longitude coordinate and a radius, or you can use the "place" field as a filter. Either way, expect to fine-tune this a bit to fit your needs. You also need to take into account that a lot of people might tweet without location services enabled.
If you want to use the REST API, you need to get an API key from twitter.
The app I'm building needs to be able to match up users to events based on the city/town they're in. I'm still relatively new to Rails and completely new to Geolocation and using locations in an app. I'd figured on a design where users have one or many cities, and events would have one city which I'd hoped to extract without specifically asking the user for it, by getting it from the event address entered.
Mostly to provide some outside checking to help get the address entered correctly and consistently, but also to show a map, I installed this jquery address picker (https://github.com/sgruhier/jquery-addresspicker). Unfortunately the data returned by Google doesn't include a city but a "locality" or an "administrative area" that doesn't correlate reliably to city names. The localities being returned are more like what we in my home town would call "suburbs". What I need to procure is a city so I can allow users to search all events in their city rather than just the ones in their suburb.
Can anyone offer advice on how I could go about doing this? Many thanks.
Edit: Should maybe add that I'm wanting to do geocoding client-side so I don't run into problems with Google Maps limits or have to pay for geocoding etc.
There are some gems that provide you with that and may others geo related features, like calculating distances.
Here are the 2 most famous: https://github.com/alexreisner/geocoder and https://github.com/imajes/geokit
In the future I highly recommend you to head to https://www.ruby-toolbox.com/ to see what is available as a gem already and see what is the most popular at the moment.
For raw address info, use Google Maps API Reverse Geocoding which accepts lat/lon inputs and returns street address components. Modern browsers support location awareness (geolocation), with user permission, and will give you a lat/lon that "tends to be close" to where the browser is. That will probably get you a correct city/town in most cases.
The maps API is part of Google's broad suite of API tools -- there are gems that handle any Google API (well, most of them), or check out Google Maps for Rails, which will at the very least give you a good head start on how to use the API.
But if you're looking to validate postal code, this method will come up short, since the location awareness will vary in accuracy depending on browser, device (more accurate for mobile), the connection, population density, network coverage, and so on. Also, calling the
If you can get GPS-accurate lat/lon then it will be much more accurate ... except in some cases like in large cities, a single building will have its own postal code, so a few feet one way or the other might matter.
There are a lot of geocode services out there (like http://geo-autocomplete.googlecode.com/svn/trunk/demo/ui.demo.html for example) where user can write a location (or part of it) and it will be resolved to real existing location.
There is also a lot of info provided with the search result (like country ISO code, coordinates, etc..), but none of the services seem to provide country and city code.
What I mean is a code used to phone to certain are. For example Country code for Germany will be 49 and for city of Dusseldorf will be 211.
Is there any service, where I can get this info from the user input. Or is there any way to combine the two. For example I get city name from google geocode service and the try it on some city codes database. If yes, can anyone please provide me with links.
You can use for instance Yahoo's GeoPlanet. For more elaboration on services to solve your problem you might want to check out this answer on gis.stackexchange.com, which seems to cover the kind of service you need.
Is there a way getting all countries, states,cities zipcodes/ in one single database.
I have been looking all over.
I discovered geonames.org, which has I guess all of the content. But there is no way to fetch that data directly.
I am using rails. If there any helpers or Plugins, it'd be great. It would be awesome if there is a complete resource in any parsable format which I can use to get this database in place.
Please recommend if you any thanks
I do have the iso country code list but no States for some countries.
Thanks in advance
Thanks Guys,
I got all the the countries and states of all of them, but no zip codes.
http://27.org/isocountrylist/iso_country_list.sql
This contains all countries, and there iso-3166 codes ( Siberia code needs to be changed from "CS" to "RS")
And here is the FIPS file for countries with states
http://www.maxmind.com/app/fips_include
For zip code validation I am using
http://www.geonames.org webservices
There is a geonames ruby gem as well, which makes it really simple to do zipcode validations
Hope that helps anybody who needs this information, worth keeping it handy for web projects.
Another Link ( thanks #laise ): http://dev.maxmind.com/static/csv/codes/maxmind/region.csv
The Carmen plugin is almost certainly what you're looking for.
This will take a little legwork and data munging, but it's not too bad.
Countries and country codes are easy to come by. Sounds like you already have them.
Not all countries are divided into states. You may have to simply address these one by one-- there may be some combined reference, but not that I know of.
U.S. cities are available, and look for things like FIPS codes. There are commercial data providers that will provide you clean, well-organized data, but they are charging for it.
The post office has some databases with all the zip codes. Note that these charge periodically, and a single zip code doesn't imply a single single (far from it!). And it may not be necessary to actually have a database of all of them, as there are zip verification/correction services available for free.
For loading the data, check out a recent railscast on the subject.
I was looking for the same and found this resource. I hope somebody serves well as me.
http://dev.mysql.com/doc/world-setup/en/index.html
For those using the FIPS 10-4/FIPS 5-2 standard, I have been maintaining the NGA GEC (formerly FIPS 10-4/5-2) Excel spreadsheet (original format) for 1st level administrative divisions of countries. The spreadsheet is currently updated to Update 15 (March 2014):
http://www.opengeocode.org/archive.php