Code Monkey home page Code Monkey logo

Comments (19)

david-rhodes avatar david-rhodes commented on July 20, 2024

@Naphier Thanks for the report! I have an idea what the issue is, but you can help me confirm. In your HTTPRequest class, please log the url. Copy the url and paste it into your web browser. Does the data look complete?

If the data (or url) are incorrect, you will need to check that all of your factories are using a proper MapID. It seems in some circumstances, the MapID does not maintain serialization across projects or is corrupted by Unity version differences.

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

I'm using the MapID from MapboxStudio:

screen shot 2017-05-02 at 4 12 40 pm

screen shot 2017-05-02 at 4 13 36 pm
screen shot 2017-05-02 at 4 14 16 pm

And I'm getting the same issue under the same setup as @Naphier.

screen shot 2017-05-02 at 4 09 58 pm

When debugging the URL, I get:
https://api.mapbox.com:443/v4/ahokinson.8ww3j897/9/157/190.vector.pbf
Where I have excluded the access token.

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

I should note that my map tiles are created, but in trying to use custom POI data, I get these errors.
screen shot 2017-05-02 at 4 26 42 pm
screen shot 2017-05-02 at 4 26 58 pm

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@Naphier @ahokinson When you paste the url into your browser, does it download a .pbf file? When testing https://api.mapbox.com:443/v4/ahokinson.8ww3j897/9/157/190.vector.pbf I get:

{
  "message": "Tile does not exist"
}

When using my access token.

from mapbox-unity-sdk.

Naphier avatar Naphier commented on July 20, 2024

After adding in a Debug.Log message into the HTTPRequest's constructor everything I am able to get the maps. When I use the DriveVisualization (map visualisation) everything seems to be OK. Maybe it's something to do with async and Unity and the Debug.Log message is ensuring the main thread completes a cycle before starting the DoRequest coroutine?

.

My URLS show an image in the browser.

.

So if I have a range of 1,1,1,1 it now works OK. But if I do a range of 10,10,10,10 it will get me the tiles then start throwing index out of range exceptions.


IndexOutOfRangeException: Array index is out of range.
Mapbox.VectorTile.VectorTileReader..ctor (System.Byte[] data, Boolean validate)
Mapbox.VectorTile.VectorTile..ctor (System.Byte[] data, Boolean validate)
Mapbox.Map.VectorTile.ParseTileData (System.Byte[] data) (at Assets/Mapbox/Core/Map/VectorTile.cs:106)
UnityEngine.Debug:LogException(Exception)
Mapbox.Map.VectorTile:ParseTileData(Byte[]) (at Assets/Mapbox/Core/Map/VectorTile.cs:112)
Mapbox.Map.Tile:HandleTileResponse(Response) (at Assets/Mapbox/Core/Map/Tile.cs:155)
Mapbox.Unity.<DoRequest>c__Iterator0:MoveNext() (at Assets/Mapbox/Core/Unity/HTTPRequest.cs:40)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
vectorTile.Error: ParseError    responseData: 20
parameters: Id: 16/18831/24226  MapId: mapbox.mapbox-traffic-v1,mapbox.mapbox-streets-v7  Fs: Mapbox.Unity.FileSource
UnityEngine.Debug:LogFormat(String, Object[])
Mapbox.MeshGeneration.Factories.<CreateMeshes>c__AnonStorey1:<>m__0() (at Assets/Mapbox/Scripts/MeshGeneration/Factories/MeshFactory.cs:89)
Mapbox.Map.Tile:HandleTileResponse(Response) (at Assets/Mapbox/Core/Map/Tile.cs:162)
Mapbox.Unity.<DoRequest>c__Iterator0:MoveNext() (at Assets/Mapbox/Core/Unity/HTTPRequest.cs:40)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

@david-rhodes I do see that now...

Given these factories, do you have any suggestions?

screen shot 2017-05-02 at 4 42 47 pm
screen shot 2017-05-02 at 4 43 22 pm
screen shot 2017-05-02 at 4 43 37 pm
screen shot 2017-05-02 at 4 43 59 pm
screen shot 2017-05-02 at 4 44 18 pm

What I find odd is that using the example dataset works. I uploaded a geojson file to MapBox studio to test with. It looks okay to me, but maybe I've used Studio completely wrong. That's a strong possibility...

screen shot 2017-05-02 at 4 45 42 pm

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@Naphier

My URLS show an image in the browser.

