Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Open Street Maps (OSM) Tile Viewer

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-16-2010, 11:02 AM
DieterR's Avatar
Junior Member
 
Join Date: Jun 2007
Location: Germany, 30 km south of Munich
Posts: 21
Lightbulb Open Street Maps (OSM) Tile Viewer

I like to introduce my sample application that solves frequently ask questions like 'how to show the GPS position in a map', 'how to get free of cost maps' and 'how to prepare maps before going outdoor'. My solution is the use of Open Street Maps (OSM). Several kinds of maps are available and are continuously improved by many 1000 people. The scale goes from the whole earth to a single street. OSM are provided under 'Creative Common License' and can be freely used for personnel purpose.

I hope my sample program will inspire you to implement some improvements and provide it also in the B4P forum. Perhaps as new Open Source project? For example: improvements of the graphic, e.g. a nice feature would be a seamless scrolling from one map tile to the next. In the present version only one tile is shown and the change is very 'skippy'.

Short Description: The sample program works by default with the GPS Intermediate Driver. For older devices the item 'AutoGPS' in the .ini file has to be set to 'false', as well COM and Speed has to be adapted. After GPS and Internet connection are established the program downloads the proper Map Tile and shows the GPS position in it. You can zoom in and out by a simple click in the map. Map tiles are automatically stored. Stored tiles will be used next time much faster or when off-line. The tile storage should be in a SD card and may be shared with other programs. If required, change the default path or the Basic URL for the Map source in the .ini file. When GPS is switched off you can select a nearby tile by shift gesture at the map. A numeric menu is available to select Map tiles manually and for understanding how OSM tiles work. The source code includes basic infomations and a link.

Now, I am going to implement the OSM tiles 'App' into my outdoor GPS tool. It is a 10.000 lines of code project that was already grown to a real 'Swiss Army Knife' for mobile navigation. You will find the Freeware by googling to 'KDR GPS Tracker'. By the way, many thanks to the B4P community for a lot of ideas.

Enjoy the 'App'

DieterR
Attached Images
File Type: jpg Screen_Dump.jpg (27.4 KB, 151 views)
Attached Files
File Type: zip OSM_Tiles_V3.zip (75.8 KB, 98 views)
__________________
What would we do if computers don't waste our time ...

Last edited by DieterR : 11-03-2010 at 07:50 PM. Reason: Improved performance of the sample program V3
Reply With Quote
  #2 (permalink)  
Old 05-16-2010, 12:26 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hi Dieter,
Could you please remove from your zip file all dll's.
During loading the sbp file, B4PPC will automaticaly add all the required libraries.
Removing the dll's will avoid that non licenced user get these libraries.

I didn't have a closer look at your program yet, but will do so.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #3 (permalink)  
Old 05-17-2010, 06:49 AM
Basic4ppc Expert
 
Join Date: Jul 2008
Location: Borchen, Germany
Posts: 571
Send a message via Skype™ to corwin42
Awards Showcase
Beta Tester 
Total Awards: 1
Default

If you want to have a tool for batch downloading OSM tiles have a look at my PDA TileManager.
Of course it is written with Basic4PPC. The program has a feature (Menu->MapView) to view the map offline and scroll it around (even with GPS support).

In the last official version (1.1) the MapViewer has some problems on VGA-Devices (dragging the map is slow). I have fixed this some time ago but didn't have time to release a new version. I think I will make some smaller fixups in the next days and then release the source here as a more complex program example. There is only one small problem. Because of object name conflicts I use a modified version of one of agrahams libraries. Will have a look on it how to solve this in another way.
__________________
You like my work and it is useful for you? If you want you can donate me a beer here:
Need a DropBox account and want 500MB additional free space? Use this link to create your account: DropBox
Reply With Quote
  #4 (permalink)  
Old 05-17-2010, 05:40 PM
DieterR's Avatar
Junior Member
 
Join Date: Jun 2007
Location: Germany, 30 km south of Munich
Posts: 21
Default

Hi Markus,
thank you for your response. Your TileManager looks fine. My intention was to provide the necessary know how to enable others in writing their own OSM Apps.

We should point out, that bulk downloading of OSM Tiles is not desired (see OSM Tile usage policy). Tiles should only be downloaded if they are needed.

The idea of my program sample was to get the needed map tiles when I am, for example, on a few days lasting bike (or trike) tour. I like to travel at spontaneously planned routes. For such cases it would not be economically to download all eventually needed map tiles at the required higher zoom levels.

Best regards
Dieter
__________________
What would we do if computers don't waste our time ...
Reply With Quote
  #5 (permalink)  
Old 05-18-2010, 08:20 AM
Basic4ppc Expert
 
Join Date: Jul 2008
Location: Borchen, Germany
Posts: 571
Send a message via Skype™ to corwin42
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by DieterR View Post
We should point out, that bulk downloading of OSM Tiles is not desired (see OSM Tile usage policy). Tiles should only be downloaded if they are needed.
Thanks for the link to this policy. It changed a lot in the last weeks. The part that bulk downloading of zoomlevels 17 and 18 is prohibited is completely new.

The idea of PDA TileManager was mainly to download all tiles along a GPX route so it would be possible to navigate along this route with the help of a map without the need of being online. Normally it downloads only new tiles that are not already cached so I think that overall my program reduces the load on the tile servers.

