Topic: How to import map into Online maps?

I'm a novice in Online maps, I've used Arcgis to generate the map, and upload maps to Arcgis server. I can use my browser to open the map URL.
  I want to know how to import my Arcgis map into Unity by Online maps, whether using local map files or online URL?

Re: How to import map into Online maps?

Hello.

Select "Provider - Custom", and specify the URL of the tiles.
Step-by-step instructions on how to find this URL in the documentation (section Styled Google Maps).

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 unity_project 2017-12-29 06:33:05)

Re: How to import map into Online maps?

Thanks for your answer,but my URL is something different from the URL in the documentation, 
here is one of my tail's URL: http://www.cjyhgl.com:6080/arcgis/rest/ … le/0/85/69
In step 7,   "In the «URL» replace «!1iX!2iX!3iX», to «! 1i{zoom}!2i{x}!3i{y}»." should i change my URL by replacing /0/85/69 to!1i{0}!2i{85}!3i{69}
and my URL change to like  ...st/services/huadong/MapServer/tile/!1i{0}!2i{85}!3i{69}?
and in step 8, "Make sure URL ends at «!4e0» (inclusive). If you have characters after this, delete them." , my URL doesn't have !4e0, How should I modify my URL to meet the requirements

Re: How to import map into Online maps?

1. Online Maps has built-in support only for WGS-84 (Ellipsoid Mercator) and WGS-84 WebMercator (Spherical Mercator) projections.
Your tiles use Lambert Conformal Conic.
Theoretically, you can implement your own projection, and use it for the map.
Points of interest:
http://infinity-code.com/doxygen/online … ction.html
http://infinity-code.com/doxygen/online … 1ef1b24402

2. Your tiles have zoom offset = 8.
You can download tiles with a offset only using Online Maps API.
http://infinity-code.com/atlas/online-m … ample.html

Kind Regards,
Infinity Code Team.

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

Re: How to import map into Online maps?

Thanks for your reminder, I can import the tile into unity via URL by changing the map to WGS-84. But I want to know, using "Provider-custom" can only import one tile? What should I do if I want to import multiple tiles?

Re: How to import map into Online maps?

"Provider - Custom" can load multiple tiles.
To do this, you replace in URL the numbers (zoom, tile x, tile y) to tokens ({zoom}, {x}, {y}).
But "Provider - Custom" can not work with zoom offset.

Kind Regards,
Infinity Code Team.

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

7 (edited by unity_project 2018-01-01 13:12:01)

Re: How to import map into Online maps?

Thanks for your answer, i want to import 6 tiles for making up my map. The URL of my tiles are:
http://www.cjyhgl.com:6080/arcgis/rest/ … le/0/23/30, ../0/23/31, ../0/24/30, ../24.31, ../25/30,
../25/31, how do I import 6 tiles by URLs and adjust the position of 6 tiles?

Re: How to import map into Online maps?

Something like:

using System;
using System.Text;
using UnityEngine;

public class HuadongArcGIS:MonoBehaviour
{
    private int zoomOffset = 6;
    private int xOffset = 22;
    private int yOffset = 1;

    private OnlineMaps map;

    private void Start()
    {
        map = OnlineMaps.instance;
        map.OnStartDownloadTile += OnStartDownloadTile;
        if (OnlineMapsCache.instance != null) OnlineMapsCache.instance.OnStartDownloadTile += OnStartDownloadTile;
    }

    private void OnStartDownloadTile(OnlineMapsTile tile)
    {
        int zoom = tile.zoom - zoomOffset;
        if (zoom < 0)
        {
            tile.status = OnlineMapsTileStatus.error;
            return;
        }

        tile.status = OnlineMapsTileStatus.loading;

        StringBuilder builder = new StringBuilder("http://www.cjyhgl.com:6080/arcgis/rest/services/huadong1/MapServer/tile/");
        builder.Append(zoom).Append("/").Append(tile.y - yOffset * (1 << zoom)).Append("/").Append(tile.x - xOffset * (1 << zoom));

        OnlineMapsWWW www = OnlineMapsUtils.GetWWW(builder);
        www.OnComplete += delegate
        {
            if (string.IsNullOrEmpty(www.error))
            {
                Texture2D tileTexture = new Texture2D(256, 256, TextureFormat.ARGB32, map.control.mipmapForTiles);
                tileTexture.LoadImage(www.bytes);
                tileTexture.wrapMode = TextureWrapMode.Clamp;

                if (map.target == OnlineMapsTarget.texture)
                {
                    tile.ApplyTexture(tileTexture);
                    map.buffer.ApplyTile(tile);
                    OnlineMapsUtils.DestroyImmediate(tileTexture);
                }
                else
                {
                    tile.texture = tileTexture;
                    tile.status = OnlineMapsTileStatus.loaded;
                }

                tile.MarkLoaded();
                map.Redraw();
            }
            else
            {
                tile.status = OnlineMapsTileStatus.error;
            }
        };
    }
}

But keep in mind that your tiles do not match WGS84 tiles, and getting the coordinates will not work correctly.

Kind Regards,
Infinity Code Team.

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

Re: How to import map into Online maps?

Can this map be imported by "Provider - Custom" ?
http://www.cjyhgl.com:6080/arcgis/rest/ … /MapServer

Re: How to import map into Online maps?

No, this map can not be used via «Provider - Custom», because it has offsets (zoom, x, y).

As is - this has limited usage via Online Maps API.
This means that getting the coordinates will not work correctly.

To getting the coordinates work correctly, you need to make that your tiles match to WGS84 tiles.
http://www.maptiler.org/google-maps-coo … rojection/

Kind Regards,
Infinity Code Team.

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