SIGPAC spain

Jan 25, 2010 at 1:22 PM

Hi

I'm spanish and my english is not good. I try if

I like use the GMAP control with the data tiles of the follow spain ortofoto service.

this is de url of viewer: http://sigpac.mapa.es/fega/visor/ an this is the info of coordinate system and projection used, I think :-)...

 GEOGCS[\"ED50\","
                                  + "DATUM[\"European Datum 1950\","
                                  + "  SPHEROID[\"International 1924\", 6378388.0, 297.0, AUTHORITY[\"EPSG\",\"7022\"]],"
                                  + "  TOWGS84[-157.89, -17.16, -78.41, 2.118, 2.697, -1.434, -1.1097046576093785],"
                                  + "  AUTHORITY[\"EPSG\",\"6230\"]],"
                                  + "PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]],"
                                  + "UNIT[\"degree\", 0.017453292519943295],"
                                  + "AXIS[\"Geodetic longitude\", EAST],"
                                  + "AXIS[\"Geodetic latitude\", NORTH],"
                                  + "AUTHORITY[\"EPSG\",\"4230\"]]");


PROJCS[\"ED50 / UTM zone 30N\","
                                  + "GEOGCS[\"ED50\","
                                  +     "DATUM[\"European Datum 1950\","
                                  +     "SPHEROID[\"International 1924\", 6378388.0, 297.0, AUTHORITY[\"EPSG\",\"7022\"]],"
                                  +     "TOWGS84[-157.89, -17.16, -78.41, 2.118, 2.697, -1.434, -1.1097046576093785],"
                                  +     "AUTHORITY[\"EPSG\",\"6230\"]],"
                                  +     "PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]],"
                                  +     "UNIT[\"degree\", 0.017453292519943295],"
                                  + "AXIS[\"Geodetic longitude\", EAST],"
                                  + "AXIS[\"Geodetic latitude\", NORTH],"
                                  + "AUTHORITY[\"EPSG\",\"4230\"]],"
                                  + "PROJECTION[\"Transverse Mercator\", AUTHORITY[\"EPSG\",\"9807\"]],"
                                  + "PARAMETER[\"central_meridian\", -3.0],"
                                  + "PARAMETER[\"latitude_of_origin\", 0.0],"
                                  + "PARAMETER[\"scale_factor\", 0.9996],"
                                  + "PARAMETER[\"false_easting\", 500000.0],"
                                  + "PARAMETER[\"false_northing\", 0.0],"
                                  + "UNIT[\"m\", 1.0],"
                                  + "AXIS[\"Easting\", EAST],"
                                  + "AXIS[\"Northing\", NORTH],"
                                  + "AUTHORITY[\"EPSG\",\"23030\"]]");

i changed something in the code. Finally it work but with no precision in map. this is the code i wrote:

in 

internal string MakeImageUrl(MapType type, Point pos, int zoom, PureProjection projection)

case MapType.WMS_SIGPAC:

String key = _makeWmsKeySig(type, pos, zoom, projection);

return key

and _makeWmsKeySig

private string _makeWmsKeySig(MapType type, Point pos, int zoom, PureProjection projection)

