OruxMaps
Visit the new forum: <a href="http://www.oruxmaps.com/foro">OruxMaps</a>

Baidu (chinese) offline maps (MOBAC + OruxMaps tweaks)

Go down

Baidu (chinese) offline maps (MOBAC + OruxMaps tweaks) Empty Baidu (chinese) offline maps (MOBAC + OruxMaps tweaks)

Post  yip on Sat Jan 26, 2013 2:55 am

No, it does not work, sorry.
study Below is some technical tweaks that may be a beginning of something. scratch

It is an attempt to read offline Baidu maps (map.baidu.com) in mobac and oruxmaps.

Status:
-Offline maps, with wrong coordinates
-No positionning possible.
-Not Reliable at all.
-the scale is wrong

Requirement:
-MOBAC > 1.9.8
-Mobac Google-map map sources (or another reliable source)
-Oruxmaps of course Wink

Here is the map source to put in mobac subdirectory mapsources:
create a file named baidu.xml with this contents:
Code:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customMultiLayerMapSource>
    <name>Baidu CN TEST</name>
    <tileType>PNG</tileType>
    <layers>
        <customMapSource>
            <name>Baidu CN source</name>
            <minZoom>1</minZoom>
            <maxZoom>19</maxZoom>
            <tileType>PNG</tileType>
            <tileUpdate>None</tileUpdate>
            <url>http://q{$serverpart}.baidu.com/it/u=x={$x};y={$y};z={$z};v=014;type=web&fm=44</url>
            <invertYCoordinate>true</invertYCoordinate>
            <ignoreErrors>true</ignoreErrors>
            <serverParts>1 2 3 4 5 6 7 8</serverParts>
        </customMapSource>
    </layers>
</customMultiLayerMapSource>

-start Mobac.
-Load the new Baidu CN TEST
-zoom-out to world map, yes it's weird.

Now here is what I do to have slightly better positionning of the Baidu maps:

Easy&Dirty way:
-Make two maps at the same time, one Baidu, one Googlemap, with the same layers and the same visual area.
visual because the Baidu source is not positionned correctly, it is needed to re-make the selection with the false coordinates.

-open the two OruxMap files otrk2.xml side by side and copy&replace all the lines like that in the baidu file (example):
Code:

<MapBounds minLat="36.597889133070225" maxLat="52.48278022207823" minLon="84.375" maxLon="123.75" />
<CalibrationPoints>
<CalibrationPoint corner="TL" lon="84.375000" lat="52.482780" />
<CalibrationPoint corner="BR" lon="123.750000" lat="36.597889" />
<CalibrationPoint corner="TR" lon="123.750000" lat="52.482780" />
<CalibrationPoint corner="BL" lon="84.375000" lat="36.597889" />
</CalibrationPoints>
by their counterpart int the googlemap file. there is one paragraph for each zoomlevel.

That's it. and that's dirty. really dirty.
With this workaround, HongKong can be in place of Shangai.
But without this workaround, HK is in Antarctica. No

Complex&Dirty Way:
To be tested.
in mobac,right-click each layer of Baidu, "zoom to MapBounding box"
With Oruxmaps w/ Googlemaps on your phone in hand, write down the approx coordinates of each corner and their associated zoomlevel. Locate the true coordinates on the phone, not in mobac.
The final precision depends on this tedious step.
( it is also possible to do it by taking screenshots)
edit the XML file above by hand , with the correct coordinates.


If you have any info of the way Baidu Maps works, please feel free to post. I constructed the XML source without much knowledge of the URL parameters. Info on Internet is scarce. If this post help, please drop a note.thx.

yip

Notes
-Baidu zoomlevels are not the same as google ones, ie Baidu zoom 11 is comparable (not equal) to google zoom 10
-Baidu tiles grid does not match Google tiles grid, that's why "zoomToMapBoundingBox" above is necessary
-Lattitude needs to be inverted , that's why China is in Antarctica I think.

yip

Cantidad de envíos : 40
Fecha de inscripción : 2012-01-21

Back to top Go down

Baidu (chinese) offline maps (MOBAC + OruxMaps tweaks) Empty Re: Baidu (chinese) offline maps (MOBAC + OruxMaps tweaks)

Post  yip on Mon Mar 25, 2013 1:44 pm

With Oruxmaps > 2.5.4
Put the following code in onlinemapsources.xml

Code:
     <onlinemapsource uid="88">
      <name>Baidu China</name>
        <!-- GPS positionning is 27.9145N and 20.6175E off -->
        <!-- Distance is wrong -->
      <url><![CDATA[http://q{$s}.baidu.com/it/u=x={$x};y={$y};z={$z};v=015;type=web&fm=44]]></url>
      <minzoom>4</minzoom>
      <maxzoom>19</maxzoom>
      <projection>MERCATORESFERICA</projection>
      <servers>1,2,3,4,5,6,7,8</servers> 
      <httpparam name=""></httpparam>
      <cacheable>1</cacheable>
      <downloadable>1</downloadable>
      <maxtilesday>0</maxtilesday>
      <maxthreads>0</maxthreads>
      <xop>replace($x-(1&lt;&lt;($z-1))-3*(1&lt;&lt;($z-4)),'-','M')</xop>
      <yop>replace((1&lt;&lt;($z-1))-3*(1&lt;&lt;($z-4))-$y-1,'-','M')</yop>
      <zop></zop>
      <qop></qop>
      <sop></sop>
   </onlinemapsource>

Bugs:
-positionning is wrong, but can be corrected with offline maps.
-Distance calculation is wrong and will probably always be No due to zoomlevels being differents

Currently, The map is 3300km in the South-West of where it should be.
That is, a correction of 27.9145E and 20.6175N needs to be applied.

yip

Cantidad de envíos : 40
Fecha de inscripción : 2012-01-21

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum