Add new MapProvider, custom projection

Topics: Feature Requests, General
Aug 29, 2012 at 3:30 PM
Edited Aug 29, 2012 at 3:32 PM

Hi radioman!,

My respect and gratitude for your great job, it's very inspiring and you're helping a lot of people, congrats!

 

I am from Buenos Aires, Argentina, I am working with a new Tile Server(WMS-C) with a "Strange" Projection "Gauss Krugger Buenos Aires (GKBA)". I have looked for it in spatialreference.org

http://spatialreference.org/ref/sr-org/7124/

It uses a totally different coordinate system.

I understand I need to create a new projection and Map Provider, but honestly I get lost along the way. I've tried to create a new one from the existing projections, but no one seems to fit in. 

I just expect a little advice on the projection code, because the tile server is very standard. 

Thank you in advance,

Regards

HN

Aug 29, 2012 at 4:02 PM

thanks! ;}

..you can try use dotSpatial, thats one of the tests when i make custom projection class:

            double x = 25;
            double y = 50;

            //Sets up a array to contain the x and y coordinates
            double[] xy = new double[2];
            xy[0] = x;
            xy[1] = y;

            //An array for the z coordinate
            double[] z = new double[1];
            z[0] = 1;

            Debug.WriteLine("first0: " + xy[0] + "; " + xy[1]);
            Debug.WriteLine("");

            ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
            ProjectionInfo pEnd = new ProjectionInfo("+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=4200000 +y_0=-1300000 +ellps=WGS84 +datum=WGS84 +to_meter=0.03125 +no_defs");
            Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1);

            Debug.WriteLine(" true1: " + (int)xy[0] + "; " + (int)xy[1]);

            var prj = new MapyCZProjection();
            {
               var p2 = prj.WGSToPP(y, x);

               Debug.WriteLine("false1: " + p2[0] + "; " + p2[1]);

               var p3 = prj.PPToWGS(p2[0], p2[1]);

               Reproject.ReprojectPoints(xy, z, pEnd, pStart, 0, 1);

               Debug.WriteLine("");
               Debug.WriteLine(" true2: " + xy[0] + "; " + xy[1]);
               Debug.WriteLine("false2: " + p3[1] + "; " + p3[0]);
            }
            // 134400000],PARAMETER["false_northing",-41600000
         }

Aug 29, 2012 at 4:54 PM

Thanks for your answer

I Am actually using proj4.net, and I am able to convert wsg84 coordinates to GKBA coordinates successfully. (I will have a look at dotSpatial also)

What I don't really know is, Which of the existing projections would you advice to base the new one on?  and which methods do I need to override? 

for example, if I  create a new projection called let's say GKBAProjection, I tried a couple of times to copy the code of an existing one (Mercator, or MapsLT) and override and replace the existing methods and parameters. That is where I got lost, because I miss some parameters and don't know which methods I need to override. That Is totally my fault because I don't really have an extensive knowledge of the code yet, thats why I ask for a little guide from you to get started.

Thanks again

Hernán

Aug 29, 2012 at 4:59 PM

does the server host tiles or you manualy add parameters to generate some area of map image?

Aug 29, 2012 at 5:10 PM

Its a WMS-C Server hosting tiles

http://tiles1.mapa.buenosaires.gob.ar/tilecache/

 

Sorry,  I missed to clarify this before. you may have a look if you wish.

 


Aug 29, 2012 at 5:48 PM

check MapBenderWMSProvider.cs

UrlFormat = "http://mapbender.wheregroup.com/cgi-bin/mapserv?map=/data/umn/osm/osm_basic.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=OSM_Basic&styles=&bbox={0},{1},{2},{3}&width={4}&height={5}&srs=EPSG:4326&format=image/png";

and try replace it with your own server, and try EPSG:4326, if it works, you don't need any reprojection code

http://tiles3.mapa.buenosaires.gob.ar/tilecache/mapabsas_default?LAYERS=mapabsas_default&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A221951&BBOX=108100,100170,111940,104010&WIDTH=256&HEIGHT=256

Aug 29, 2012 at 6:38 PM

RadioMan,

I've tried your move, But I get the same tile in all the tiles shown, I slightly modified the url you sent, to add the parameters, but I get the same

