Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - cftt

#1
Here a bsh script from your pseudo code.

It need some adjustments with the definition of origins at each zoom level....
static import java.lang.Math.*;

name = "Michelin2012";
tileType = "png";
tileSize = 256;
minZoom = 2;
maxZoom = 16;
tileUpdate = TileUpdate.IfModifiedSince;
backgroundColor = "#ffffff";
ignoreError = "True";

String urlstring(int zm,int r,int c) {
int[] tile;
int new_zoom=zm-2;
String zs;
switch (new_zoom)    {
case 0  : zs="wot_0180m_r02"   ; break;
case 1  : zs="woc_0090m_r02"   ; break;
case 2  : zs="woc_0045m_r02"   ; break;
case 3  : zs="woc_0024m_r02"   ; break;
case 4  : zs="woc_0012m_r02"   ; break;
case 5  : zs="woc_6000k_r02"   ; break;
case 6  : zs="woc_3000k_r02"   ; break;
case 7  : zs="woc_1500k_r02"   ; break;
case 8  : zs="eur_c_1000k_r05" ; break;
case 9  : zs="fra_c_0275k_r061"; break;
case 10 : zs="fra_c_0185k_r061"; break;
case 11 : zs="eur_c_0060k_r08" ; break;
case 12 : zs="eur_c_0024k_r08" ; break;
case 13 : zs="eur_c_0012k_r08" ; break;
case 14 : zs="eur_c_0006k_r08" ; break;
}
   tile = rc2tile(r,c);
   int tileA = tile[0];
   int tileB = tile[1];
   String tilestring = tiles2string(String.valueOf(tileA),String.valueOf(tileB));
   String mapb64string = Tools.encodeBase64(zs.getBytes( "UTF-8" ));
   String tileb64string = Tools.encodeBase64(tilestring.getBytes( "UTF-8" ));
   return mapb64string + ";"+tileb64string;
}

int[] rc2tile(int r,int c) {
int[] tile2;
int A;
int B;
//javax.swing.JOptionPane.showMessageDialog(null,r+" "+c);
   if ((r==1)&&(c==1)) {
      A = 0;
      B = 0;
   }
   else {
Double r0=(Double)r;
Double c0=(Double)c;
      int r2 = round(r0/2);
      int c2 = round(c0/2);
      tile2 = rc2tile(r2,c2);
      int tile2A = tile2[0];
      int tile2B = tile2[1];
      A = tile2B * 2 + ((r-1) % 2);
      B = tile2A * 2 + ((c-1) % 2);
            // note that the A/B switch above is intentional
   }
   return new int[] {A,B};
}

String tiles2string(String a,String b) {
   String ps="";
   String qs="";
   int p=a.length();
   int q=b.length();
   for(i=0;i<(10-p);p++)
ps=ps+"0";
   for(i=0;i<(10-q);q++)
qs=qs+"0";
   return ps + a + qs + b;
}

String getTileUrl( int zoom, int x, int y ) {
return "http://m10.viamichelin.com/mapsgene/dm/mapdirect;" + urlstring(zoom,x+1,y+1);
}

Try this with MOBAC and MapEvaluator for tweeking...
#2
Hi. Your reverse-engenering is clear. I understand the way the Michelin tiles are created....
But I am unable to write a good algorithm to get the right michelin tile from x, y and zoom level as input.
If you have time to develop it, I would be happy to read your pseudo code for transformation and so I could adapt it as an bsh addon for MOBAC.
Get in touch...
#3
Quote from: "2012"We could now make a simple algorithm that converts back and forth between standard reference systems (x,y or QuadKey) and the "michelin" system.


Hi 2012, good job!

But I can't get the good algorithm to transform x,y and zoom level to the michelin system.

Do you have a script for mobac?

Thx