0

I made a website in Java and Google App Engine about tuitions. I want to show only the tuitions near that user. So how can I do this? Link to the website: http://tut-points.appspot.com If you can see, it is showing all the courses which were added, but I want to show only the courses which are near to the user.

Ankur Palmia
  • 121
  • 6

1 Answers1

1

Are you on App Engine Standard? If so you should be receiving these headers giving you the user's general location:

https://cloud.google.com/appengine/docs/standard/python/reference/request-response-headers#app_engine-specific_headers

X-AppEngine-Country

Country from which the request originated, as an ISO 3166-1 alpha-2 country code. App Engine determines this code from the client's IP address. Note that the country information is not derived from the WHOIS database; it's possible that an IP address with country information in the WHOIS database will not have country information in the X-AppEngine-Country header. Your application should handle the special country code ZZ (unknown country).

X-AppEngine-Region

Name of region from which the request originated. This value only makes sense in the context of the country in X -AppEngine-Country. For example, if the country is "US" and the region is "ca", that "ca" means "California", not Canada. The complete list of valid region values is found in the ISO-3166-2 standard.

X-AppEngine-City

Name of the city from which the request originated. For example, a request from the city of Mountain View might have the header value mountain view. There is no canonical list of valid values for this header.

X-AppEngine-CityLatLong

Latitude and longitude of the city from which the request originated. This string might look like "37.386051,-122.083851" for a request from Mountain View.

Alex
  • 5,141
  • 12
  • 26