"http://tiles3.mapa.buenosaires.gob.ar/tilecache/mapabsas_default? LAYERS=mapabsas_default&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A221951&BBOX= {0},{1},{2},{3}&WIDTH=(4)&HEIGHT=(5)"

 I've Tried also epsg 4326.

"http://tiles3.mapa.buenosaires.gob.ar/tilecache/mapabsas_default? LAYERS=mapabsas_default&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG:221951&BBOX= {0},{1},{2},{3}&WIDTH=(4)&HEIGHT=(5)"

AND FINALLY

 "http://tiles3.mapa.buenosaires.gob.ar/tilecache/mapabsas_default? LAYERS=mapabsas_default&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A221951&BBOX= {0},{1},{2},{3}&WIDTH=(4)&HEIGHT=(5)"

 

and a Couple more, but nothing happens. I see only one tile, repeated all over the map. Hope not to bother animore after your next answer.

regards

 

 

Aug 29, 2012 at 6:52 PM

..well i'll test it later myself, usualy it helps ;}

Aug 29, 2012 at 10:13 PM

Radioman. I;ve tried a couple of more things but wasnt' successful, so I've started looking at the code (amazing piece of work) and I am trying to figure out how The core creates the Get URL of each tile, because every GET request is getting back the same TILE. 

I don't mean to use more of your time, If you have a chance to review the issue I'd be very greatful,

Anything you need to colaborate in the project just ask!

Thanks !

Regards

Hernán

Aug 30, 2012 at 2:01 PM

Update,

I reviewed the code last night and I realized how it created the url of each tile. I believe the problem is related to xy pixel to coordinate conversion of the projection object. As it is a different coordinate system, every xy displacement returns very near cordinates, so the server returns the same tile for every tile.  I believe I finally need to create a new projection and frompixeltoLatLong and fromtiletoxy methods to address the need of the actual server.

So I am back to my first post ;.). Which projection could I use as base for the new one? how do I convert from pixel to latlng according to the new coordinate system?

Sorry to make the thread so long, I am closer to the solution, whenever you can have a look  I'd be great. 

 Tks!

Aug 30, 2012 at 4:46 PM

..after some testing using mercator projection at zoom 16:

An error occurred: can't find resolution index for 1.968750. Available resolutions are:
[90.0, 50.0, 30.0, 15.0, 7.5, 4.0, 2.0, 1.0, 0.5, 0.20000000000000001] 

I gues default mercator tile grid isn't compatible with this server, it's very close but doesn't match correctly..

Aug 30, 2012 at 5:37 PM

Ohh Yes I believe so, because the projection is different.  That's why I have asked you which one I could inherit from in my first post. 

The parameters from spatialreference.org are :

