Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] With map downloading #79

Closed
5 tasks done
jonjon0815 opened this issue Dec 12, 2022 · 5 comments
Closed
5 tasks done

[BUG] With map downloading #79

jonjon0815 opened this issue Dec 12, 2022 · 5 comments
Labels
bug This issue reports broken functionality or another error invalid The reported bug cannot be reproduced, or the feature request is impossible or already exists

Comments

@jonjon0815
Copy link

jonjon0815 commented Dec 12, 2022

What is the bug?

I downloaded a map with this code.

final region = RectangleRegion(
  LatLngBounds(
    LatLng(49.04939038046036, 8.761878343788906), // North West
    LatLng(48.41420735271916, 9.885473628398131), // South East
  ),
);

final downloadable = region.toDownloadable(
  5, // Minimum Zoom
  8, // Maximum Zoom
  TileLayer(
    urlTemplate: 'http://tile.openstreetmap.org/{z}/{x}/{y}.png',
    userAgentPackageName: 'exampleUser',
  ),
);

print(downloadable.toString());

FMTC.instance('storeName').download.check(downloadable).then((value) {print(value);});

Stream<DownloadProgress> stream = FMTC.instance('storeName').download.startForeground(region: downloadable);

stream.forEach((element) {print(element.percentageProgress);});
print("gespeicher!");`

With console output:

I/flutter ( 6268): gespeicher!
I/flutter ( 6268): 10
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk hostname=tile.openstreetmap.org; servname=(null); netid=0; mark=0
D/libc-netbsd( 6268): [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0
I/flutter ( 6268): 10.0
I/flutter ( 6268): 20.0
I/flutter ( 6268): 30.0
I/flutter ( 6268): 40.0
I/flutter ( 6268): 50.0
I/flutter ( 6268): 60.0
I/flutter ( 6268): 70.0
I/flutter ( 6268): 80.0
I/flutter ( 6268): 90.0
I/flutter ( 6268): 100.0

But the map only shows white screen. For the map I use this code:

FlutterMap(
    options: MapOptions(
      center: LatLng(auf.alt??0.0, auf.lang??0.0),
      zoom: 8,
      keepAlive: true,
      interactiveFlags: InteractiveFlag.all & ~InteractiveFlag.rotate,
    ),
    nonRotatedChildren: [],
    children: [
      TileLayer(
        tileProvider: FMTC.instance('storeName').getTileProvider(),
        //urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
        //userAgentPackageName: 'com.example.app',
      ),
      MarkerLayer(
        markers: [
          Marker(
            point: LatLng(auf.alt??0.0, auf.lang??0.0),
            width: 50,
            height: 50,
            builder: (context) => buildIcon(),
          ),
          Marker(
            point: LatLng(auf.alt??0.0, auf.alt??0.0),
            width: 40,
            height: 40,
            builder: (context) => logoIcon(),
          ),
        ],
      ),
      CurrentLocationLayer(),
    ],
  ),

What is the expected behaviour?

show Map

How can we reproduce this issue?

No response

Do you have a potential solution?

I don't know why

D/libc-netbsd( 6268): getaddrinfo: tile.openstreetmap.org get result from proxy gai_error = 0

is thrown.

Can you provide any other information?

No response

Platforms Affected

Android

Severity

Erroneous: Prevents normal functioning and causes errors in the console

Frequency

Consistently: Always occurs at the same time and location

Requirements

  • I agree to follow this project's Code of Conduct
  • My Flutter/Dart installation is unaltered, and flutter doctor finds no relevant issues
  • I am using the latest stable version of this package
  • I have checked the FAQs section on the documentation website
  • I have checked for similar issues which may be duplicates
@jonjon0815 jonjon0815 added bug This issue reports broken functionality or another error needs verification This needs to be verified/tested before fixes (or not) can be made labels Dec 12, 2022
@jonjon0815 jonjon0815 changed the title [BUG] [BUG] With map downloading Dec 12, 2022
@JaffaKetchup
Copy link
Owner

Hi @jonjon0815,
In your TileLayer, you still need to provide the urlTemplate and userAgentPackageName, and this should be the same template as used in downloading.
Please try this and let me know how it goes :)

Note that you should not use OpenStreetMap for bulk downloading! If you choose to ignore their rules, you may be banned!

@jonjon0815
Copy link
Author

Thank you for your answer. The map is now displayed again. I have limited the size to 250 tiles so it should be ok? But now I get errors like this when moving the map

E/flutter (15249): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FileSystemException: Cannot create file, path = '/data/user/0/com.example.test_aac/app_flutter/fmtc/stores/storeName/tiles/https___tile.openstreetmap.org_14_8608_5630.png' (OS Error: No such file or directory, errno = 2) E/flutter (15249): #0 _File.create.<anonymous closure> (dart:io/file_impl.dart:255:9) E/flutter (15249): <asynchronous suspension>

@JaffaKetchup
Copy link
Owner

Great @jonjon0815! You also need to ensure your store is ready and created: check the manage chain.

@jonjon0815
Copy link
Author

Thank you!

@JaffaKetchup
Copy link
Owner

No problem!

@JaffaKetchup JaffaKetchup closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2022
@JaffaKetchup JaffaKetchup added invalid The reported bug cannot be reproduced, or the feature request is impossible or already exists and removed needs verification This needs to be verified/tested before fixes (or not) can be made labels Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error invalid The reported bug cannot be reproduced, or the feature request is impossible or already exists
Projects
None yet
Development

No branches or pull requests

2 participants