Topic: Window with Map

Hello all:

I am working in Unity and trying to do something.  I am able to get directions from one location to the other. What I want to do is get the route, put it on a map in a sub window with the extents of the map only showing the envelope of the route. Then the user can select to continue by returning to the main map with the route displayed, zoomed to 17 or discard the route altogether.

Is that even possible?

Re: Window with Map

Hello.

Unfortunately, I did not understand your description of the problem.
Try to rephrase this in more detail.
Also, I think in this case some images or video will help me quickly understand what you want to do.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by gwhitch 2021-05-14 14:11:22)

Re: Window with Map

Hello Alex. This is what I am trying to do. Basically a map within a map.

Post's attachments

Attachment icon mock.png 640.74 kb, 60 downloads since 2021-05-14 

Re: Window with Map

You can have multiple instances of the map at the same time, so I don't see a problem with doing that.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by gwhitch 2021-05-14 19:32:29)

Re: Window with Map

Is there an example of how that is done? I am not sure how to implement it. I tried using the steps provided in the pdf documentation file but I haven't been successful.

Re: Window with Map

You make a main map, and a second map on Canvas.
When you search for a route, you show a second map and draw a route on it.
Examples of how to search for routes can be found in the atlas of examples.
The key point when using multiple maps is that you need to use references to the map and its components instead of singletones or static methods.
When you press GO, you draw a route on the main map.

If you have any problems implementing this, please ask specific questions, not something big and abstract.
The more specific your question is, the more accurately I can answer it.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Window with Map

I am struggling with this. On the second Canvas, it takes the whole screen, I'd like to control how much of the screen it takes up.

Something like this:

Post's attachments

Attachment icon maps.PNG 343.24 kb, 54 downloads since 2021-06-02 

Re: Window with Map

Please tell me in detail what you have and how your maps work.
The information that "it takes the whole screen" is not enough to provide any advice.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

9 (edited by gwhitch 2021-06-03 21:32:17)

Re: Window with Map

I created a map as normal and that all works like it should. I added another canvas and added a map as a child to that canvas. The dew map canvas only covers part of the main canvas in the scene. A second canvas containing meta data about the driving directions such as duration, length, segments.... etc, covers the rest of the main canvas so the two canvases(containg the directions and the secondary map) are displayed covering the original map.

Then I attached a script to the map and removed the "DriveToPointByRoute". In the script I added this as a start fucntion
void Start()
    {
map = new OnlineMaps();
       map = new OnlineMaps();
        lat = 29.617432;
        lng = -95.60593;
        map.SetPosition(lng, lat);
        control = new OnlineMapsTileSetControl();
        map.zoom = 10;

}


the result:

Both maps are centered in the same location even though they both have different lat/long values although the zoom values are different. (Original map - 12.5, 2nd Map  - 10)

The canvas with the second map is resized to the same size as the main canvas (original map).  When running in the editor, I can deactivate each map and see the difference in scale as they are sitting directly on top of each other in the scene. The orginal map's canvas is set to cover the entire view of the camera in the scene. The second map is resized to also fill the entire view of the camera. (the same size as the original map's canvas)


The plan:

Ask for an address or place, get directions and display two canvases on top of the original map's canvas. One of the "direction" canvases would basically cover half of the camera's view and contain the map with a route Layer displayed to show the user of the route. The other canvas would cover the other half of the camera's view and would contain the direction meta data. Both canvases would fill the entire camera view. Once the user has seen the route and duration and want to proceed, they would select a button that would deactivate the second map and meta data canvases. This would display the original map zoomed up close to the user's position at the center of the map. The map would then follow user's position on map as they move.

If they do not want to proceed after seeing the route, the user would cancel the route and the two canvases (second map and meta data) would be deactivated and the original map would be centered on the users position at the default scale for the application.

Re: Window with Map

1. OnlineMaps and OnlineMapsTileSetControl classes inherit MonoBehaviour.
You cannot use MonoBehaviour constructors.

2. Before you changed your post, I saw singletons in it.
When you have more than one map, you cannot use singletones, because they will contain a reference to the last instance.

3. Tileset Control, this is not UI element and cannot be used inside the Canvas.
Use UI Image Control, UI Raw Image Control, or see Tileset On UI example scene.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.