Author Topic: Via Michelin maps - possible to add to Locus?  (Read 13840 times)

Offline barbudor

  • More than Newbie
  • *
  • Posts: 23
  • Thanked: 1 times
    • View Profile
Re: Via Michelin maps - possible to add to Locus?
« Reply #15 on: December 07, 2013, 13:40:29 »
Hi

I've tried the above BSH script in MoBAC.
While it seems to get tiles down to zoom 10, the position is totally wrong.
For example zooming out from one position move totally out.

As anyone made some progress on this one ?

Regards
 

Offline Frapi

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • Device: Xiaomi redmi note 2
Re: Via Michelin maps - possible to add to Locus?
« Reply #16 on: May 09, 2016, 12:59:10 »
Hi all (well, seems not so many persons interested... anyway).

Very nice job you've done, "2012".

So we are able to identify all ViaMich tiles.
But to use them, we need to geolocalize them.

How can we figure the position of tiles ? Either as Google XYZ or lat/lon ?

--
Frapi
 

Offline TrulloF

  • More than Newbie
  • *
  • Posts: 42
  • Thanked: 5 times
    • View Profile
  • Device: Xperia Z5 Compact, Xperia X Compact (Sailfish X)
Re: Via Michelin maps - possible to add to Locus?
« Reply #17 on: May 11, 2016, 20:27:51 »
Hi.
They changed their tiling scheme some time ago, so you can easily integrate it into Locus.
Just create a new xml file (e. g.  michelin.xml) in the \Locus\mapsOnline\custom\ folder with the following content:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- ViaMichelin maps -->
<providers>
<provider id="80118" type="0" visible="true" background="-1">
      <name>ViaMichelin</name>
      <mode>Michelin</mode>
      <countries>Europe</countries>
      <url><![CDATA[http://map{s}.viamichelin.com/map/mapdirect?map=viamichelin&z={z}&x={x}&y={y}&format=png&version=201503191157&layer=background&locale=default&debug_pattern=.*]]></url>
      <serverPart>1;2;3</serverPart>
      <zoomPart>{z}-8</zoomPart>
      <zoomMin>16</zoomMin>
      <zoomMax>28</zoomMax>
      <tileSize>256</tileSize>
      <attribution><![CDATA[Map data ©Michelin TomTom Natural Earth<a href="http://www.viamichelin.de/">© viamichelin.de</a>]]></attribution>
      <extraHeader><![CDATA[Referer#http://www.viamichelin.de/]]></extraHeader>
      <extraHeader><![CDATA[User-Agent#Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/21]]></extraHeader>
   </provider>
</providers>
 
The following users thanked this post: john_percy, Hexchaintech, LocusUser#1

Offline j3rry

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • Device: Motorola Xoom
Re: Via Michelin maps - possible to add to Locus?
« Reply #18 on: August 29, 2016, 21:34:27 »
Works great, many thanks!

When zooming in on the map on the viamichelin.com website, you might have noticed that around zoomlevel 11 on the bottom right side of the screen appears a clickable 'Michelin map' (and Bibendum head) box.
Clicking that opens another window and you will see or find the 'classic' Michelin map of 1:1.000.000 on the following address (in this example for the Malaga area):

https://www.viamichelin.com/1.85.0/html/michelinmap.html?lat=36.70682496124855&lon=-4.438819885253907&zoom=11&headerLabel=Maps%20%26%20Route%20Planner&apiJsConfigUrl=%2Fapijs%2F1.23.0%2Fapi%2Fjs%3Fkey%3DJSBS20110216111214120400892678%24166489%26lang%3Deng%26protocol%3Dhttps

Is it possible to add this to Locus and if so what would be the map source or .xml file for that map?

Thanks in advance for your kind help and suggestions!

Cheers,

J3rry
« Last Edit: August 30, 2016, 00:46:22 by j3rry »
 

Offline jusc

  • Global Moderator
  • Professor of Locus
  • *****
  • Posts: 1896
  • Thanked: 19 times
    • View Profile
  • Device: Samsung Galaxy S2 and Note 2
Re: Via Michelin maps - possible to add to Locus?
« Reply #19 on: August 31, 2016, 11:50:22 »
@J3rry,

I think it´s not possible.
The tile url looks like
Code: [Select]
https://m11.viamichelin.com/mapsgene/dm/mapdirect;ZXVyX2NfMDAyNGtfcjA4;MDAwMDAwMjQwMTAwMDAwMDE0ODQ=?&protocol=https
Locus can handle only tile servers with a structure like z=? x=? y=? or this in an other order.
Regards J.
 

Offline Nicolas P

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • Device: Samsung
[SOLUTION] Via Michelin maps - possible to add to Locus?
« Reply #20 on: Yesterday at 19:51:55 »
Hello,
Please find below a solution for Mobac
Code: [Select]
// Nom de la carte affiché dans MOBAC
name = "France, cartes papiers Michelin (Rev.081)-Z(10,11,12)-2019";

// Nom du serveur
String MyServer = ".viamichelin.com";
String MyServer_2 = "map.viamichelin.com";

// Key au format "/blabla"
String MyKey = "";

// MyUserAgent correspond à celui créé notemment avec la clé IGN
// Par défaut, on trouve souvent MyUserAgent = "Mozilla/5.0 Gecko/20100101 Firefox/49.0";
String MyUserAgent = "Mozilla/5.0 Gecko/20100101 Firefox/49.0";

// MyReferer peut être demandé
String MyReferer = "";

// MyFolder au format "/blabla"
String MyFolder = "/mapsgene/dm/mapdirect";
String MyFolder_2 = "/map/mapsgene/dm/mapdirect";

tileType = "png"; // Type d’image fourni par le serveur (png, jpg or gif)
tileSize = 256; // Facultatif : Supprimer la ligne dans le doute
minZoom = 2; // Facultatif : Zoom minimal souhaité (et/ou fourni par le serveur)
maxZoom = 19; // Facultatif : Zoom maximal souhaité (et/ou fourni par le serveur) -> Maximum 22 pour Mobac

// Gestion des passages de zooms pour recentrer la carte
Zoom10=0;
Zoom11=0;
Zoom12=0;
CorrectionX=0;
CorrectionY=0;

String getTileUrl(int Zoom, int X, int Y) {
// Autres paramètres spécifiques GetTile
// TileMatrix = Zoom : Le nom de la matrice qui contient la tuile
// TileCol = X : Le numéro de colonne du coin supérieur gauche de la tuile
// TileRow = Y : Le numéro de ligne du coin supérieur gauche de la tuile
if (Zoom < 7) {
Zoom10=0;
Zoom11=0;
Zoom12=0;
// gestion Zoom < 7, on prend une carte générique Google pour voir le monde entier
return "http://mt0.google.com/vt/lyrs=m@176103410&hl=fr&s=Galileo&scale=1&z=" + Zoom + "&x=" + X + "&y=" + Y;
}else if (Zoom < 10){
Zoom10=0;
Zoom11=0;
Zoom12=0;
// url = ""
return "https://" + MyServer_2 + MyFolder_2 + ";" + urlstring(Zoom,X+1,Y+1);
}else if (Zoom < 11){
Num_Server = (X % 3) + 10; // 10 11 12
Zoom11=0;
Zoom12=0;
if (Zoom10==0) {
// X(A,B)->X, A1,A2,B1,B2
// Brest <-> Strasbourg
CorrectionX = EchelleXY(X,499,16,534,37);
// Dunkerque <-> Perpignan
CorrectionY = EchelleXY(Y,343,34,377,55);
Zoom10=1;
}
return "http://m" + Num_Server + MyServer + MyFolder + ";" + urlstring(Zoom,X-CorrectionX,Y-CorrectionY);
}else if (Zoom < 12){
Num_Server = (X % 3) + 10; // 10 11 12
Zoom10=0;
Zoom12=0;
// pour geneve correction X-993,Y-687
if (Zoom11==0) {
// X(A,B)->X, A1,A2,B1,B2
// Brest <-> Strasbourg
CorrectionX = EchelleXY(X,998,14,1067,73);
// Dunkerque <-> Perpignan
CorrectionY = EchelleXY(Y,685,5,754,65);
Zoom11=1;
}
return "http://m" + Num_Server + MyServer + MyFolder + ";" + urlstring(Zoom,X-CorrectionX,Y-CorrectionY);
}else if (Zoom < 13){
Num_Server = (X % 3) + 10; // 10 11 12
Zoom10=0;
Zoom11=0;
// pour geneve correction X-2017,Y-1386
if (Zoom12==0) {
// X(A,B)->X, A1,A2,B1,B2
// Brest <-> Strasbourg
CorrectionX = EchelleXY(X,1996,11,2136,112);
// Dunkerque <-> Perpignan
CorrectionY = EchelleXY(Y,1370,8,1509,112);
Zoom12=1;
}
return "http://m" + Num_Server + MyServer + MyFolder + ";" + urlstring(Zoom,X-CorrectionX,Y-CorrectionY);
}else{
// url = ""
return "https://" + MyServer_2 + MyFolder_2 + ";" + urlstring(Zoom,X+1,Y+1);
}
}

void addHeaders(java.net.HttpURLConnection conn) {
conn.addRequestProperty("Referer",MyReferer);
conn.addRequestProperty("User-Agent",MyUserAgent);
}

//
// Fonction EchelleXY
//
static import java.lang.Math.*;
int EchelleXY(int XY,int a1,int a2,int b1,int b2){
// *0.00001/100000 -> pour convertir avec 5 chiffres significatifs, sinon 0.0
float A = ((b2 - a2)*0.00001/(b1-a1))*100000;
float B = a2 - A * a1;
int corXY = round(A * XY + B);
// javax.swing.JOptionPane.showMessageDialog(null,"XY" +XY+ "#" + (XY-corXY));
return (XY-corXY);
}

//
// Fonction projecion de ViaMichelin
//

import java.util.Base64;

String urlstring(int zm,int My_col,int My_row) {
int[] tile;
int new_zoom=zm;
String zs;
switch (new_zoom) {
case 1   : zs="viamichelin.background@z1" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MQ==
case 2   : zs="viamichelin.background@z2" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6Mg==
case 3   : zs="viamichelin.background@z3" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6Mw==
case 4   : zs="viamichelin.background@z4" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6NA==
case 5   : zs="viamichelin.background@z5" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6NQ==
case 6   : zs="viamichelin.background@z6" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6Ng==
case 7   : zs="viamichelin.background@z7" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6Nw==
case 8   : zs="viamichelin.background@z8" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6OA==
case 9   : zs="viamichelin.background@z9" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6OQ==
case 10  : zs="eur_c_1000k_r05" ; break; //ZXVyX2NfMTAwMGtfcjA1
case 11  : zs="fra_c_0275k_r81" ; break; //ZnJhX2NfMDI3NWtfcjgx
case 12  : zs="fra_c_0185k_r81" ; break; //ZnJhX2NfMDE4NWtfcjgx
case 13  : zs="viamichelin.background@z13" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTM=
case 14  : zs="viamichelin.background@z14" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTQ=
case 15  : zs="viamichelin.background@z15" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTU=
case 16  : zs="viamichelin.background@z16" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTY=
case 17  : zs="viamichelin.background@z17" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTc=
case 18  : zs="viamichelin.background@z18" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTg=
case 19  : zs="viamichelin.background@z19" ; break; //dmlhbWljaGVsaW4uYmFja2dyb3VuZEB6MTk=
}
tile = cr2tile(My_col,My_row);
int tileA = tile[0];
int tileB = tile[1];
switch (new_zoom) {
case 10:

String tilestring = tiles2string(String.valueOf(tileA),String.valueOf(tileB));
//javax.swing.JOptionPane.showMessageDialog(null,tilestring);
break;
case 11:
String tilestring = tiles2string(String.valueOf(tileA),String.valueOf(tileB));
break;
case 12:
String tilestring = tiles2string(String.valueOf(tileA),String.valueOf(tileB));
break;
default:
String tilestring = tiles2string(String.valueOf(tileA),String.valueOf(tileB));
break;
}

// Encode Base64
String mapb64string  = Base64.getEncoder().encodeToString(zs.getBytes("utf-8"));
String tileb64string = Base64.getEncoder().encodeToString(tilestring.getBytes("utf-8"));

return mapb64string + ";"+ tileb64string;
}

int[] cr2tile(int My_col,int My_row) {
// original cell:
// A:B
// child cells:
// 2B:2A    2B+1:2A
// 2B:2A+1 2B+1:2A+1

int[] tile2 = new int[2];
int A;
int B;

if ((My_col==1)&&(My_row==1)) {
A = 0;
B = 0;
}
else {
// transformation en decimal -> (double)
Double col0=(Double)My_col;
Double row0=(Double)My_row;
int col2 = round(col0/2);
int row2 = round(row0/2);
tile2 = cr2tile(col2,row2);
int tile2A = tile2[0];
int tile2B = tile2[1];
A = tile2B * 2 + ((My_col-1) % 2);
B = tile2A * 2 + ((My_row-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;
}


//
// FIN ViaMichelin
//

Note :
the cards are not centered (France Z10 in Norway).
I use two affine functions based on four cities.
Brest <-> Strasbourg for the horizontal and
Dunkerque <-> Perpignan for the vertical
Nicolas