You should not see an image for a vector tile request. Can you post a url without your access token? It doesn't look like you are using a custom tileset, but my best guess is that data is missing for a tile somewhere in that larger range.

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@ahokinson My guess is that your data does not exist for the tiles you are requesting. Have you tried a different region or zoom level?

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

@david-rhodes Trying just now yields the same results with different amounts of ParseErrors. Even if there was no data for a tile, would a ParseError really be expected?

screen shot 2017-05-02 at 4 55 50 pm

Here is everything working with the standard poi_label set from mapbox.mapbox-streets-v7
screen shot 2017-05-02 at 5 00 55 pm

Is there something required of datasets to work with the PoiMesh system?

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@ahokinson

Even if there was no data for a tile, would a ParseError really be expected

Well, I'm not sure that we are handling a case of "tile missing" at this moment. Probably just an oversight on our part. So, if the data (which is not a valid .pbf at this point) cannot be parsed as expected, that's the error you will see.

Is there something required of datasets to work with the PoiMesh system?

No. The root of this problem is that your url requests are not valid. Are you able to share your tileset with me? If you add that tileset to a studio style, does it render as you would expect?

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

Yeah, I definitely agree with you on the first point. I just thought you were implying this might be normal. My mistake.

The data I'm using for experimenting is as follows:
cities.txt

I'm willing to share the tileset, but I'm not sure how. When I attach it to a style, it appears correctly:
screen shot 2017-05-02 at 5 12 47 pm

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@ahokinson Ok, I think I've solved the problem.

I uploaded your data to my own tileset and added it's ID to the mesh factory. When requesting your tile coordinates, I also got "no tile exists." But, when requesting the San Francisco area, for example, I do see POIs being created and the url request is valid (downloads a pbf and everything).

That said, I did have to remove:

            if (!feature.Properties.ContainsKey("name"))
                return;

and

            var tm = go.GetComponent<ILabelVisualizationHelper>();
            tm.Initialize(feature.Properties);

from PoiVisualizer.cs to be compatible with this dataset. The reason is because of an early return since name was not a valid feature in your set.

The ParseError is a generic error, which I just realized is a bug. We actually have more robust error reporting available. But, this occurs when requesting a tile that does not contain any data. I'm assuming our servers do not generate tiles that are not needed (as data does not exist). Therefore, we cannot parse a "null" tile. 😏

Anyway, change your code as above and you should see some POIs.

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

I made the first change, but not the second because I implemented the ILabelVisualizationHelper interface which is actually a very convenient spot to initialize my objects. :)

And sure enough, I can see markers!

screen shot 2017-05-02 at 6 27 51 pm

Thanks for persisting with me on this one! Everything seems to make sense now, but it wouldn't have without your responses. Glad to hear robust error handling will be coming in the future.

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

Awesome! That makes sense--most people don't implement ILabelVisualizationHelper, so that's why I suggested its removal.

We need developers like you to help find bugs and suggest improvements. However, please have patience as we are still in beta.

from mapbox-unity-sdk.

ahokinson avatar ahokinson commented on July 20, 2024

Lol I'm sorry. I don't mean to sound impatient. It's the frustration of being mostly correct, but missing something very small. I absolutely love this sdk and the potential it offers. It could not have been made public at a better time. Thanks for your hard word. Seriously, it's much appreciated!

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

Thanks @ahokinson! Please continue to provide feedback or even contribute with your own improvements! 😄

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@Naphier Did any of the above help you? If not, which tiles specifically are not being created?

from mapbox-unity-sdk.

Naphier avatar Naphier commented on July 20, 2024

After a bit of goofing around I think that my issue was actually an invalid API token. I removed a character from the token to test this out and I'm getting the same parse error as before. So perhaps it wasn't being serialized properly or maybe I made a mistake?!

It does seem to be fixed now and everything's working. Try putting in a bad API key and actually logging the exception from VectorTile.ParseTileData in the existing try-catch and you'll see the "Unkown Tile tag : 15" exception. I think the easiest solution for this is to just verify the token before initiating the tile data requests. But then again, maybe the new method of using the token that you mentioned in #46 will make this less of an issue.

Thanks for the quick support!

from mapbox-unity-sdk.

david-rhodes avatar david-rhodes commented on July 20, 2024

@Naphier Yes, the MapboxAccess editor will validate tokens! Thanks for keeping us posted!

from mapbox-unity-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.