ThinkGeo.com    |     Blog    |     Wiki    |     Support

Caching, Drawing, and MapSuite 10 for FormsEdition

Hello ThinkGeo, and thanks for the great software!

We are currently developing an app in Norway that uses Xamarin Forms, and the ThinkGeo Mapsuite Formsedition software as our map engine.
It is currently only also the real alternative for an application for our magnitude, and we are quite pleased with it so far wih being able to load custom WMS Overlays, drawing on the map, and other useful functionality.
However, some bugs have been discovered along the way that we hope you can help us with in order to make the perfect application. We use version 9.0.615.0 FormsEdition

1 - Pre-emptive offline caching
We’d like to have pre-emptive offline caching of the map in our app, as the map will be used in remote areas with bad- or no mobile internet at all. Our idea is to when the user starts the map, that all map tiles for pre-defined Zoom-levels will be downloaded for a certain area.

Now, regular tile caching exists within the WMS overlay as you created it for us, but is there a method to manually force tilecaching, without the user moving around the map? Eg. Say I want to cache all tiles for zoom 8-10-13 within a 10 mile radius.

2 - Storing the cache - DB or SD-Card?
The offline tiles, are they best stored within a database, or directly on the filesystem itself?

3 - Creating a CTRL-Z button for drawing, regretting 1 point of drawing.
Users in our application are able to draw polygons. Is there a method of creating a CTRL-Z function?
My current plan is to store polygons in two states. One is the current state, and the other is - 1 drawn point.

4 - Fetching tiles, and increasing timeout for map tiles
Currently if the map tiles timeout before being fetched, a “not-drawn” standard tile is shown. Is there a way to increase this timeout before the fetch tile functionality times out, or possibly a way to force it to try again?

5 - Bug for using ThinkGeo on IOs, and Norwegian dateformat. See the attached crashreport
We tried using ThinkGeo on an Iphone 6 plus S, but it crashed. The full stacktrace for this can be seen below, and has something to do with parsing dates. Our Iphone was set to Norwegian language/region, and it didn’t crash when we changed the language to USA region.

6 - Product Center, or Nuget for Formsedition?
We have seen the new MapSuite 10.0 having been released, but we are somewhat confused to whether we should continue to use MapSuite 9.0.615 from the Product Center, or if a formsedition Nuget Package exists. We only saw for Android, or IOS.

Forgot to paste the error code -

System.TypeInitializationException: The type initializer for 'ThinkGeo.MapSuite.iOSEdition.Overlay' threw an exception. ---> System.FormatException: String was not recognized as a valid DateTime.

at System.DateTimeParse.Parse (System.String s, System.Globalization.DateTimeFormatInfo dtfi, System.Globalization.DateTimeStyles styles) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.6.0.10/src/mono/mcs/class/referencesource/mscorlib/system/globalization/datetimeparse.cs:2282
at System.DateTime.Parse (System.String s) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.6.0.10/src/mono/mcs/class/referencesource/mscorlib/system/datetime.cs:1024
at NhU=.lRY=.GetAppInstallDateTimeCore () [0x0002f] in :0
at ThinkGeo.MapSuite.Portable.PortableEnvironment.lRg= () [0x00001] in <7de01db331474c068dd1ca683ccbd366>:0
at System.PclEnvironment.get_AppInstallDateTime () [0x0000b] in <7de01db331474c068dd1ca683ccbd366>:0
at ohM=.jBg=.lBg= () [0x00013] in <7de01db331474c068dd1ca683ccbd366>:0
at ThinkGeo.MapSuite.Core.Validators.CheckEvalStatus () [0x00001] in <7de01db331474c068dd1ca683ccbd366>:0
at ThinkGeo.MapSuite.Core.Validators.CheckIfInputValueIsBiggerThan (System.Double inputValue, System.String parameterName, System.Double minValue, ohM=.qkE= includeMinValue) [0x00001] in <7de01db331474c068dd1ca683ccbd366>:0
at ThinkGeo.MapSuite.Core.RectangleShape…ctor (System.Double minX, System.Double maxY, System.Double maxX, System.Double minY) [0x00008] in <7de01db331474c068dd1ca683ccbd366>:0
at ThinkGeo.MapSuite.iOSEdition.Overlay…cctor () [0x0000b] in :0
— End of inner exception stack trace —
at ThinkGeo.MapSuite.iOSEdition.InteractiveOverlay…ctor () [0x00000] in :0
at ThinkGeo.MapSuite.iOSEdition.EditInteractiveOverlay…ctor () [0x00000] in :0
at ThinkGeo.MapSuite.iOSEdition.MapView.ZRU= () [0x00017] in :0
at ThinkGeo.MapSuite.iOSEdition.MapView.ZhU= () [0x000a1] in :0
at ThinkGeo.MapSuite.iOSEdition.MapView…ctor () [0x00008] in :0
at ThinkGeo.MapSuite.FormsEdition.iOS.iOSMapViewAdapter.CreateConcreteCore () [0x00000] in :0
at ThinkGeo.MapSuite.FormsEdition.Adapters.MapElementAdapter.CreateConcrete () [0x00000] in <20f01b46eb38468a8d98c95a7d58576c>:0
at ThinkGeo.MapSuite.FormsEdition.Adapters.MapElementAdapter.get_Concrete () [0x0000a] in <20f01b46eb38468a8d98c95a7d58576c>:0
at ThinkGeo.MapSuite.FormsEdition.iOS.iOSMapViewAdapter…ctor () [0x00020] in :0
at ThinkGeo.MapSuite.FormsEdition.iOS.MapSuiteForms.Init () [0x00000] in :0
at BeiteSnap.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00022] in /Users/larstu/Projects/BeiteSnap/iOS/AppDelegate.cs:109
at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/4292/e66c6f19/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/4292/e66c6f19/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at BeiteSnap.iOS.Application.Main (System.String[] args) [0x00008] in /Users/larstu/Projects/BeiteSnap/iOS/Main.cs:18

