ThinkGeo.com    |     Documentation    |     Premium Support

OSM Overlay show tiles with no access picture

Hi, we have used OSM as an overlay and it did work. Recently when we revisited the project and the OSM layer showed up with “no access” pictures:

This is our code to to render the OSM overlayer:

                    mapView = view.FindViewById<MapView>(Resource.Id.MapView);
                    OpenStreetMapOverlay osmOvelerlay = new OpenStreetMapOverlay();
                    osmOvelerlay.Name = "OSMOverlayer";
                    mapView.MapUnit = GeographyUnit.Meter;
                    mapView.ZoomLevelSet = new SphericalMercatorZoomLevelSet();
                    mapView.CurrentExtent = osmOvelerlay.GetBoundingBox();
                    mapView.Overlays.Add("OSMOverlayer", osmOvelerlay);
                    mapView.ZoomIn(95);

I have searched the ThinkGeo forums and found a similar post:
OSM produce blank tiles

I have applied the answer to the post above to our application but it did not work. The answer was to add the property in the manifest: android:usesCleartextTraffic=“true”

Here is our AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="AMS360.VERSION3" android:installLocation="auto" android:versionName="V3.18" android:versionCode="18">
	<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
	<application android:usesCleartextTraffic="true" android:theme="@style/AMSTheme" android:label="AMS360-V3" android:icon="@drawable/Icon"></application>
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
	<uses-permission android:name="android.permission.ACCESS_GPS" />
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
	<uses-permission android:name="android.permission.BLUETOOTH" />
	<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.CAMERA" />
	<uses-permission android:name="android.permission.FLASHLIGHT" />
	<uses-permission android:name="android.permission.INTERNET" />
	<uses-feature android:name="android.hardware.camera" />
	<uses-feature android:name="android.hardware.camera.autofocus" />
	<uses-feature android:name="android.hardware.camera.flash" />
</manifest>

We use ThinkGeo.MapSuite 10

We have tested on Android 9

I have also check the logs. The message is:

A connection to http://c.tile.openstreetmap.org/ was leaked. Did you forget to close a response body?

Any help will be welcome.

Thanks
I copied your code. It works fine

You may need try to get the latest mapsuite 10 NuGet package. Also try to pass the userAgent for the OMS overlay

Something like this one.
OpenStreetMapOverlay osmOvelerlay = new OpenStreetMapOverlay(“App”);

Could you upload your full sample project we could look into more detail.

Thanks

Frank

Hi Frank

We have decided to upgrade to version 12.3.5. I managed to resolve a few errors and used the GettingStarted example of the Android version to setup the map. I have setup a class like the example called CustomMapView that inherits from MapView.

We use Fragments in our Android app. As soon as I navigate to the fragment where the CustomMapView is called I get the error:

System.TypeLoadException: Could not set up parent class, due to: Could not load type of field ‘ThinkGeo.UI.Android.MapView:D0U=’ (11) due to: Could not resolve type with token 01000025 (from typeref, class/assembly System.Collections.Generic.Stack1, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) assembly:mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e type:System.Collections.Generic.Stack1 member:(null) signature: assembly:/storage/emulated/0/Android/data/AMS360.VERSION3/files/.override/ThinkGeo.UI.Android.dll type:MapView member:(null) signature:

I have deleted the bin files, cleaned the project and rebuild it but it does not work. I have deleted the packages folder and restored the nuget packages but it does not work.

I have manually deleted the app on the emulator and ran the app again but with no luck. It seems something is not compatible. I have searched on google for the error but there is not much on it.

Maybe you know why this error is thrown. If not I will create a sample of our application and send it to you.

Thanks in advance.
Hannes

Thanks Hannes,
I tried with the sample.


It works good.

Could you provide us a sample. That will be very helpful for us to look into more details.

Thanks

Frank

Hi Frank

Thanks for the response. I could not get this working, so what I did was to open the solution in Visual Studio 2019 instead of 2017. I then changed the Target Framework to Android 10.0 (This was not available in VS 2017). This fixed the problem. I did not get the error anymore and the maps are working. I have some other challenges with the upgrade to 12.0, especially with the rendering of Shapefiles that display incorrectly but I will follow the samples etc. for 12.0 to get this working.

Thanks for your efforts.

Hannes

Thanks Hannes,
Good to know it works with Visual Studio 2019. Go ahead let us know if you have any question during the upgrade process.

Thanks

Frank