Google map geocoding address parser - api

I want to parse the addresses from Google geocoding API and store it as:
address
city
state
zipcode
country
Some places has full address from Google map and some just half, how can i know which part of the address is city, state or country? or just zipcode?
It would be helpful if some expert pointed out some help here.

In the response the geocoding API breaks up the address into AdministrativeAreaName (usually State) and SubAdministrativeArea. The SubAdministrativeArea area includes LocalityName (City), PostalCodeNumber (Zip Code) and Thoroughfare (Street Name and Number). For an example see: http://maps.google.com/maps/geo?q=1%20Infinite%20Loop,%20Cupterino,%20Ca. This is a geocode requst for Apple's Headquarters which has an address of 1 Infinite Loop, Cupterino, CA 95014.

Related

How to check user is within given Country or not using reverse geocode. "HereMap Reverse Geocode"

I want to get reverse geocode of Here map to fetch user postalCode with specified Country. So, if user is not in that Country, it should give error/warning message.
How about enabling the parameter show->countryInfo on the request so that we receive the country info in the response, and then do your own client-side checking for that country? https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html

React-Admin: How to create two related component in one form (user and its address)

I'm trying to make a react-admin component for create User and its Address in one form. (one-to-one relation)
Here the schema:
User (Name, AddressId)
Address (Street, City, Country)
Through different ways, I tried with ReferenceField/ReferenceInput but the best answer I found is with a select and create/show buttons. (Link to tutorial)
I just want to make a CreateForm component which contains 4 text inputs like this :
user name
address street
address city
address country
Is it possible through the react-admin components ?

amadeus api where if the list of all cityCodes

In Amadeus API the is often a reference to "cityCode"
The documentation give this example
https://test.api.amadeus.com/v2/shopping/hotel-offers?cityCode=PAR&adults=1&radius=5&radiusUnit=KM&paymentPolicy=NONE&includeClosed=false&bestRateOnly=true&view=FULL&sort=PRICE
Where is the list of ALL cityCode ???
for this example it seems PAR refers to PARIS
is this https://service.unece.org/trade/locode/fr.htm
is there a cvs format of all city codes ?
Thanks
You can use the Airport & City Search API to find an IATA code based on a city name
Otherwise, this website provides a list of IATA city codes.

Get CityCode By IP from GeoIP2 City Database

Is there any way of utilizing maxmind in order to get city codes via the IP of the user ?
In the following example, I am able to get the name of the City but not cityCodes. As far as I know maxmind does not have a support for city codes ;
Ref for maxmind support : https://www.maxmind.com/en/geoip2-city
E.g;
private static DatabaseReader reader = null;
InetAddress inetAddress = InetAddress.getByName(ipAddress);
CityResponse response = reader.city(inetAddress);
String cityName = response.getCity().getName(); //Istanbul
String cityCode = response.getCity().???code???; // The desired output : IST
As far as I am aware, the UN/LOCODE is the closest match to what you are asking for. MaxMind itself does not provide these codes in its data set, but it does provide a geoname_id for the city that can be used to look up the city in the GeoNames data set. GeoNames provides UN/LOCODE in their premium data set.

How do I convert from a location (address) String to a YGeoPoint in Yahoo Maps API?

I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The addMarker() method on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps must know how to convert from addresses because drawZoomAndCenter(LocationType,ZoomLevel) can take an address. I could convert by using drawZoomAndCenter() then getCenterLatLon() but is there a better way, which doesn't require a draw?
You can ask the map object to do the geoCoding, and catch the callback:
<script type="text/javascript">
var map = new YMap(document.getElementById('map'));
map.drawZoomAndCenter("Algeria", 17);
map.geoCodeAddress("Cambridge, UK");
YEvent.Capture(map, EventsList.onEndGeoCode, function(geoCode) {
if (geoCode.success)
map.addOverlay(new YMarker(geoCode.GeoPoint));
});
</script>
One thing to beware of -- in this example the drawAndZoom call will itself make a geoCoding request, so you'll get the callback from that too. You might want to filter that out, or set the map's centre based on a GeoPoint.
If you're working with U.S. addresses, you can use geocoder.us, which has APIs.
Also, Google Maps Hacks has a hack, "Hack 62. Find the Latitude and Longitude of a Street Address", for that.