Hi Jehans,

Welcome to choose our product! Please refer to the following 6 points for your questions:

  1. MapSuiteFormsEdition supports offline cache. There are two ways for that:
  1. If you set tile cache for overlay, the tiles will be cache automatically when you view map online. Then if mobile device is offline, map will load the tile cache.
  2. You can use CacheGenerator tool (http://wiki.thinkgeo.com/wiki/_media/file/ServicesEditionSample_CacheGenerator_CS_150204.zip ) to pre-build all tiles image, then copy them to mobile device. You can set zoom level and map extent on the tool, so you can easily cache target tiles that you want.
  1. At present, MapSuiteFormsEdition only supports file system cache. You can set tile cache on overlay. Please refer to the following code:
    WorldMapKitOverlay wktOverlay = new WorldMapKitOverlay ();
    wktOverlay.TileCache = new FileBitmapTileCache(“cacheDirectory”, " cacheId");

  2. MapSuiteFormsEdition supports drawing and editing polygons. You can store drawing polygons states by TrackInteractiveOverlay. There isn’t a method of creating a CTRL-Z function here, you need to use TrackInteractiveOverlay to realize your requirement, you can saved the previous features then replace them back if you want “Undo”.

  3. You can increasing timeout by TimeoutInSeconds property on layer or overlay. MapSuiteFormsEdition don’t have API to send request again. You can use SentWebRequest event handler to realize sending request again.

  4. I guess that the issue is caused by date format. The date format is different with other regions. Can you provide us more information or a demo?

  5. At present, MapSuite10 doesn’t support Xamarin Forms. You can go on use MapSuite9.0 for that. Please notice the MapSuite9.0 doesn’t support NuGet, so please download it form our ProductCenter.

Thanks,

1 - As the map will be used all over our country, precaching and sharing tiles from a server is not an option. I have already implemented the caching functionality you describe in our application, but I would like to run a background process that cache specified parts of the map before the map is even viewed.

However I guess that is not possible?

2 - Thank you!
3 - Thank you!

4 - I cant find this property anywhere. Is it a Parameters function?
wmsOverlay.Parameters.Add(“TIMEOUTINSECONDS”, “5”);

5 - Here is all the information that I have, and if that is not enough I can provide you with a demo. Would a recorded screen session when the bug occurs be enough?

Phone: Iphone 6 plus +
Region: Norway
Language: Norwegian Bokmål
ThinkGeo: 9.0.615.0 Forms Edition

The bug occurs during initialization of the map, so it is never shown at all.

6 - Thank you!

Hi!

Are there any updates on the DateFormat bug for iOS?

Hi Jehans,

This week we get more reply about Android, so we replied you a little late.

Please refer to the following points about your questions:

  1. It is supported that caching specified parts of the map by background process. Here is the CacheGenerator tool, and you can refer to it.

CacheGenerator.zip (4.3 KB)

  1. Our developer have added the TimeoutInSeconds property for WmsOverlay. The change will apply to the 9.0.660.0 version for MapSuiteFormsEdition.

  2. We recreated the date format issue and fixed it. The hotfix will apply to the 9.0.660.0 version.

Thanks,

Thanks so much!
Have a good easter.

Hi Jehans,

I am glad to hear that’s helpful.

Regards,

Don

Hello again,

I have a question regarding the cache generator you provided. Is it code that is supposed to be ran serverside, and then copied over to the users phone?

Hi Jehans,

Please refer to the following points about your questions:

  1.   The cache generator tool can be ran on server side. You can copy the tile cache to the users phone. 
    
  2.   This tool platform is windows. You can refer to its logic, and try to cache tile by background process on client side.
    

Thanks,

Does MapSuite 10 support Xamarin Forms yet?

Cheers

Steve

Hi Steve,

MapSuite 10 don’t support Xamarin Forms.

Does your scenario have to use Xamarin Forms?

Regards,

Ethan

Hi Ethan

Yes we are looking to use Xamarin Forms.

I can see references (in the forums) to it working in v9.0?

I may be able to install it in the iOS and Android head projects then create a dependency service to drive it from the Xamarin Forms project but it would be a lot of work.

Any ideas? Are any other customers using it with Xamarin Forms?

Cheers

Steve

Hi Steve,

Our next generation map have the plan to support Xamarin Forms, but mapsuite 10 won’t support that.

So if you want to use that, there are two solution:
a. Use MapSuite 9 for now, and upgrade to new product after it release.
b. Use MapSuite 10 and you write the custom project to drive Android and iOS, this project should works just like Xamarin Forms.

Regards,

Ethan

Hi Ethan

Thanks for the reply.

Any plans to also support UWP in your next generation map? We are hoping to cover this as well as iOS and Android in Xamarin Forms.

Cheers

Steve

Hi Ethan

Also, is the next generation map on your roadmap? Any approximate timescales?

Cheers

Steve

Hi Steve,

We don’t have the plan to support UWP in next generation map, and because it introduce many big changes, we hadn’t get the timescales from development team.

Regards,

Ethan