mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Comments for 1.1.0 upgrade

Open Alexphauge opened this issue 9 years ago • 13 comments

Hey everyone,

I just wanted to jot down some things I observed with our upgrade to 1.1.0.

First of all, the method (It's in Mapbox/Unity/Utilities/Conversions.cs) public static Vector2d LatitudeLongitudeToTileId(float latitude, float longitude, int zoom) - Is it supposed to use floats? Wouldn't double be more appropriate and not lose precision?

Second, this is of course not something you can't do anything about I believe, but I'd like to point out that "Multiple plugins with the same name 'sqlite3' (found at 'Assets/Plugins/x86_64/sqlite3.dll' and 'Assets/Mapbox/Core/Plugins/sqlite/x64/sqlite3.dll'). That means one or more plugins are set to be compatible with Editor. Only one plugin at the time can be used by Editor." could be a thing for some people. We just deleted the one we had under 'Assets/Plugins/x86_64/' and it worked out.

Not sure if it's something that went wrong or i'm just tired, but it seems Geocoder.cs/Geocode with the reverseGeocodeResponse is broken. It throws a "Cannot cache without a map id" exception from CachingWebFileSource.cs. As far as I can understand, it seems the IAsyncRequest Request requires the optional parameter string mapId. And the Geocoder.Geocode does not provide the call with this id.

Maybe you can use this information for something useful, just wanted to throw these things out there. :)

Alexphauge avatar Aug 11 '17 12:08 Alexphauge

@Alexphauge First of all, thanks for the report! Second, we will definitely investigate on our end.

Lastly, what was your upgrade process? Did you remove Mapbox entirely and then add the new SDK via unity package? There are some upgrade instructions here: https://www.mapbox.com/mapbox-unity-sdk/docs/05-changelog.html.

david-rhodes avatar Aug 11 '17 14:08 david-rhodes

Oh, and public static Vector2d LatitudeLongitudeToTileId(float latitude, float longitude, int zoom) is float because float is the highest precision we get back from LocationService in Unity, anyway. Technically, we should fix this, though. 👍

david-rhodes avatar Aug 11 '17 14:08 david-rhodes

@Alexphauge For geocoding, are you using MapboxAccess.Instance.Geocoder? I ask because it sounds like you are using the incorrect IFileSource for your own Geocoder instance.

"Multiple plugins with the same name 'sqlite3' (found at 'Assets/Plugins/x86_64/sqlite3.dll' and 'Assets/Mapbox/Core/Plugins/sqlite/x64/sqlite3.dll').

Interesting. I don't see this. What platform are you on?

david-rhodes avatar Aug 11 '17 15:08 david-rhodes

Yeah, removed Mapbox entirely and then added the new SDK via the unity package from the website.

Ahh, that makes sense then, it just felt weird because everything else that had anything to do with latitude/longitude was in double.

I'm thinking the multiple plugins might be because, well, we have multiple plugins that uses SQLite3.dll, which imports it on their own. It worked deleting one of them, so didn't really occur to me as a big problem. I'm guessing multiple different plugins can use the same SQL plugin. But for arguments sake, I'm developing between iOS and Android.

Correct about the MapboxAccess.Instance.Geocoder, previously we used var geocoder = new Geocoder(MapboxAccess.Instance);. Changing it to the above fixed it, thanks for the tip. :)

Alexphauge avatar Aug 14 '17 07:08 Alexphauge

I see I made a typo in the top comment, I changed it now, but I meant that you probably can't do anything about the SQLite3.dll... As it's a clash between multiple plugins, as written above, having only your instances of the file in the project, works like a charm for us though.

Alexphauge avatar Aug 14 '17 07:08 Alexphauge

It also seems there's a similar error in the VectorTile example under Playground. (The problem with the Geocoder / MapboxAccess)

Edit: Hmm, seems it was just a missing MapId reference in Start in VectorTileExample.cs. I added a _map.MapId = "mapbox.terrain-rgb"; and it worked or well, it compiles and runs. The example itself, does nothing. Not sure what was supposed to happen.

Alexphauge avatar Aug 14 '17 08:08 Alexphauge

@Alexphauge Good point! The MapId for a vector tile (in this case) should be mapbox.mapbox-streets-v7. For this demo, you just search for a place and it will print the raw vector tile GeoJSON.

david-rhodes avatar Aug 14 '17 15:08 david-rhodes

Yep, that got it working! Thanks, I'll close this as I don't have any more to say, well, other than nice work 👍

Alexphauge avatar Aug 15 '17 08:08 Alexphauge

I'll keep this open as a reminder to address some of these issues. :smirk:

david-rhodes avatar Aug 15 '17 14:08 david-rhodes

Heeh, sure 👍

Alexphauge avatar Aug 15 '17 14:08 Alexphauge

Discovered a thing with Android builds.

We have a plugin which contains a AndroidPicker.jar. Because this file contains no '-' characters, the Mapbox/Unity/Editor/Build/Mapbox_Android_prebuild_checks throws an "ArgumentOutOfRangeException: Cannot be negative" in the AndroidLibInfo(string fullPath) method at the BaseFileName line.

Alexphauge avatar Aug 16 '17 08:08 Alexphauge

Discovered a thing with Android builds.

quick fix PR: https://github.com/mapbox/mapbox-unity-sdk/pull/211

wilhelmberg avatar Aug 16 '17 13:08 wilhelmberg

All the things fixed! Now in develop.

david-rhodes avatar Sep 26 '17 20:09 david-rhodes