Custom Provider with Arcgis map

6 posts, 1 answers
  1. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 06 Jan 2012 Link to this post

    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
  2. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 06 Jan 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 10 Jan 2012 Link to this post

    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
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 13 Jan 2012 Link to this post

    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 >>

  6. Darrell
    Darrell avatar
    1 posts
    Member since:
    Jan 2012

    Posted 17 Feb 2012 Link to this post

    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.
  7. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 22 Feb 2012 Link to this post

    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 >>
Back to Top
DevCraft banner