Android Question Limit googlemap to special zone

devmobile

Active Member
Licensed User
hello
I need limit of googlemap in my project only
Example only newyork
Or only accpet lat lon in newyork zone
Maybe?
 
Last edited:

KMatle

Expert
Licensed User
Longtime User
Newyork have many lat lon

You can use a square (x, y and x1, y1) which is (of course) not that accurate. In one of my projects I use Google's geocode function. Input is lan/lon and you get the full address of that location. Here you can check if it's New York City or at least New York state or whatever you need.

It's just a simple api call with OkHttpUtils. You get a JSON result which you can parse (like zip / name of the city, etc.)

B4X:
Sub GetAddress (lat As Float, lon As Float)
    Dim GetAddressJob As HttpJob
    GetAddressJob.Initialize("GetAddress", Me)
    GetAddressJob.Download2("https://maps.googleapis.com/maps/api/geocode/json", _
              Array As String("latlng", lat & "," & lon))
   
End Sub
 
Upvote 0

devmobile

Active Member
Licensed User
You can use a square (x, y and x1, y1) which is (of course) not that accurate. In one of my projects I use Google's geocode function. Input is lan/lon and you get the full address of that location. Here you can check if it's New York City or at least New York state or whatever you need.

It's just a simple api call with OkHttpUtils. You get a JSON result which you can parse (like zip / name of the city, etc.)

B4X:
Sub GetAddress (lat As Float, lon As Float)
    Dim GetAddressJob As HttpJob
    GetAddressJob.Initialize("GetAddress", Me)
    GetAddressJob.Download2("https://maps.googleapis.com/maps/api/geocode/json", _
              Array As String("latlng", lat & "," & lon))
  
End Sub
Oh yes,this api return city name and other address that i can check city name
thanks
 
Upvote 0
Top