{

double X = 0;

double Y = 0;

switch (zoom)

{

default:

return string.Format("http://maps{0}.yimg.com/hx/tl?v={1}&.intl={2}&x={3}&y={4}&z={5}&r=1", ((GetServerNum(pos, 2)) + 1), VersionYahooMap, "es", pos.X, (((1 << zoom) >> 1) - 1 - pos.Y), (zoom + 1));

case 7: // 4096

{

Y = (4182 >> 6) - pos.Y;

X = pos.X - (3902 >> 6);

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_2000_t;z=30;r=1024000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 8: // 4096

{

Y = (4182 >> 5) - pos.Y;

X = pos.X - (3902 >> 5);

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_2000_t;z=30;r=512000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 9: // 4096

{

Y = (4182 >> 4) - pos.Y;

X = pos.X - (3902 >> 4);

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_1250;z=30;r=256000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 10: // 4096

{

Y = (4182 >> 3) - pos.Y;

X = pos.X - (3902 >> 3);

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_1250;z=30;r=128000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 11: // 4096

{

Y = (4182 / 4) - pos.Y;

X = pos.X - (3902 / 4);

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_1250;z=30;r=64000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 12: // 4096

{

Y = (4182 / 2) - pos.Y;

X = pos.X - (3902 / 2);

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_200;z=30;r=32000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 13: // 4096

{

Y = 4182 - pos.Y;

X = pos.X - 3902;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_25;z=30;r=16000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 14: // 2048

{

Y = 4182 * 2 - pos.Y;

X = pos.X - 3902 * 2;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_25;z=30;r=8000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 15:// 1024

{

Y = 4182 * 4 - pos.Y;

X = pos.X - 3902 * 4;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=topografico-mtn_25;z=30;r=4000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 16:// 512

{

Y = 4182 * 8 - pos.Y;

X = pos.X - 3902 * 8;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=ortofotos;z=30;r=2000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 17:// 256

{

Y = 4182 * 16 - pos.Y;

X = pos.X - 3902 * 16;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=ortofotos;z=30;r=1000;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 18:// 128

{

Y = 4182 * 32 - pos.Y;

X = pos.X - 3902 * 32;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=ortofotos;z=30;r=500;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

case 19://64

{

Y = 4182 * 64 - pos.Y;

X = pos.X - 3902 * 64;

return string.Format("http://tilesserver.mapa.es/tilesserver/n=ortofotos;z=30;r=250;i={0};j={1}.jpg", Convert.ToInt32(X), Convert.ToInt32(Y));

}

 }

}

 

Thank

 

Saludos desde España.

Jan 25, 2010 at 4:47 PM

what do you mean 'with no precision' ?

Jan 25, 2010 at 5:18 PM

when i manually fix de tiles (ej.: Y = 4182 * 64 - pos.Y; ) this are drawing not in place they must. the Map es draw correctly but desplaced a bit. And this vary with zoom.

                 Ok                         MAP

zoom 10     x metres                x + 200 metres

zoom 11     x metres                x + 50 metres

and so on

i thing it can be DATUM or.... I dont know I am newbies with GIS.

 

thank

Jan 25, 2010 at 5:36 PM

you mean markers are placed in wrong position?

Jan 26, 2010 at 9:00 AM

Hi Radioman

my app is a track viewer, i ride bike in Buenaventura - Toledo - Spain.

I try to include GMAP as other track viewer. As you can see i have GoogleMap api, google plugin an now GMAP too. 

when the "souce data" is yahoo, google, bing..... the track "from - to" is right but if I switch to SIGPAC "datasource" the track is offset in lat and lng and this offset is not a linear progresion.

From GMAP
From GMAP
From GMAP

From GMAP

 

 

 

 

 

thank

Finedust

Jan 26, 2010 at 11:38 AM

i see, hmm.. what projection class do you use?, it's definitely a customized one

Jan 26, 2010 at 3:31 PM

hi radioman

The projection is Tranverse Mercator

PROJCS["ED50 / UTM zone 30N\","GEOGCS[\"ED50\","DATUM[\"European Datum 1950\","
                                  +     "SPHEROID[\"International 1924\", 6378388.0, 297.0, AUTHORITY[\"EPSG\",\"7022\"]],"
                                  +     "TOWGS84[-157.89, -17.16, -78.41, 2.118, 2.697, -1.434, -1.1097046576093785],"
                                  +
    "AUTHORITY[\"EPSG\",\"6230\"]],"
                                  +     "PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]],"
                                  +     "UNIT[\"degree\", 0.017453292519943295],"
                                  + "AXIS[\"Geodetic longitude\", EAST],"
                                  + "AXIS[\"Geodetic latitude\", NORTH],"
                                  + "AUTHORITY[\"EPSG\",\"4230\"]],"
                                  + "PROJECTION[\"Transverse Mercator\", AUTHORITY[\"EPSG\",\"9807\"]],"

In GMAP I use MercatorProjection but it seem the tiles are in other projection.

it's definitely a customized one

The good news is that i find other "service" or url. This new service work well. Just i want.

this is the fragment code that i wrote.

private string _makeWmsKeySig(MapType type, Point pos, int zoom, PureProjection projection)
    {
      int Y = (2 << zoom - 1) - pos.Y - 1;
      string[] levels = { "0", "1", "2", "3", "4", 
                          "MTNSIGPAC", 
                          "MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN2000", 
                          "MTN200", "MTN200", "MTN200", 
                          "MTN25", "MTN25",
                          "ORTOFOTOS","ORTOFOTOS","ORTOFOTOS","ORTOFOTOS" };
      if (zoom < 5)
      {
        return string.Format("http://maps{0}.yimg.com/hx/tl?v={1}&.intl={2}&x={3}&y={4}&z={5}&r=1", ((GetServerNum(pos, 2)) + 1), VersionYahooMap, "es", pos.X, (((1 << zoom) >> 1) - 1 - pos.Y), (zoom + 1));
      }
      else
      {
        return string.Format("http://sigpac.mapa.es/kmlserver/raster/{0}@3785/{1}.{2}.{3}.img", levels[zoom], zoom, pos.X, Y);
      }
      
    }
thank radioman
Jan 26, 2010 at 5:50 PM

Transverse Mercator, yes it's different, i'll test it right now

Jan 26, 2010 at 6:08 PM

great, the new 'service' use standard mercator