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

How to add list of coordinates and display on map as marker

Open cjloh opened this issue 9 years ago • 9 comments

I have a list of coordinates and i wanted to display them on the map as custom marker. Can you give me some advices on it?

Currently, i just use the Conversions.GeoToWorldPosition to place each marker on the map. But its not the best way to do it as some coordinates are very far away from my current position.

cjloh avatar Aug 29 '17 05:08 cjloh

Currently, i just use the Conversions.GeoToWorldPosition to place each marker on the map. But its not the best way to do it as some coordinates are very far away from my current position. @cjloh What kind of problem are you having with that?

brnkhy avatar Aug 29 '17 12:08 brnkhy

@brnkhy for instance, my current location is at new york and i have some coordinates somewhere in malaysia. When i use GeoToWorldPosition on those coordinates, it will have very large value on the GameObject's transform position and unity show below warning on these game objects:

"Due to floating point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range."

cjloh avatar Aug 30 '17 03:08 cjloh

@cjloh Unfortunately this floating point precision issue is a limitation of Unity transforms. You can try to work around this by changing your Unity Tile Size so that you your conversions lead to positions closer to the origin.

We are working on a streaming world implementation, but I am unsure how much it will help with this specific problem.

What zoom level are you working with? Current Unity tile size?

david-rhodes avatar Aug 30 '17 20:08 david-rhodes

EDIT: sorry, posted to wrong issue.


@cjloh some other things for you to try, although I'm not sure if they help in your case.

Change EarthRadius to 6372798.2 here: https://github.com/mapbox/mapbox-unity-sdk/blob/86282c925c823941498939c2ed14151a662be31f/sdkproject/Assets/Mapbox/Unity/Utilities/Conversions.cs#L20

and remove the (float) casts here: https://github.com/mapbox/mapbox-unity-sdk/blob/86282c925c823941498939c2ed14151a662be31f/sdkproject/Assets/Mapbox/Unity/Utilities/Conversions.cs#L269-L270

and here: https://github.com/mapbox/mapbox-unity-sdk/blob/86282c925c823941498939c2ed14151a662be31f/sdkproject/Assets/Mapbox/Unity/Utilities/Conversions.cs#L277

wilhelmberg avatar Aug 31 '17 11:08 wilhelmberg

@cjloh Did the Unity tile size adjustment help?

david-rhodes avatar Sep 13 '17 18:09 david-rhodes

@david-rhodes hey man, currently i am using the method use in the example scene "PoiGeneration" where i put all my coordinates into a GeoJSON file and create a new tileset with it. Then i use VectorTileFactory to display those coordinates on the map like the image below.

mapboxpoi

cjloh avatar Sep 14 '17 06:09 cjloh

Awesome--great idea! Closing now.

david-rhodes avatar Sep 14 '17 17:09 david-rhodes

Hey guys. I just came across this thread as I'm trying to do a similar thing and I need some help to point me in the right direction. I'm using Unity. What I'm trying to do is allow users to place markers on a map as they are walking around. These markers would then appear to other users on the map in the same location.

I believe I'll have to create a separate server to handle the lat and long data and pull that down whenever the user is within a specific radius. Or is this something that mapbox provides through your marker API?

@cjloh - it looks like you have something similar to what I'm trying to achieve. Could you give some clearer process on how you achieved it? That would be awesome. The PoiGeneration example scene doesn't go in to much detail and I can't tell how those markers get added to the map.

Thanks for any help guys :) Martin

cobaltplay avatar Jan 01 '18 21:01 cobaltplay

Hey guys, Can anyone help me how to start the process. I am very new to SDK and i want to achieve the same.. @cjloh @david-rhodes @brnkhy I would be a great help for me. Thanks in advance.

avinash018 avatar Aug 10 '18 11:08 avinash018