Open jarvisteach opened 7 years ago
For scrolling, 2 things are important:
Combining these will allow us to calculate the height & width in lat/long. Then we just add/subtract these depending on the direction, and show a new tile.
Latitude is the number of degrees north/south form the equator, up to 90 - reaching 90 hits a pole. Longitude is the number of degrees east/west from greenwich, up to 180 - reaching 180 hits the international date line.
So:
Should include an image to show when can't connect to GoogleMaps.
This site details how to convert an address into LAT/LONG: https://developers.google.com/maps/documentation/geocoding/intro
It requires an API key: https://developers.google.com/maps/documentation/javascript/get-api-key Giving 2,500 requests/day - should suffice.
Given two parameters: address & key, it returns something like below. With location containing the important data;
{
"results" : [
{
"address_components" : [
{
"long_name" : "France",
"short_name" : "FR",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "France",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 51.1241999,
"lng" : 9.6624999
},
"southwest" : {
"lat" : 41.3253001,
"lng" : -5.5591
}
},
"location" : {
"lat" : 46.227638,
"lng" : 2.213749
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 51.1241999,
"lng" : 9.6624999
},
"southwest" : {
"lat" : 41.3253001,
"lng" : -5.5591
}
}
},
"place_id" : "ChIJMVd4MymgVA0R99lHx5Y__Ws",
"types" : [ "country", "political" ]
}
],
"status" : "OK"
}
Issue at school - proxy server blocks GoogleMap request. Need to first register the proxy. Function to set a proxy string, if it's set then should use it. Should also handle proxy error, show message, and give pop-up to collect the connection string.
Have got this working at school, by bypassing proxies:
urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler({})))
When a connection fails, we should look at error codes, if we get a 407, we can try the above line of code, to see if it works...
Split out from issue #136
Version 2, should have:
Version 3, should have:
Also: