👩💻Job board for Flutter™, Google’s UI toolkit for building beautiful apps for mobile, web & desktop
Flutter Geocode lookup with cache
Looking for a flutter mode/wrapper that provides caching to the Google geocaching lookup service so that I only need to lookup the location of a photo once. Deliver in with a basic flutter demo app with your model in an easy to import file.
Inputs: A photo's EXIF GPSInfo Tags:
#exiv2 -pv . test_photo.jps | grep GPSInfo
0x0000 GPSInfo GPSVersionID Byte 4 2 2 0 0
0x0001 GPSInfo GPSLatitudeRef Ascii 2 N
0x0002 GPSInfo GPSLatitude Rational 3 30/1 15/1 5100/100
0x0003 GPSInfo GPSLongitudeRef Ascii 2 W
0x0004 GPSInfo GPSLongitude Rational 3 97/1 39/1 2554/100
0x0005 GPSInfo GPSAltitudeRef Byte 1 0
0x0006 GPSInfo GPSAltitude Rational 1 13186/100
The eventual application will be a photo-album with < 100 photos. I would like to make to make the $$ Google API call only once and cache the data using a package like https://pub.dev/packages/flutter_cache_manager.
Requirements:
* Convert to lat/lon format needed for Google reverse geolocation lookup via:
https://developers.google.com/maps/documentation/geocoding/intro#GeocodingRequests. No EXIF library needed - I have that just start with values for each LatLong etc..
https://maps.googleapis.com/maps/api/geocode/json?key=REMOVED&latlng=30.2442,-97.6571&location_type=APPROXIMATE
* Configurable key parameter init or something (bonus points if you have insights how to best protect API key's in Flutter. )
* Provide a cache clear function
* Cache only successful lookups ;-)
* Whole response, but I will likely only use the "formatted_address": "Austin, TX 78742, USA". Really I only need the city and state (or globally friendly equivalent.)
* Provide a configurable number of entries, default to 10,. (i.e. I might just cache all 100 photos))
* Provide a configurable age for Geocode entries, default to 90 days. (I may have other cached things so not a global setting for the cache tech.)
* Leverage an existing flutter cache package.
* Basic debug logging (you can just use print, but I am using the logger libary)
String photoLocation = cachingGeoCodeFancyThing(
GPSLatitudeRef: W,
GPSLatitude: (the rational number...)
GPSLongitudeRef: N
GPSLongitude: (the rational number..)
)
📋Copy to clipboard