mjk912 / LocusMapTweak

providers.xml for Locus Maps
46 stars 27 forks source link

Ordnance Survey (OS) Maps from Bing #12

Closed jasp78 closed 9 years ago

jasp78 commented 9 years ago

OS Maps no longer displays the OS maps, instead I think the basic 'normal' map from Bing, had a look at the tile source myself but it seems that there is some sort of key code to protect the maps, would require someone with far greater knowledge to take a look at it.

If the Bing source no longer works, an alternative source for OS maps could be: http://www.streetmap.co.uk/

mjk912 commented 9 years ago

Thanks for investigation! Yes, they are using an API key.

streetmap.co.uk uses WMS maps.

Issue left open, maybe someone else finds a way to get it back.

NF53 commented 9 years ago

Probably nothing new - but the current sever for OS maps seems to give an OS map at some zooms and for some areas of the country - completely inconsistent. Why??!! Assume the prevention of download of Bing/OS in the latest versions of Locus is a related, but separate, issue to the one addressed here - that basically the server in 'providers.xml' no longer gives us OS map tiles.

Can't claim to know anything about APIs, but a bit of digging suggests they are far from secure - see: https://social.msdn.microsoft.com/Forums/onedrive/en-US/b7bdfbed-e834-45a9-b271-e63a51c14703/protect-your-bing-maps-api-key?forum=bingmapsajax

Maybe the APIs used to display OS maps online are 'visible'. Do none of the other map servers employ APIs? Hope someone has the skills to understand this ....

NF53 commented 9 years ago

Some more clues from another Android map application: http://support.codesector.com/index.php?/Knowledgebase/Article/View/20/1/OS-Explorer-Maps ... a way of using a trial key for temporary access ..

mjk912 commented 9 years ago

Thanks for the hints! Got it working, though I won't provide my API key in public. Sorry.

Here is the xml file:

<?xml version="1.0" encoding="UTF-8"?>
<providers>
    <provider id="10055" type="5" visible="true" background="-1">
        <name>Bing</name>
        <mode>OS Maps TEST</mode>
        <countries>England</countries>
        <!-- Disclaimer, map doesn't work out of the box!
        You need to get your own API key from:
        http://www.microsoft.com/maps/create-a-bing-maps-key.aspx
        Replace ENTER_YOUR_KEY_HERE with your key
        -->
        <url><![CDATA[http://ak.t3.tiles.virtualearth.net/tiles/r{c}.png?g=3455&lbl=l1&productSet=mmOS&key=ENTER_YOUR_KEY_HERE]]></url>
        <serverPart>0;1;2;3;4</serverPart>
        <zoomPart>25-{z}</zoomPart>
        <zoomMin>8</zoomMin>
        <zoomMax>23</zoomMax>
        <tileSize>256</tileSize>
        <attribution><![CDATA[© 2011 Microsoft | <a href="http://go.microsoft.com/fwlink/?LinkId=74170">Privacy</a> | <a href="http://g.msn.com/0TO_/enww">Legal</a>]]></attribution>
        <extraHeader><![CDATA[Referer#http://www.bing.com/maps/]]></extraHeader>
        <extraHeader><![CDATA[User-Agent#Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1]]></extraHeader>
        <usage>road,city</usage>
    </provider>
</providers>
NF53 commented 9 years ago

Well done! Although I went digging for some clues, I don’t think I could have completed the job without an awful lot of effort….

You may be able to clarify: Can there (only) be ONE providers. xml file – so it is essential to edit-in the stuff you have provided? Do you plan to release a new Zip file soon with this in – it does not seem to be in the current download even though it is dated 5/5/2015.

I find it quite hard to be certain which bits are ‘replaced’ or ‘added’ – some clearer separators in the file would be great in the future.

Thanks again, I will try to get it working here… Regards

NF53 commented 9 years ago

OR ... perhaps you could recommend programs best for editing the xml file .... thanks

mjk912 commented 9 years ago

Locus parses every xml file in the directory "...\Locus\mapsOnline\custom". But avoid using the provider id twice!

Yes, this workaround is not provided in the source code, because it's not working out of the box.

For the diffs, try the different views on GitHub. There's "Blame" and "History", so you see what's new in every update. Red got removed. Green has been added.

For practical reasons, xml editing is done directly in Android Studio: https://developer.android.com/sdk/index.html

A lot of people are using Notepad++ with the xml plugin: http://notepad-plus-plus.org/