This is a migrated thread and some comments may be shown as answers.

Custom Provider with Arcgis map

5 Answers 217 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dipti
Top achievements
Rank 1
Dipti asked on 06 Jan 2012, 11:16 AM
Hi,
I am trying to write a Custom Map provider with a map on Arcgis website as map source. But I am unable to do so. Please see my code below:

namespace ArcGISMap
{
    public class ArcGISServerMapProvider : TiledProvider
    {
        public ArcGISServerMapProvider() :
            base()
        {
            ArcGISServerMapSource source = new ArcGISServerMapSource();
            this.MapSources.Add(source.UniqueId, source);
        }
        public override ISpatialReference SpatialReference
        {
            get
            {
                return new MercatorProjection();
            }
        }
    }
    public class ArcGISServerMapSource : TiledMapSource
    {
        public ArcGISServerMapSource()
            : base(1, 20, 256, 256)
        {
        }
        public override void Initialize()
        {
            this.RaiseIntializeCompleted();
        }
        protected override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
        {
            int zoomLevel = ConvertTileToZoomLevel(tileLevel);
            return new Uri(url);
        }
    }
}

<Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadMap x:Name="RadMap1">
            <telerik:RadMap.Provider>
                <arcgis:ArcGISServerMapProvider></arcgis:ArcGISServerMapProvider>
            </telerik:RadMap.Provider>
        </telerik:RadMap>
</Grid>

The map is not visible at runtime. What am I missing here?

Can you please provide a sample with a custom provider?

Thanks.
~Dipti

5 Answers, 1 is accepted

Sort by
0
Accepted
Giuseppe
Telerik team
answered on 06 Jan 2012, 03:45 PM
Hello Dipti,

We have attached a sample application to get you started with the ArcGIS service setup.

The tiles which can be used in custom provider should be compatible with the DeepZoom concept. The tiles should have the same size for different zoom levels. Also one tile from the previous zoom level should be covered by FOUR tiles from next zoom level. I.e. it should be 1 tile for level 0, 4 tiles for level 1 etc.
Note that ArcGIS rest servise provides only 2 tiles for level 0. So, you can use it to show top half or bottom half of whole map area which is used by RadMap. To show all map tiles for each level you should use the following GetTile implementation:
protected override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
{
    int zoomLevel = ConvertTileToZoomLevel(tileLevel);
 
    if (tilePositionY > Math.Pow(2, zoomLevel - 1) - 1)
    {
        return null;
    }
 
    StringBuilder builder = new StringBuilder();
    builder.AppendFormat("{0}/tile/{1}/{2}/{3}", new object[] { url, zoomLevel - 1, tilePositionY, tilePositionX });
 
    return new Uri(builder.ToString());
}

Then you would probably want to preset the RadMap.Center / ZoomLevel property values so the map imagery looks right by default.


All the best,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dipti
Top achievements
Rank 1
answered on 10 Jan 2012, 12:59 PM
I have an information layer where i color countries according to our sales data. How can we do this using EsriTiledMapProvider?

Previously we used to do the same using shp/dbf files. Now our requirement is to use ARCgis maps. Is this possible.
If not, do ARCgis provide map data in shp/dbf files?

Thanks
~Dipti
0
Andrey
Telerik team
answered on 13 Jan 2012, 08:56 AM
Hi Dipti,

Questions about features of the ArcGIS maps are outside of the scope of the RadMap control. You have to ask ArcGIS about them.

Regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Darrell
Top achievements
Rank 1
answered on 18 Feb 2012, 01:10 AM
I have tried to follow this example and I am wondering if my problem is related to projections. I cannot use Mercator as the source data is for a polar region and Mercator will not give the desired output. The data is based upon Canada Lambert Conformal Conic (http://sdw.enr.gov.nt.ca/ArcGIS/rest/services/GNWT/GNWTBasemapLCC/MapServer). Is it possible at this point to use this data via a  custom provider? Thank you.
0
Andrey
Telerik team
answered on 22 Feb 2012, 12:45 PM
Hi Darrell,

It seelms like it should be possible, but you will need to create a custom projection as well as your custom provider.

Kind regards,
Andrey Murzov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Map
Asked by
Dipti
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Dipti
Top achievements
Rank 1
Andrey
Telerik team
Darrell
Top achievements
Rank 1
Share this question
or