weather_japan

Creator: coderz1093

Last updated:

0 purchases

weather_japan Image
weather_japan Images

Languages

Categories

Add to Cart

Description:

weather japan

weather_japan #
A Dart package of weather forecast inside Japan.
Easiest sample #
The following fragment illustrates how to obtain weather info. for a specific location:
final weather = await Weather.fromLocation(lat: 33.1787095, lng: 129.6762743);
if (weather != null) {
print(weather);
}
copied to clipboard
Data Caching #
The process downloads geometry data to detect weather forecast area. And, by default, it downloads the data every time it is required.
To enable the data cache for reusing the data once downloaded, you should pass cacheDirectory parameter to Weather.fromLocation function:
final weather = await Weather.fromLocation(
lat: 33.1787095, lng: 129.6762743,
cacheDirectory: '/tmp');
copied to clipboard
For Flutter applications, you can use path_provider to obtain path suitable for such data. Normally, getTemporaryDirectory can be a good choice.
Replacing Download/Cache Mechanism #
You can replaces the download/cache mechanism by supplying download parameter to Weather.fromLocation function:
// Illustrates download/cache mechanism using flutter_cache_manager
final weather = await Weather.fromLocation(
lat: 33.1787095, lng: 129.6762743,
download: (url) async {
final file = await DefaultCacheManager().getSingleFile(url);
return await file.readAsString();
});
copied to clipboard
Dataset Licenses #
Basically, the datasets/contents are licensed under CC BY 4.0:

『気象庁防災情報発表区域データセット』 (NII作成) 気象庁のデータを翻案
気象庁ホームページのコンテンツの利用について

Internals #
The plugin internally does the following things to obtain weather info. for locations:


The library uses pre-generated "area code to bounding box" table to find areas which contains the location in its bounding box.


For each area, download the geometry data (topojson data) from 市町村等(気象警報等) 発表区域データ | 気象庁防災情報発表区域データセット and do hit-test to determine whether the area actually contain the location.


Obtain area code corresponding to the area.


Obtain weather info. corresponding to the area code via 天気予報 API(livedoor 天気互換).


For the step 2, because the geometry data is still

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.