ThinkGeo.com    |     Documentation    |     Premium Support

Incorrect position being shown with OSM on iOS

Frankly at this point I am at a loss. Using the HowDoISampl -ForiOS I modified the UseOpenSteetMapOverlay file so that the extents are set as follows
new RectangleShape(-10914959.8856762, 3577180.44738464, -10838593.5553671, 3534701.67615024);

This should position the map in the Austin Texas area, but instead positions the map North of Alaska.

This matches the same behavior we are seeing in our application. In our Android and WPF versions these coordinates do in fact show the Austin area. Unfortunately I tried duplicating this in HowDoISample-ForAndroid, and ended up with the same results as HowDoISame for iOS with the map displaying the same area north of Alaska. I am at a los here – I basically modified our code and created a single layer exactly as done in the Android HowDoI bypassing all of our initialization code and the coordinates provided showed the Austin area as it should. I am fairly certain that I did not overlook any of our initialization code that might affect this.

We are using Xamarin forms for this with Visual Studio 2015 – Samples and Our code were all built with the latest beta daily builds from nu-get…

I am hoping you can reproduce this as I cannot for the life of me figure out why the wrong area is beings shown.

Hi Richard,

Our developer will look into it, any update I will let you know.

Regards,

Ethan

Hi Richard,

You can make it works like this, it also need to be set for Bing and Google map.

mapView.ZoomLevelSet = new OpenStreetMapsZoomLevelSet();

Here is the sample:

GettingStarted.zip (2.0 MB)

Regards,

Ethan

Not sure what this sample is. It does not load in visual Studio 2015 . Looking at the references in the dependenice folder – this looks like its using a thinkgeo version of 9 or earlier. I am using the most recent version.

As for the zoomLevelSet that is what I am using for iOS

Specifically I was using the sample from https://github.com/ThinkGeo/HowDoISample-ForiOS. The relevant code from that sample is this:

        mapView.MapUnit = GeographyUnit.Meter;
        mapView.ZoomLevelSet = new OpenStreetMapsZoomLevelSet();
        mapView.CurrentExtent = new RectangleShape(-4352400.53526627, 8867834.11959479, 10425951.3896003, -2890780.54967516);

        OpenStreetMapOverlay osmOvelerlay = new OpenStreetMapOverlay();
        mapView.Overlays.Add(osmOvelerlay);
        mapView.Refresh();

The only thing that I changed were the currentextents to the ones I specified. This sample clearly shows the issue that I am seeing in my iOS code, and it uses the current ThinkGeo libraries.

Hi Richard,

Our sample is based on Visual Studio 2017, but I think you can directly open the project file instead of the sln file.

Because you mentioned the Xamarin forms, that’s why we use version 9 dlls, our latest V10 only have IOS and Android version, but don’t have the Xamarin forms version.

Here is a new sample: GettingStarted_iOS.zip (104.9 KB)

The code change included in this package: ThinkGeo.MapSuite.Layers.OpenStreetMap 11.0.0-beta009

Wish that’s helpful.

Regards,

Ethan

Thanks Ethan. This code change cleared up the issue.

Ran into another issue not sure I should start a new topic or not. I am receiving a random crash when zooming in or out which I was able to duplicate with the code you attached.

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection

Zoomed in all the way using the zoom control then started zooming out and received the above. Inconsistent as to when the crash actually occurs. Don’t know if its a factor but I am not waiting for the maps to entirely paint before next zoom in.

Hi Richard,

It looks that’s related with OpenStreetMap, our developer will looks into it and update the status after it get solved.

Regards,

Ethan

Hi Richard,

Our developer had fixed it, please get his version: https://www.nuget.org/packages/MapSuiteMobileForiOS-BareBone/11.0.0-beta036 after it updated on the website.

Regards,

Ethan

Hi Richard,

Please try the latest sample, and notice we use the special custom zoomlevelset, and get the latest package after today.

GettingStarted_iOS_20180427.zip (106.1 KB)

The exception you mentioned about “Index was out of range” should be fixed in this change.

Regards,

Ethan

I just upgraded from OpenStreetMap version 11 beta 009 to beta version 011 and this problem is back – looks like the issue was re-introduced in beta version 010

Hi Richard,

Please try the sample which is based on beta version 011. It works well and the only change the zoomlevelset, please refer it.

9056.zip (104.7 KB)

This solution should works for both Android and IOS.

Regards,

Ethan