PROJCS["GKBA",
    GEOGCS["International 1909 (Hayford)",
        DATUM["CAI",
            SPHEROID["intl",6378388,297]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",-34.6297166],
    PARAMETER["central_meridian",-58.4627],
    PARAMETER["scale_factor",0.999998],
    PARAMETER["false_easting",100000],
    PARAMETER["false_northing",100000],
    UNIT["Meter",1]]

 

In the meantime, I've been trying to reproject only the coordinates using dotspatial, as you advised. It seems to convert WGS84 coordinates ok, but the server does not return the asociated tiles. 

I used this function to reproject the coordinates in the URL creation, 
   
    ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
    ProjectionInfo pEnd = new ProjectionInfo();


        

      MapBenderWMSProvider()
      {
          pEnd = ProjectionInfo.FromProj4String("+proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=0.999998 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs");
          

      }

      private string reproject(PointLatLng po1)
      {
         

          //Sets up a array to contain the x and y coordinates
          double[] xy = new double[2];
          xy[0] = po1.Lng;
          xy[1] = po1.Lat;

          //An array for the z coordinate
          double[] z = new double[1];
          z[0] = 1;

        //  Debug.WriteLine("first0: " + xy[0] + "; " + xy[1]);
       //   Debug.WriteLine("");

         

          Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1);
          return ((string) ((int)xy[0] + "; " + (int)xy[1]));
     //     Debug.WriteLine(" reprojected Coords: " + ret);

          
      }

      static readonly string UrlFormat = "http://tiles3.mapa.buenosaires.gob.ar/tilecache/mapabsas_default?LAYERS=mapabsas_default&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:221951&BBOX={0},{1},{2},{3}&WIDTH=(4)&HEIGHT=(5)";
 

 I'll go on trying with a new projection, do you think I could inherit from default mercator projection? Any Idea is welcome, 

I appreciate your help

Regards

HN

Aug 30, 2012 at 6:26 PM

i tried this, but it doesn't work yet:

public class BuenosAiresWMSProvider : GMapProvider
   {
      public static readonly BuenosAiresWMSProvider Instance;

      BuenosAiresWMSProvider()
      {
      }

      static BuenosAiresWMSProvider()
      {
         Instance = new BuenosAiresWMSProvider();
      }

      #region GMapProvider Members

      readonly Guid id = new Guid("E804CEF8-41C6-41B5-BCA7-6EA5348DCFB5");
      public override Guid Id
      {
         get
         {
            return id;
         }
      }

      readonly string name = "BuenosAires, WMS demo";
      public override string Name
      {
         get
         {
            return name;
         }
      }

      GMapProvider[] overlays;
      public override GMapProvider[] Overlays
      {
         get
         {
            if(overlays == null)
            {
               overlays = new GMapProvider[] { this };
            }
            return overlays;
         }
      }

      public override PureProjection Projection
      {
         get
         {
            return GMap.NET.Projections.MercatorProjection.Instance;
         }
      }

      public override PureImage GetTileImage(GPoint pos, int zoom)
      {
         string url = MakeTileImageUrl(pos, zoom, LanguageStr);

         return GetTileImageUsingHttp(url);
      }

      #endregion

      readonly ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
      readonly ProjectionInfo pEnd = new ProjectionInfo("+proj=tmerc +lat_0=-34.629269 +lon_0=-58.4633 +k=0.9999980000000001 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs");

      string MakeTileImageUrl(GPoint pos, int zoom, string language)
      {
         var px1 = Projection.FromTileXYToPixel(pos);
         var px2 = px1;

         px1.Offset(0, Projection.TileSize.Height);
         PointLatLng p1 = Projection.FromPixelToLatLng(px1, zoom);

         px2.Offset(Projection.TileSize.Width, 0);
         PointLatLng p2 = Projection.FromPixelToLatLng(px2, zoom);
         
         double[] xy = new double[4] { p1.Lng, p1.Lat, p2.Lng, p2.Lat };
         double[] z = new double[1] { 1 };  
         Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 2);

         var ret = string.Format(CultureInfo.InvariantCulture, UrlFormat, (int)Math.Floor(xy[0]), (int)Math.Floor(xy[1]), (int)Math.Floor(xy[2]), (int)Math.Floor(xy[3]));

         return ret;
      }

      static readonly string UrlFormat = "http://tiles2.mapa.buenosaires.gob.ar/tilecache/mapabsas_default?LAYERS=mapabsas_default&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A221951&BBOX={0},{1},{2},{3}&WIDTH=256&HEIGHT=256";
   }

Aug 30, 2012 at 7:35 PM

Yeap, the full code of my class looks pretty much like yours. Now I am Creating a new projection with the new parameters to see if I can fix it, but I know only the basics.

I'll let you know

 

Aug 30, 2012 at 8:55 PM

I Created  a new projection based on mercator and changed a couple of known constant values for the values of the new projection.  But it Was not enough.

I got to the same error you reported, and don't understand why.

"An error occurred: can't find resolution index for 1.968750. Available resolutions are: [90.0, 50.0, 30.0, 15.0, 7.5, 4.0, 2.0, 1.0, 0.5, 0.20000000000000001]""

I really don't figure out how to continue. The code of my Projection

namespace GMap.NET.Projections
{
    using System;

    /// <summary>
    /// The GKBA projection
    /// PROJCS["World_GKBA",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["GKBA"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["standard_parallel_1",0],UNIT["Meter",1]]
    /// </summary>
    public class GKBAProjection : PureProjection
    {
        public static readonly GKBAProjection Instance = new GKBAProjection();

        static readonly double MinLatitude = -85.05112878;
        static readonly double MaxLatitude = 85.05112878;
        static readonly double MinLongitude = -180;
        static readonly double MaxLongitude = 180;

