Can I retrive Lat,Long from Webview of Google Maps Centre Home Example?

BarrySumpter

Active Member
Licensed User
Longtime User
Does anyone have sample VB code for extracting lat, lng from google Centre is Home?
Google Maps API v3

I've had a good look at this example:
//google-developers.appspot.com/maps/documentation/javascript/examples/control-custom-state
https://google-developers.appspot.com/maps/documentation/javascript/examples/control-custom-state

Allows you to centre the map
Then set Home as Centre of the map
move the map to display elsewhere
then your can click Home to return Home.



and read thru the b4a forum posts using google maps examples.

But none seem to do what I'm after.

-----

Since, on my phone, trying to pin point a specific place my touching the map, is hard work my fat fingers, I've found its easier to place a pin point in the middle of my phone screen and move the map behind. To align the position I want to pin point behing the center point.

I've got a server so my bike riding buddies can find me at a new coffee shop or a kick off place. They can log their GPS and I can watch them find me.

But I actually have to be there waiting for them for my app to record its gps.

I'd like to use a pin in the middle of my phone display.
And move the map around behind it.
Positioning the coffee shop address or the kickoff place along the bike path of were we are going to meet in an hour or tomorrow or next saturday.

Then be able to capture that lat, lng and send it my server so they and I can plan our route etc.

That example of google maps html is very close but I can't find a way to extract the lat,lng from it.

Does anyone have a coding example to extract the lat,lng by positioning the map behind a center point on the phone screen in this manner?

As always, I'm happy to chase down any leads and post my solution.

tia
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Google Maps and how to see the coordinates of the center | POI Factory

For those of you who don't have GoogleEarth or any other means to see coordinates it is possible to see them with Google maps as well, only you have to use a little trick.
Here it is. When you enter an address in Google Maps (http://local.google.com) it will center the address for you. You can recenter by double clicking on any point you want. The beauty comes next. Just paste the following into your address bar (Location) of your browser and hit Enter:

javascript:void(prompt('',gApplication.getMap().getCenter()));

And a little window will pop up with the coordinates of the center. Cool, Ha?
Cheers!
ET


You have to use Location (Address) bar of the browser, not the search bar in the page...


I think this post is out of date as I couldn't get it to work.


----
I swear it looks like GOD used JAVA to create our universe.
 
Last edited:
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Place cross hairs transparancy or a centre pin on google maps and be able to touch map behind?

B4X:
<div style='position:absolute;left:0;top:0;'>
Here is some text, blablabla.  It is a long paragraph.
</div>
<img src='http://platinumpaintandbody.homestead.com/gradient_background.jpg' style='position:absolute;left:0;top:0;opacity:0.4;pointer-events:none;
'/>


Can I place this code (translated into v4a) or code like this into a button and retrieve on button_click?
B4X:
var center = map.getCenter(); 
var wrapped = new google.maps.LatLng(center.lat(), center.lng());
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hi Barry.

You can add a Marker to the Map and add an event listener to the Map too.

The event listener would listen for the Map 'center_changed' event and move the Marker so that it's always displayed at the Map center.

Google Maps JavaScript API v3 Example: Custom Controls

B4X:
function initialize() {
  var mapDiv = document.getElementById('map_canvas');
  var myOptions = {
    zoom: 12,
    center: chicago,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(mapDiv, myOptions);

   var marker=new google.maps.Marker({position:myOptions.center, map:map});
   google.maps.event.addListener(map, 'center_changed', function(){
      marker.setPosition(map.getCenter());
   });

  // Create the DIV to hold the control and
  // call the HomeControl() constructor passing
  // in this DIV.
  var homeControlDiv = document.createElement('div');
  var homeControl = new HomeControl(homeControlDiv, map, chicago);

  homeControlDiv.index = 1;
  map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
}

You could then use WebViewExtras library to add a JavascriptInterface to your WebView.

B4X:
Dim WebViewExtras1 As WebViewExtras
WebViewExtras1.addJavascriptInterface(MyWebView, "B4A")

You can now send a javascript statement to your WebView, the javascript would tell the WebView to get the Map center and send the Map center to a Sub in your B4A Activity.

This could be the B4A Sub:

B4X:
Sub ProcessMapCenter(MapCenter As String)
   ' MapCenter will be a String formatted latitude,longitude
   ' (comma separated values)
End Sub

And the javascript statements you'd want to execute:

B4X:
B4A.CallSub('ProcessMapCenter', map.getCenter().toUrlValue())

So in your B4A Activity you'd do something like:

B4X:
Dim Javascript As String
Javascript="B4A.CallSub('ProcessMapCenter', map.getCenter().toUrlValue())"
WebViewExtras1.executeJavascript(MyWebView, Javascript)

Using the Google Maps API in a WebView makes things so tricky - change your device orientation and the WebView reloads to it's initial position.
You can use WebViewExtras to save and restore the Map state but that means even more javascript and B4A Subs.
It's also very slow and inefficient.

You could do exactly as you want with OSMDroid.

You can even use OSMDroid's built in GPS functions to find and display your current location: http://www.b4x.com/forum/basic4andr...-osmdroid-mapview-b4a-tutorial.html#post92653.

OSMDroid handles device orientation change much better than a WebView containing a Google Maps API map, it has pinch to zoom functionality and much more!

Martin.
 
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Hi warwound,
Thanks heaps for all the info.

That is a huge body of work.

I had wanted Google Maps to do all the work for me.
i.e. just add this Divisoin of 5 lines and you're done.

Then use b4a in a tricky way to extract the maps centre lat,lng.

Perhaps, Not as easy as I thought.

Nice: pin point moved to centre of map after map drag. Respect!
Google Maps JavaScript API v3 Example: Custom Controls

I would like that pin point to be static in the middle of the phone screen.
Maybe I'll have to have a graphic control in b4a layout to over lay.


I have to admit I'm not looking forward to researching the ins n outs of orientation change.
I'm hoping v4a designers will find a way to do all this automiticaly without my need code for it.
During my msgbox debugging process I found that when a msgbox was displayed and I changed the orientation the msgbox would disapprear.
BUT if I only allowed portriate then the orientation would not change and the msgbox would stay.
I know its a hack but my work is just for me and my family and friends.
So perhaps your pin snap to centre will suffice. ???



My bad.
I had deduced that code under your hyperlink was for a java module for b4a.
But its an update to the html page. Very Nice!
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
No OSMDroid is not allowed to display Google's map tiles.
That's forbidden by Google's terms and conditions of use.

There's a bit of info about that here: http://www.b4x.com/forum/basic4andr...smdroid-mapview-b4a-tutorial-6.html#post96238

Some of the OSMDroid tile sources are slower than others - it all depends on the speed of the server that's serving the tiles and the current load on that server.

You can download tiles from some tile source providers, save them to your device's external memory and use them as offline maps.
That can speed things up, save bandwidth and allow your app to work without a data connection: http://www.b4x.com/forum/basic4andr...smdroid-mapview-b4a-tutorial-2.html#post92702

OSMDroid also supports using tiles from CloudMade.
You can register for a free Cloudmade account and then have access to Cloudmade tiles - Cloudmade boast that they have fast servers so you might find using Cloudmade to be faster than some or all of the other tile providers.

Cloudmade example here: http://www.b4x.com/forum/basic4andr...smdroid-mapview-b4a-tutorial-2.html#post92864

Martin.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Oh and i forgot to mention that tiles - once downloaded - are cached and reused.

Look on your device's external memory/SD card for a folder named osmdroid, that's where the tiles are cached.

So as you browse an area on the map and return to it you'll find it quicker to display as the cached tiles are used.

Martin.
 
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
If you prefer to discuss this offline please let me know.

When I posted that was a huge body of work, that was a sever understatment.


Not sure about the in n outs of license agreements with maps.
i.e. you can test your apps against GMs with our gmAPIv3 but not sell an app that uses GMs primarily or at all?

For me if I was working as a developer I'd throw together a prototype and show what can be done and let the client paying for the app dev to worry about paying for licensing the map usage.

My apps won't ever be offered commercially.
Been there. Done that. My apps don't sell at all.
I'm pretty much over the fantasy of selling anything at all.

My apps are for personal, family, and frieds use only.
If my apps are ever used at all.

I've done more downloading of maps during testing than will ever be used in real life.

I'm not sure if the Google maps used in the set Center as Home sample are the same as the tiles used and refer to in osmDroid.

I'd still like to test the goodle maps in osmDroid to see the speed.

But would be OK if not
since I've been using gmAPIv3 primarily anyway.

( a lot of sentences about me pressing the fact its a personal app )

----


Ok found this:
OSMDroid also has an add-on class that does much the same with Google's tiles: /trunk/osmdroid-third-party/src/main/java/org/osmdroid/google/overlay/ - osmdroid - OpenStreetMap-Tools for Android - Google Project Hosting.

I think whether or not you still want to use these tile sources is entirely up to you.
If you create an app for your own personal use and add these tile sources you will probably find there is no problem - the number of tiles your app downloads is unlikely to raise the attention of the tile source provider.

BUT if you publish an app with one or more of these tile sources and that app becomes popular then there is a good chance that the tile downloads will attract the attention of the tile source provider who will then come looking for you...

I also recall google maps 5 started chaching its maps and was an incredible boon to those of us who can't afford the rediculous price of data in AUstralia.

But I'm sure its ok for google maps 5 to chache its maps since its the same company as google and google maps, etc.

And now I'm wondering about the maps used in CoPilot and Go?

Can we extract/use the maps cache from gmv5 and CoPilot and Go?
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hi again Barry.

I just started to look at how the Google Maps tiles could be added to OSMDroid - obviously that's without any permission to use those tiles as already explained.

I thought i'd just take a look...

I loaded a Google Maps API map and found the URL to a tile, i copy and pasted that into a new browser window and as expected the tile appeared.

I changed the zoom level in that tile request and got the new requested tile.

I changed the zoom level again and instead of getting the new requested tile got an error message Your client has issued a malformed or illegal request. That’s all we know.!!

Google are actively blocking access to their map tiles from outside of the Google Maps API.

I think when you load a web based Google Map, the Google Maps API does something similar to starting an anthenticated or authorised session.
The web based map gets access to the tiles as the Google tile servers know that the tiles are being requested by a Google map.

Trying to access the tiles from outside of the Google Maps API is therefore a non-starter.
You could try to do so but i bet your OSMDroid map would display one or two tiles maximum and after that all subsequent tile requests would be refused.

CoPilot and Go - they both use the native Android MapView i guess rather than a 3rd party MapView such as OSMDroid.
The official native Android MapView obviously has permission to access Google's tile.

I have tried to make a B4A library with the native Android MapView but failed - take a look here for more info.

Did you look at the offline tiles examples?
You could download all the tiles for your hometown and bundle them with your app.

Or look at creating a free Cloudmade account, get a Cloudmade API key and add Cloudmade tiles to your app.
In theory the Cloudmade tile servers are faster than the Open Street Map servers so should load quicker.

Or of course you can go with the Google Maps API in a WebView but that's very cumbersome...

Martin.
 

Attachments

  • tile_request_error.png
    tile_request_error.png
    33.3 KB · Views: 228
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Hi warwound,

Thanks for the verbose replies.

Been u for about 5 so might not be thinking clearly.

Can you use gmAPIv3 in OSMDroid to make the same type of calls?
Perhaps with a warwound wrapper for the gmAPIv3 wouldn't be so cumbersome.

I joined cloud but lost interest shortly after.
Must have been burnt out with so much research.
I'll have to research more
to see what it takes to get the CloudMade API key into the OSMDroid or my app.
I'm hoping the CoudMade API has heaps of examples as well.

I wonder if storing the offline examples tiles on my server would be faster for the user?

I couldn't get OSMDroid examples after 6 to work on my phone.
Can't recall why now.

The gmAPIv3 is the only one I have working at the moment and is rediculously fast.
With heaps of examples and I just need example script that will pull out the re-centered lat n lng from the HTML script behind the browser.

If I'm thinking clearly that is.

Or HTML script that will store the re-centered lat n lng into a file perhaps?

I'll return after a coffee and a few chores with a clearer head.
 
Last edited:
Upvote 0

lagore

Active Member
Licensed User
Longtime User
Hi,
I use gmAPIv3 in a webview using WebViewExtras and find it works very well and loads quickly. You have may have seen the demo http://gmaps-samples-v3.googlecode.com/svn/trunk/draggable-markers/draggable-markers.html on the google maps API site, it has some of the elements you may be looking for. Also have a look at http://www.b4x.com/forum/basic4android-updates-questions/12573-webview-google-map.html post #8 Klaus once again has a very nice demo app which updates the center Lat/Lon when the map is moved.
 
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Thanks for the reply lagore.

I've seen that b4a demo but didn't notice the Center Lat n Lng.
Pushing too hard from my end I think.

Many thanks.

Oh and thanks for posting the link to the draggable markers.
I felt like my finger were just too fat to locate that marker easily.
May have to see if I can enlarge that marker size.
 
Last edited:
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Hi again Barry.

I just started to look at how the Google Maps tiles could be added to OSMDroid - obviously that's without any permission to use those tiles as already explained.

I thought i'd just take a look...

I loaded a Google Maps API map and found the URL to a tile, i copy and pasted that into a new browser window and as expected the tile appeared.

I changed the zoom level in that tile request and got the new requested tile.

I changed the zoom level again and instead of getting the new requested tile got an error message Your client has issued a malformed or illegal request. That’s all we know.!!

Google are actively blocking access to their map tiles from outside of the Google Maps API.

I think when you load a web based Google Map, the Google Maps API does something similar to starting an anthenticated or authorised session.
The web based map gets access to the tiles as the Google tile servers know that the tiles are being requested by a Google map.

Trying to access the tiles from outside of the Google Maps API is therefore a non-starter.
You could try to do so but i bet your OSMDroid map would display one or two tiles maximum and after that all subsequent tile requests would be refused.

CoPilot and Go - they both use the native Android MapView i guess rather than a 3rd party MapView such as OSMDroid.
The official native Android MapView obviously has permission to access Google's tile.

I have tried to make a B4A library with the native Android MapView but failed - take a look here for more info.

Did you look at the offline tiles examples?
You could download all the tiles for your hometown and bundle them with your app.

Or look at creating a free Cloudmade account, get a Cloudmade API key and add Cloudmade tiles to your app.
In theory the Cloudmade tile servers are faster than the Open Street Map servers so should load quicker.

Or of course you can go with the Google Maps API in a WebView but that's very cumbersome...

Martin.

Hi warwound,

I acknowledge the fact that we don't have permission to use GM tiles or really any other tiles in this fashion.

I've managed to download some GM tiles for my area
just for testing to see what kind of response I can get
executing offline only.

If I could get some instruction on how to implement with OSMDroid I'd be happy to chase it down myself.

tia
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hi Barry.

A lot depends on how you have named the downloaded tiles...

Ideally you will have or can name the tiles according to the Sliipy map file naming conventions.

Each zoom level is a directory, each column is a subdirectory, and each tile in that column is a file
Filename(url) format is /zoom/x/y.png

Look at the attached example_directory_structure.zip.

So you (hopefully) have your downloaded tiles named as required and in a zip archive and need to transfer them to your device's external memory osmdroid folder.

See http://www.b4x.com/forum/basic4andr...smdroid-mapview-b4a-tutorial-2.html#post92702.

You can add the zip archive to your project and transfer it in code when the application is first run or you can connect your device via USB and manually transfer them before first running your application.

Then you can use the custom TileSource example to add the new TileSource to your MapView.

In that example change myxytilesource to whatever you name your downloaded tiles as - in the attached zip file i've named the TileSource as TileSourceName.

And for the URL of the TileSource just use http://localhost/

B4X:
MyXYTileSource.Initialize("your_choosen_tilesource_name", minimum_zoom_level, maximum_zoom_level, 256, ".jpg", "http://localhost/")

In your application you could use the MapView SetDataConnectionEnabled to disable attempts to download tiles when this new TileSource is selected and re-enable when another TileSource is selected.

That will prevent the MapView from wasting CPU cycles trying to get tiles (from localhost) that do not exist in the zip archive if you pan the map to an area that you have not downloaded tiles for.

If you cannot name the tiles as required then you'll need a custom compiled version of the XYTileSource library object to use those tiles.
Not a major task to compile but a lot depends on how the downloaded tiles are named.

Let me know if renaming the downloaded tiles is not possible or practical and also then let me know exactly how the downloaded tiles are named and i'll see what i can do.

Martin.
 
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
My tiles are named:
gm_118348_80442_17.png

17 being the zoom

B4X:
ImageFileName            LeftEdgeLong       RightEdgeLong       TopEdgeLat        BtmEdgeLate       
gm_118348_80442_17.png:   145.0524902       145.0552368         -37.8444948       -37.84666368       
gm_118348_80443_17.png:   145.0524902       145.0552368         -37.84666368      -37.8488325       
gm_118348_80444_17.png:   145.0524902       145.0552368         -37.8488325       -37.85100126
...

I'll either convert the maps into a file structure or convert the code.

It may be easier to check the current lat n lng are between lat n lng reference table above.
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
Do you know if that naming is x_y_zoom.png?

So tile gm_118348_80444_17.png is the tile for zoom level 17 where x is 118348 and y is 80444?

If you're gonna try renaming the files then it's not important, but if a custom compiled XYTileSource is needed then i'd need to know which values correspond to the equivalent x and y values.

Martin.
 
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
My Log File:

the min n max x n y may be a confirmation.
Don't know if the x n y are top left or perhaps middle of a standard sized tile or not.

B4X:
Project: C:\getallmaps\2012 05 07 0900.egmd
Now time is:7/05/2012 8:53:18 AM

[MapsType]
MapsType=0

Left Longitude  input= 145.053847259521
Right Longitude input= 145.077794021606
Top Latitude    input= -37.8456517362268
Bottom Latitude input= -37.8635428548458

MinX = 118348    'this may be what you're looking for to confirm x and y ????
MinY = 80442
MaxX = 118357
MaxY = 80450

Left Longitude  download=145.052490234375
Right Longitude download=145.079956054688
Top Latitude    download=-37.8444947955493
Bottom Latitude download=-37.8640124704472

All images' scope information are saved to C:\getallmaps\2012 05 07 0900_list.txt

Total count of images would be downloaded: 90

Download threads count: 8

Zoom level: 17

path: C:\getallmaps\

Start downloading...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T3:seq=2,gm_118348_80443_17.png OK
T2:seq=1,gm_118348_80442_17.png OK
T1:seq=8,gm_118348_80449_17.png OK
T4:seq=3,gm_118348_80444_17.png OK
T6:seq=5,gm_118348_80446_17.png OK
T5:seq=4,gm_118348_80445_17.png OK
T8:seq=7,gm_118348_80448_17.png OK
T7:seq=6,gm_118348_80447_17.png OK
T3:seq=10,gm_118349_80442_17.png OK
T2:seq=9,gm_118348_80450_17.png OK
T1:seq=16,gm_118349_80448_17.png OK
T4:seq=11,gm_118349_80443_17.png OK
T5:seq=12,gm_118349_80444_17.png OK
T8:seq=15,gm_118349_80447_17.png OK
T6:seq=13,gm_118349_80445_17.png OK
T7:seq=14,gm_118349_80446_17.png OK
T3:seq=18,gm_118349_80450_17.png OK
T2:seq=17,gm_118349_80449_17.png OK
T1:seq=24,gm_118350_80447_17.png OK
T4:seq=19,gm_118350_80442_17.png OK
T5:seq=20,gm_118350_80443_17.png OK
T6:seq=21,gm_118350_80444_17.png OK
T8:seq=23,gm_118350_80446_17.png OK
T7:seq=22,gm_118350_80445_17.png OK
T3:seq=26,gm_118350_80449_17.png OK
T2:seq=25,gm_118350_80448_17.png OK
T1:seq=32,gm_118351_80446_17.png OK
T4:seq=27,gm_118350_80450_17.png OK
T5:seq=28,gm_118351_80442_17.png OK
T6:seq=29,gm_118351_80443_17.png OK
T8:seq=31,gm_118351_80445_17.png OK
T7:seq=30,gm_118351_80444_17.png OK
T2:seq=33,gm_118351_80447_17.png OK
T3:seq=34,gm_118351_80448_17.png OK
T1:seq=40,gm_118352_80445_17.png OK
T5:seq=36,gm_118351_80450_17.png OK
T4:seq=35,gm_118351_80449_17.png OK
T6:seq=37,gm_118352_80442_17.png OK
T8:seq=39,gm_118352_80444_17.png OK
T7:seq=38,gm_118352_80443_17.png OK
T1:seq=48,gm_118353_80444_17.png OK
T3:seq=42,gm_118352_80447_17.png OK
T2:seq=41,gm_118352_80446_17.png OK
T5:seq=44,gm_118352_80449_17.png OK
T4:seq=43,gm_118352_80448_17.png OK
T6:seq=45,gm_118352_80450_17.png OK
T8:seq=47,gm_118353_80443_17.png OK
T7:seq=46,gm_118353_80442_17.png OK
T1:seq=56,gm_118354_80443_17.png OK
T3:seq=50,gm_118353_80446_17.png OK
T2:seq=49,gm_118353_80445_17.png OK
T5:seq=52,gm_118353_80448_17.png OK
T4:seq=51,gm_118353_80447_17.png OK
T6:seq=53,gm_118353_80449_17.png OK
T8:seq=55,gm_118354_80442_17.png OK
T7:seq=54,gm_118353_80450_17.png OK
T3:seq=58,gm_118354_80445_17.png OK
T2:seq=57,gm_118354_80444_17.png OK
T1:seq=64,gm_118355_80442_17.png OK
T4:seq=59,gm_118354_80446_17.png OK
T5:seq=60,gm_118354_80447_17.png OK
T6:seq=61,gm_118354_80448_17.png OK
T8:seq=63,gm_118354_80450_17.png OK
T7:seq=62,gm_118354_80449_17.png OK
T3:seq=66,gm_118355_80444_17.png OK
T2:seq=65,gm_118355_80443_17.png OK
T1:seq=72,gm_118355_80450_17.png OK
T6:seq=69,gm_118355_80447_17.png OK
T4:seq=67,gm_118355_80445_17.png OK
T5:seq=68,gm_118355_80446_17.png OK
T8:seq=71,gm_118355_80449_17.png OK
T3:seq=74,gm_118356_80443_17.png OK
T7:seq=70,gm_118355_80448_17.png OK
T2:seq=73,gm_118356_80442_17.png OK
T6:seq=77,gm_118356_80446_17.png OK
T1:seq=80,gm_118356_80449_17.png OK
T4:seq=75,gm_118356_80444_17.png OK
T8:seq=79,gm_118356_80448_17.png OK
T5:seq=76,gm_118356_80445_17.png OK
T3:seq=82,gm_118357_80442_17.png OK
T7:seq=78,gm_118356_80447_17.png OK
T2:seq=81,gm_118356_80450_17.png OK
T1:seq=88,gm_118357_80448_17.png OK
T4:seq=83,gm_118357_80443_17.png OK
T6:seq=85,gm_118357_80445_17.png OK
T8:seq=87,gm_118357_80447_17.png OK
T5:seq=84,gm_118357_80444_17.png OK
T3:seq=90,gm_118357_80450_17.png OK
T7:seq=86,gm_118357_80446_17.png OK
T1 Finished.
T4 Finished.
T6 Finished.
T8 Finished.
T2:seq=89,gm_118357_80449_17.png OK
T5 Finished.
T3 Finished.
T7 Finished.
T2 Finished.

--------------------------------
Task Stoped!

Now time:7/05/2012 8:53:34 AM

Log file has been saved as C:\getallmaps\2012 05 07 0900_log.txt
Also, 90 tiles were about 900 k bytes
so lets say that 100 tiles is 1 meg
which would averate to about 10 k bytes

1,048,576 kilobytes in a gigabyte
my current mobile data provider charges me $10 per gigabyte

grrrr

Getting old sucks!

I think I want to know how much each tile costs me to download. duh....
Price pr kilobyte * 10 = cost of each tile I think

1000c / 1048576 = 0.00095
0.00095367431640625 * 10 kilobytes = 0.0095c per tile ?
.0095 rounded up to .01c

So really 1c per tile at zoom level 17?
So mobile data costs me $1 for 100 tiles at zoom level 17.
Which is a pretty small area.

Yeah ok. Catching onto the caching reasoning.
Thanks for that.

So like google maps v5 started to cache.
Always cache at home where the price for data download is not so expensive.


Funny how a little sleep (and without hours of reasech clogging the mind)
can bring things into perspective.
 
Last edited:
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
I couldn't get OSMDroid examples after 6 to work on my phone.
Can't recall why now.

Me too, but I discovered there are some missing files in the zip. I don't remember now, maybe in Object/res/drawable. Look at examples before 5 and you'll see what is missing in examples 6 and above. Copy and paste ...
Marco
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Download the attached library files and copy both jar and xml files to your additional libraries folder.

In your map project create a new BarryTileSource instead of a new XYTileSource.

All other code is as in the examples.

Your tiles must now be packed in a zip file as in the other attached file.

It's untested as i don't have any tiles of course, if it fails be sure to post a copy of the unfiltered Log messages.

Martin.
 

Attachments

  • example_gm_tile_archive.zip
    363 bytes · Views: 215
Last edited:
Upvote 0
Top