How to add the custom data to Mapbox in Unity? - unity3d

I want to add the custom data to the Mapbox in Unity.
Unity version: 2020.3.36f1
Scripting Runtime Version: vsCode
Api Compatibility Level: NET4.0
Mapbox SDK version: 2.0.0
The platform I am building to: Android, IOS.
I want to change the colors of the buildings according to the some states of custom data in Mapbox.
However, the custom data is the response from my Api server(NodeJs).
The flow is as like below;
When the scene starts, I send the ids of buildings(Gameobject names in Unity scene) as request parameter to the api server.
The server sends the data of the buildings to Unity.
So, I display the colors of the buildings according to this data in scene.
But, the problem is how to know when the all buildings of the scene are loaded.
Once all buildings are loaded, I can get all names of the buildings.
I used OnUpdated event, but I can't get the names.

I had a similar issue trying to access the terrain elevation data on OnUpdated, but it seems that it is not necessarily available at the time when OnUpdated is dispatched. You would think that when OnUpdated is dispatched, all processes related to the map updating are done, but, apparently, that is not the case.
I solved it in somewhat hacky way by using the OnTileFinished event, which will be dispatched for each loaded tile whenever it is done with it's processing. At least it seems that I can rely on the terrain data (for the given tile) being loaded at that time, so I would guess that the building data (for the given tile) would also be loaded.
It would be nice with some built in event when all tiles are finished, but I haven't been able to find such an event. I initially assumed that the OnUpdated would be such an event - the name sort of suggests it - but it doesn't seem to be so. Maybe it is a bug in the MapBox code - I don't know.
Unfortunately, it seems a bit like MapBox has stopped developing and maintaining the Unity SDK, the latest commit is from February 2020, but maybe they will get back to it at some point.

Related

Symbolise GeoJSON by date ranges using MapBox / CartoDB / Leaflet

I have a GeoJSON file of fly tip incidents that have happened over the last year which is updated regularly.
I am looking for a solution where I can add this data onto a map and symbolise it to show one marker for incidents that have happened over the last month, another for between 1 and 3 months, and a final marker for any incidents from over 3 months ago.
I have thought about using one of MapBox, CartoDB or Leaflet, do these libraries have the capabilities to be able to style data in this way? I want to keep my data locally so do not want to load it into an online account.
I'd like to know if this can be done with one of the above.
Thanks
MapBox and CartoDB services are built onto Leaflet library. You can use them for everything (including uploading your data), or just for the background map. So even with them you can keep your data locally.
Leaflet is the sure choice for total control of your data, as you will be doing all the operations yourself.
Note that you also have other libraries that provide you with the same control with that respect, like OpenLayers, and D3 to some extent.
As for displaying different markers based on age of your data, there is no special difficulty in doing so.

Control of Unity3D web player's camera

Is it possible to control the camera in a Unity3D project being played on the Web player?
I want to control the walk through of existing models using JavaScript in the web player.
I see they have API functions for calling internal functions defined within the script, but don't see any way to gain access to the camera.
By API, I assume you mean the SendMessage approach outlined in the documentation. That is indeed the best way to approach this. Write a script which controls your camera, expose functions you can call, and call those using the
function ControlCamera()
{
u.getUnity().SendMessage("MyCamera", "Control", "");
}
approach.
Other than that, to the best of my knowledge, there is no real exposure of a full API that lets you control GameObjects or components attached to them from JavaScript in the manner you seem to be requesting.

Google Maps native directions iphone MKMapView

Can I to open a MKMapView with directions from multiple places. I do not want to call the google maps api where it will open is a separate window. I want to place info on the stops if possible.
Sure you can.
My suggested starting sequence for achieving this is:
Read up on MKOverlay, MKOverlayPathView and related MapKit classes.
Fetch the directions in a background thread from a provider (eg Google API). This doesn't open in a separate window, you can do it all in background with some API calls. Parse the results into a local model for your stops.
Show your map view, and generate overlays from your directions model data.
You'll add Annotations for your stops, and they will have "callouts" so that the users can view some details about them. I believe there are plenty of examples readily available that demonstrate how to do this.
I hope this very general answer is of some use, perhaps just to let you know that what you want to do is readily achievable, and doesn't require much code.
you can request directions from one of the APIs available (Google,...), parse them and draw them as overlay on your MapView, but I recently stumbled over a commercial framework which saved me a lot of time and hassle:
http://mtdirectionsk.it

Google Analytics Mobile (ipod/iphone) Custom Variables tracking

It's a bit of time I'm using analytics in my iPhone applications and I find it very useful...but apparently it seems to give me only the ability to track pageviews and events.
I just would like to know if there's a way to track even custom variables defined by me, as web analytics does.
I.e. I'm releasing the new version of my app and I would like to define a variable that reports me the version of the application (instead of defining a new action or pageview to track it).
the standard js api to handle that should be: _setCustomVar(index, name, value, opt_scope).
Is there a way to figure it out even on the mobile version of analytics?
A bit late, but yes : custom variables on iOS google analytics library is available since v1.1.
Notice that the setCustomVar() function should come before the trackPageview(). The information is only sent to Google Analytics during a pageview or an event, so keep that in mind when placing the code on your site.
Localytics provides exactly this functionality. For any event in your application, such as a button click or a level completion you may record the event as happening and associate with a Dictionary of keys and values which are reported back as event attributes. For an example and some more details, check out the blog post:
http://www.localytics.com/blog/post/new-feature-explored-event-attributes/

Perform reverse geolocation lookup

I'm pretty new to iPhone SDK and Cocoa development. I'd like to know how to call a web service which will take the lat and long values from my iPhone and feed them to a webservice so I can retrieve the City,State. I already have the phone location stuff squared away. I'm only looking for where I should pass this info to and how I can parse this data back into my app.
Essentially, I only want "City,State" to be visible in a label on one of my views.
The first time I tried this was with geonames.org and it put my returned lat/lng location in the middle of nowhere many many many miles from where I actually was. I tried the same lat/lng values with google maps api and it was in the right place. The only problem I've had is parsing the JSON data back into my app. The returned info seems to have multiple versions of the same info which I can't seem to understand how that works.
So once again. Just looking for a simple HTTP style string I can pass somewhere with my lat/lng values and it returns "City,State". If the example you mention involves parsing data. Please refer to an example I can dissect - I'm a noob.
Oh and one last thing, I know this was made possibly easier with the iPhone 3.0 SDK but I'm currently building this project on 2.2.1 - and for more than enough reason HAVE to do it this way until the rest of the app is ported to 3.0.
Look at the replies here and here