Quote:
Originally Posted by DieterR View Post
I like to travel at spontaneously planned routes. For such cases it would not be economically to download all eventually needed map tiles at the required higher zoom levels.
I completely agree here. Bulk downloading tiles should be used very carefully.
__________________
You like my work and it is useful for you? If you want you can donate me a beer here:
Need a DropBox account and want 500MB additional free space? Use this link to create your account: DropBox
Reply With Quote
  #6 (permalink)  
Old 06-19-2010, 06:10 AM
Junior Member
 
Join Date: Jul 2008
Posts: 37
Default

Thanks for the app Dieter,

I gave it a run on my Garmin Nuvifone M10 this afternoon. It worked well. (M10 is WVGA)

I do quite a bit of mapping on OSM and it is very useful for me to have up-to-date tiles. There are a few of us in Canberra Australia who like to have the OSM data up to date to within a few days and when mapping in a new suburb it is nice to see if someone else has already beaten me to survey a newly finished road.

I did find that your pointer, on the screen appears to be consistantly about 230 meters almost due north of the correct position when used in Canberra Australia.

Other features that would be useful for OSM mapping would be
1) Track logging - at a consistant rate (down to one point er second)
2) Showing the path taken so far in a bright colour on the screen, so that I don't resurvey a road.
3) Centering the pointer (this may require a few surrounding tiles) but they'll probably be needed at some time anyway.

At a slow driving speed, I don't think that this use of the app would create too much load on the tile server.

Last edited by nm7s9 : 06-19-2010 at 06:27 AM. Reason: typo
Reply With Quote
  #7 (permalink)  
Old 06-20-2010, 01:11 AM
DieterR's Avatar
Junior Member
 
Join Date: Jun 2007
Location: Germany, 30 km south of Munich
Posts: 21
Question

Quote:
I did find that your pointer, on the screen appears to be consistantly about 230 meters almost due north of the correct position when used in Canberra Australia.
Your are right. I simulated Canberra coordinates and was wondering. At home the program works very precisely. When driving on a street, the pointer is always over the street in the map. I belive, there must be a problem with the south hemisphere data. I need some time to analyse it.

Quote:
At a slow driving speed, I don't think that this use of the app would create too much load on the tile server.
I think the server load will also limited by the low download transfer rate when mobile.

Best regards
Dieter
__________________
What would we do if computers don't waste our time ...
Reply With Quote
  #8 (permalink)  
Old 06-20-2010, 10:57 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by DieterR View Post
... e.g. a nice feature would be a seamless scrolling from one map tile to the next. In the present version only one tile is shown and the change is very 'skippy'.
I've recently written a program that I am happy to "throw into the mix". It seamlessly scrolls from one tile to another.

But it isn't dealing with OSM tiles. Years ago I bought a PPC GPS/mapping product called GPSDash. (It seems not to be still under development but is available presumably still as shareware.)

This program comes with a PC program that can split a large bitmap into 256x256 pixel tiles, which it names 0000.mti, 0001.mti, 0002.mti along the top edge and 0100.mti, 0200.mti, and so forth, down the left edge. There is also an index file which records the original pixel size and any geo-referencing coordinates that have been applied, again using this same program.

So my program keeps a 3x3 square of nine of these tiles and loads fresh tiles as needed during scrolling. The scrolling can be done by dragging the stylus or, on a tile-by-tile basis, using scrollbars.

I don't suggest that it is a polished product; I wrote it just for learning purposes, but some of the code might be useful...

Mike.
Attached Files
File Type: zip MapViewer.zip (5.4 KB, 46 views)
Reply With Quote
  #9 (permalink)  
Old 06-23-2010, 08:14 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by DieterR View Post
Now, I am going to implement the OSM tiles 'App' into my outdoor GPS tool. ...
Hi Dieter, you may already have spotted this, but playing with your code (trying to do smooth scroll as discussed) I noticed that the Sub
Code:
Sub LimitY (Y )
    
Return Max(-180.0Min(180.0, Y))
End Sub
does not take into account that latitude can be no greater than 90 degrees at the poles!

Best wishes, Mike.
Reply With Quote
  #10 (permalink)  
Old 09-12-2010, 08:55 AM
DieterR's Avatar
Junior Member
 
Join Date: Jun 2007
Location: Germany, 30 km south of Munich
Posts: 21
Default

Hi Mike,

sorry for my very late answer.
You are right!
I already changed the code. The correct limitation is as following:
Code:
Sub LimitY (Y)
    
Return Max(-85.05Min(85.05,Y))
End Sub
These values are necessary due to the behaviour of the mathematical functions. For more infos, please see the OSM Wiki.

Best regards
DieterR
__________________
What would we do if computers don't waste our time ...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scaled Maps klaus Share Your Creations 46 05-27-2011 12:25 PM
Iwant To Open A Image With Windows Picture And Fax Viewer jothis Questions (Windows Mobile) 1 04-26-2010 02:19 PM
Iwant To Open A Image With Windows Picture And Fax Viewer jothis Questions (Windows Mobile) 1 04-26-2010 02:12 PM
Map/Viewer for open street map schimanski Questions (Windows Mobile) 3 10-21-2009 11:43 AM
Display maps klaus Share Your Creations 4 11-11-2008 05:05 PM


All times are GMT. The time now is 12:34 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0