        public override RectLatLng Bounds
        {
            get
            {
                return RectLatLng.FromLTRB(MinLongitude, MaxLatitude, MaxLongitude, MinLatitude);
            }
        }

        readonly GSize tileSize = new GSize(256, 256);
        public override GSize TileSize
        {
            get
            {
                return tileSize;
            }
        }

        public override double Axis
        {
            get
            {
                return 6378388;
            }
        }

        public override double Flattening
        {
            get
            {
                return (1.0 / 297);
            }
        }

        public override GPoint FromLatLngToPixel(double lat, double lng, int zoom)
        {
            GPoint ret = GPoint.Empty;

            lat = Clip(lat, MinLatitude, MaxLatitude);
            lng = Clip(lng, MinLongitude, MaxLongitude);

            double x = (lng + 180) / 360;
            double sinLatitude = Math.Sin(lat * Math.PI / 180);
            double y = 0.5 - Math.Log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);

            GSize s = GetTileMatrixSizePixel(zoom);
            long mapSizeX = s.Width;
            long mapSizeY = s.Height;

            ret.X = (long)Clip(x * mapSizeX + 0.5, 0, mapSizeX - 1);
            ret.Y = (long)Clip(y * mapSizeY + 0.5, 0, mapSizeY - 1);

            return ret;
        }

        public override PointLatLng FromPixelToLatLng(long x, long y, int zoom)
        {
            PointLatLng ret = PointLatLng.Empty;

            GSize s = GetTileMatrixSizePixel(zoom);
            double mapSizeX = s.Width;
            double mapSizeY = s.Height;

            double xx = (Clip(x, 0, mapSizeX - 1) / mapSizeX) - 0.5;
            double yy = 0.5 - (Clip(y, 0, mapSizeY - 1) / mapSizeY);

            ret.Lat = 90 - 360 * Math.Atan(Math.Exp(-yy * 2 * Math.PI)) / Math.PI;
            ret.Lng = 360 * xx;

            return ret;
        }

        public override GSize GetTileMatrixMinXY(int zoom)
        {
            return new GSize(0, 0);
        }

        public override GSize GetTileMatrixMaxXY(int zoom)
        {
            long xy = (1 << zoom);
            return new GSize(xy - 1, xy - 1);
        }
    }
}

Thank you very much for your help, if you have the chance to look at it, it would be great.

Any collab you need here just ask!

Aug 31, 2012 at 1:29 PM

Update,

I've Studied the issue, and I played around retrieving tiles manually using and sniffing the browser to see the Get Requests. Finally I understood it's all about sending the right coordinates in the url's BBOX parameter (I know, it must be ovbious to you!). So I need to know the exact projection calculations to be able to retrieve all the tiles without having this trouble, am I right? I am trying to learn the internal mechanism to retrieve tiles of your platform, and the projection calculations is something I don't know much, how to resolve.

I studied the Mercator definition

GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.01745329251994328,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]

and GKBA definition

PROJCS["GKBA",
    GEOGCS["International 1909 (Hayford)",
        DATUM["CAI",
            SPHEROID["intl",6378388,297]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",-34.6297166],
    PARAMETER["central_meridian",-58.4627],
    PARAMETER["scale_factor",0.999998],
    PARAMETER["false_easting",100000],
    PARAMETER["false_northing",100000],
    UNIT["Meter",1]]

and to generate the GKBAProjection I changed the Spheroid parameters, but don't know if i have to dosomething with the PARAMETERs.

I believe I am close to make it but I need a couple of guidelines, If you have any comments will be welcome.

Regards

HN

Aug 31, 2012 at 2:16 PM

current implementation is created for the tile servers, WMS-C isn't very compatible unless you know the exact tile schema, min/max/origin/etc, now we know nothing, actual tiles are hidden behind cache webserver

Sep 3, 2012 at 2:37 PM

Parameter

Default value

http://tiles1.mapa.buenosaires.gob.ar/tilecache/

"This service suppports tiling."

none

<KeywordList> 

Projection

EPSG:4326

<EPSG:221951> (es Correcto?))

Maximal extent

(-180,-90,180,90)

<BoundingBox> 

Number of horizontal and vertical tiles at the maximal extent

none

<ScaleHint> or <DataURL> 

Tile size in pixels

some power of 2

<Layer> attribute fixedWidthfixedHeight 

Minimum scale

none

<ScaleHint> or <DataURL> 

Scale quantization factor

2

<DataURL>

I am querying the above parameters to the people mantaining the server. Do you think we could work this out using them? or you would need any addditional information?

 

Sep 3, 2012 at 2:47 PM

probably, any additional information helps

Sep 3, 2012 at 3:06 PM

which additional info you would need? I don't know what to ask! :) I've got the above parameters from the standard wms-c server specs ...

Sep 3, 2012 at 3:08 PM

so far i don't know anything ;}

Sep 5, 2012 at 5:12 PM

Radioman,

I received feedback from my questions about WMS-C Server, And found out a couple of interesting Things. 

 

1. The actual server projection is is http://spatialreference.org/ref/sr-org/7433/ (slightly different as I sent you Before)

PROJCS["GKBA",
    GEOGCS["International 1909 (Hayford)",
        DATUM["CAI",
            SPHEROID["intl",6378388,297]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",-34.629269],
    PARAMETER["central_meridian",-58.463300],
    PARAMETER["scale_factor",0.999998],
    PARAMETER["false_easting",100000],
    PARAMETER["false_northing",100000],
    UNIT["Meter",1]]

 

2.  WMS-C parameters 

     EXTENT 92000 90500 113500 112000

(Syntax: [minx] [miny] [maxx] [maxy])

 

Would you give it another try, to see if it Frankenstein comes alive? 

Tks!

 

Sep 5, 2012 at 6:10 PM

parameters are the same:

+proj=tmerc +lat_0=-34.629269 +lon_0=-58.4633 +k=0.9999980000000001 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs 

..but now we know the extent, i'll check what can i do with it

Sep 5, 2012 at 6:24 PM

I also ran into the same mistake. The parameters look like the same but are not. check it out.

The First Projection I sent you was 7124  from spatialreference (named "Gauss Krugger Buenos Aires") and proj4 parameters are

"+proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=0.999998 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs");
(http://www.spatialreference.org/ref/sr-org/7124/).

   Now they tell me The server uses projection 7433 (named "Gauss Krugger Buenos Aires Reproyectado") and proj4 parameters are the ones you sent.
(http://www.spatialreference.org/ref/sr-org/7433/)
If you have a closer look, the lat and lon parameters are slightly different. I don't know how much difference does it make. But just to clarify!

Thank you!
Hernán

 

 

Sep 5, 2012 at 6:34 PM

ok

Sep 5, 2012 at 9:42 PM

..finaly managed to get all info i need: http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/

 <?xml version="1.0" encoding="UTF-8" ?> 
- <TileMap version="1.0.0" tilemapservice="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/">
- <!--  Additional data: tms_type is default 
  --> 
  <Title>mapabsas_default</Title> 
  <Abstract /> 
  <SRS>EPSG:221951</SRS> 
  <BoundingBox minx="54340.000000" miny="54090.000000" maxx="172100.000000" maxy="171850.000000" /> 
  <Origin x="54340.000000" y="54090.000000" /> 
  <TileFormat width="256" height="256" mime-type="image/png" extension="png" /> 
- <TileSets>
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/0" units-per-pixel="90.00000000000000000000" order="0" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/1" units-per-pixel="50.00000000000000000000" order="1" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/2" units-per-pixel="30.00000000000000000000" order="2" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/3" units-per-pixel="15.00000000000000000000" order="3" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/4" units-per-pixel="7.50000000000000000000" order="4" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/5" units-per-pixel="4.00000000000000000000" order="5" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/6" units-per-pixel="2.00000000000000000000" order="6" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/7" units-per-pixel="1.00000000000000000000" order="7" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/8" units-per-pixel="0.50000000000000000000" order="8" /> 
  <TileSet href="http://mapa.buenosaires.gob.ar/tilecache/1.0.0/mapabsas_default/9" units-per-pixel="0.20000000000000001110" order="9" /> 
  </TileSets>
  </TileMap>

 

Sep 6, 2012 at 6:22 AM

Ohh man! I am sorry because I have seen that info someday but didn't realize it had all the definitions. I could have sent it to you some days ago.

I'm glad now you have it. 

I must say it: When I saw all your work I suspected it, but now I confirm it: you are one of the Greatests!!

I expect your next post anxiously, I would help but don't know what to do with that info, it's just your magic! 

Thank you

Sep 7, 2012 at 9:53 PM

lucky day! ;}, i've managed to integrate wms-c with your provider:

 

Sep 9, 2012 at 7:03 AM

Ohh That's really nice!

I will give a try and send you my comments...   How would I access it? is it included in latest hot build?

Thank you

Hernán

PS: I would like to contribute in any way with you and this nice project, please remember if there's anything I could help. 

Sep 9, 2012 at 12:40 PM

check http://greatmaps.codeplex.com/SourceControl/network/forks/radioman/BuenosAires

it uses eternal DotSpatial.Projections.dll therefore i don't include it to 'official' build yet, but it works perfectly, cheers ;}

Sep 9, 2012 at 3:54 PM

Ok!,

I'm getting it right now and try it. 

Thanks!

HN

Sep 9, 2012 at 7:25 PM

Radioman,

Great Job! I downloaded fork and run it without trouble. So I went on to integrate into my project.

One Thing I noticed from the demo is that if I change Map server to OpenStreetMap, I have zoom levels restricted (because min and max zoom obvious) But I don't get how and where to set Startup parameters when I change from another projection to Mine. When I change from google to buenosaires into my project  I get errors with zoom levels. I understood I I need to set the view area and min and max zooms before changing the provider, but where and how it is convinient to do it? 

 

Sep 9, 2012 at 7:39 PM

in your provider constructor add MaxZoom = 9; // i forget to add it ;}
..and check demo source for the switching code...

Sep 9, 2012 at 8:44 PM

Hernan

In fact I did! But now When I change from google (and zoom level isn't within the range) I get Error in fromPixelToLatLng method . See:

 

Constructor (I Used 8 instead of 9 because I saw in your demo that level 9 returns error blue tiles"_:

    public class BuenosAiresWMScProvider : GMapProvider
    {
        public static readonly BuenosAiresWMScProvider Instance;

        BuenosAiresWMScProvider()
        {
            InvertedAxisY = true;
           
            
            MinZoom = 0;
            MaxZoom = 8;          
            Area = new RectLatLng(-34.868273846375, 58.7415132012888, -34.3759194331591, -58.148661339112564);

        }

        static BuenosAiresWMScProvider()
        {
            Instance = new BuenosAiresWMScProvider();
...
Sep 9, 2012 at 8:53 PM

you have to adjust the map itselft too... check the demo

Sep 9, 2012 at 10:37 PM
Edited Sep 9, 2012 at 10:39 PM

Sorry to make the thread so long, maybe I should start another one...

I've seen you've adjusted the map at first

 

//MainMap.Manager.Mode = AccessMode.ServerOnly;
            MainMap.Position = new PointLatLng(-34.6114650, -58.4480364);
            MainMap.MapProvider = BuenosAiresWMScProvider.Instance;                     

            // config map         
            //MainMap.MapProvider = GMapProviders.OpenStreetMap;
            //MainMap.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
            MainMap.MinZoom = 0;
            MainMap.MaxZoom = 8;
            MainMap.Zoom = 0;

 

 

But then, In the fork demo, if you try and switch to another map server you cannot zoom too much, because you're not readjusting the map for every projection. 

In The standar demo you don't do that either. Do you You mean I will have to adjust them map JUST for this map server? similar case is lituania or Spain maps, those servers move the viewable area and the map to the area covered by the server, but I still don't figure out where is that done. 

Anyway, thanks again

Sep 9, 2012 at 10:47 PM
Edited Sep 9, 2012 at 10:50 PM

["I got a clue, could it be because  Buenos Aires WMS-C   provider Area property Is null?? I compared to lituania that has the area set.. " ]

My MISTAKE, I have Set The Area Wrong in the constructor, trying again

Sep 10, 2012 at 12:19 PM

switching between different projections is a pain, doesn't work nice always..

Sep 10, 2012 at 2:25 PM

Yeap,

Thanks for clarifying. I've been working on it for several hours and still doesn't seem to work.  I've seen you've added an Invertedaxis flag, maybe a couple of variables stay inverted after projection switch.. I'll keep on trying and keep the thread up to date

Regards