Mapsforge @ iOS

830 views
Skip to first unread message

Emux

unread,
Jan 21, 2016, 7:46:24 AM1/21/16
to mapsforge-dev
I know there have been efforts, but how far were they and is there a usable result anywhere?

So instead of resurrecting again the various topics of our forum or check every GitHub Mapsforge named project, I ask our community.

Are you aware (or already using!) a Mapsforge iOS implementation?

--
Emux

Maki

unread,
Jan 21, 2016, 3:24:24 PM1/21/16
to mapsforge-dev
Are you aware (or already using!) a Mapsforge iOS implementation?

I know about http://www.vectorialmap.com that runs on Windows too. But I haven't tried it on iOS.

I know that at least one big name in the iOS world is working on it, but I'm not sure I can disclose more info than that.

Emux

unread,
Jan 21, 2016, 3:35:07 PM1/21/16
to mapsfo...@googlegroups.com
Thanks Maki,

I'm aware of it, but AFAIK that's apps not a library ready to be used by developers.

We have not any action lately in iOS field and I just wondered if anyone has actually made progress with e.g. j2objc translations or other ways that were mentioned already in our forum.

--
Emux

Tobias

unread,
Jan 22, 2016, 3:10:25 AM1/22/16
to mapsforge-dev
I know there's a IOS version of BikeComputer:
http://bikecomputer.roproducts.de/

As with VectorialMap I think it's based on mapsforge 0.3

Here's the project which was discussed here:
https://github.com/Crazy50/MapsForge-ios

And I learned of those recently - a fork of the above:
https://github.com/geolives/MapsForge-ios
And a samples project:
https://github.com/geolives/Mapsforge-Sample-iOS

Best regards,
Tobias

Emux

unread,
Jan 22, 2016, 3:28:53 AM1/22/16
to mapsfo...@googlegroups.com
Thanks Tobias for the info.

--
Emux

Robert Oehler

unread,
Jan 23, 2016, 2:36:16 AM1/23/16
to mapsforge-dev


Am Freitag, 22. Januar 2016 09:10:25 UTC+1 schrieb Tobias:
I know there's a IOS version of BikeComputer:
http://bikecomputer.roproducts.de/


I made kind of a 1-1 translation (besides the drawing part) of Mapsforge 0.3.2 Java code to objective-c about three years ago.
In the beginning I was using java2objc but only for real simple classes as later on you have to get what is going on.
It is not really nice as my objective-c skills were rather basic in these times, but it works without larger issues.
It is however rather slow, only on the latest devices the rendering is becoming satisfying fast.

I wanted to release the code on Github but because of issues with Xcode and its "library" structures I never did, sorry.
If you want I can upload the code, but it would need big substantial changes as Mapsforge changed alot.
Especially the display model part is missing, which gives support for high dpi devices. 

I know of other implementations as
but I never had contact with the author.

Robert Oehler

unread,
Jan 23, 2016, 3:01:40 AM1/23/16
to mapsforge-dev

The translation consists of the "DatabaseRenderer" part and its dependencies which functionality ends up in a tile layer.

This TileLayer is integrated into the https://github.com/Alpstein/route-me framework which manages the creation of tiles (with integrated concurrency), caching, etc.

So a notable amount of the actual Mapsforge is not realized.

Emux

unread,
Jan 23, 2016, 4:29:10 AM1/23/16
to mapsfo...@googlegroups.com
Hi Robert,

(indeed we have changed the API considerably from 0.3 era)

That's interesting implementation. Essentially a combination of Mapsforge map reader / tile renderer with another raster map engine visualizing the results (already tried with Osmdroid).

But do you have satisfactory rendering results?
e.g. not missing elements at tile boundaries or half painted labels / symbols

Because in Mapsforge - if we don't use the LabelLayer technique - we maintain an internal label / symbol cache, so that elements occupying adjacent tiles to appear complete.

Calling Mapsforge renderer to simply produce 'independent' tile bitmaps, cannot exploit that mechanism.

--
Emux

Robert Oehler

unread,
Jan 23, 2016, 5:41:54 AM1/23/16
to mapsforge-dev
Emux,

if you have an iOS device you can just test the rendering. The app is free and you can download map files from inside the app. 

If not, there are some screenshots here.

I do not remember details about the symbols, but I do remember issues on half painted (street) labels. Generally I solved it, but it is still happening here or there.
I think this is due to the general logic of the implementation of "DependencyCache". But I do not remember details.

I discovered I already created a project on Github which was supposed to contain the Mapsforge port. If someone is interested I will add it. 
You may however need to setup you own sample project with it.

Matthew Hall

unread,
Feb 5, 2016, 6:04:29 PM2/5/16
to mapsforge-dev
I haven't put effort into the j2objc iOS version since August of last year. Thanks to Geolives, there's a bit of a Readme and a few bug fixes. I just opened MapsForge site today to see what all has happened and noticed 0.6.0 is out. I had a fork of MapsForge 0.5.1 to add some AutoReleasePool annotations for the J2ObjC transpiler to prevent memory leaks in threads. Here is the commit:
https://github.com/Crazy50/mapsforge/commit/2baa5cd756d9d4a605fdcf68c13bc10c38bf0e81

I could rebase my fork and bring it up to 0.6.0 this weekend. If you're thinking of going the j2objc route, these annotations are necessary to stop memory leaks.

To bring the iOS code up to 0.6.0 will take a bit longer. I usually grab a diff between commits for the Android code and make changes to the iOS code. I'll also need to test for iOS 9 and XCode 7 support. At one time, I was trying to figure out how to get it into a Cocoapod or a Framework to be loaded. The XCodeProject in there should correctly generate a static library file for the various arch types.

When I last stopped, I was trying to figure out what I broke and why all the tiles were just empty.

Martin Crossley

unread,
Mar 27, 2016, 5:59:42 PM3/27/16
to mapsforge-dev
Hi there - well I've fairly recently been working on a 'native' iOS/Swift app to render files in mapsforge binary format. The purpose of this is for fun and learning, but also really to properly understand the format so that I can author and style map content better (I develop and host the free 'CacheMapUK' that is based on UK Ordnance Survey vector mapping data).

I don't need all the functionality of the library, and I want to understand as much as possible about how everything works; so I'm writing the code from the ground up based just on the binary file specification. So far, so good and I now have a good class structure that unpacks all the file headers and tile indexes. A couple of convenience methods to add, then I shall start trying to render a tile or two... I was very interested to read the other post mentioning label positioning and continuity of ways across tile boundaries - it will be good fun working out the best way to handle that.

I don't know whether what I do will be of any relevance to the community, but I'm more than happy to share what I'm doing :)

Emux

unread,
Mar 28, 2016, 3:05:02 AM3/28/16
to mapsfo...@googlegroups.com
Thanks for the info, keep us informed for the progress!

--
Emux

Martin Crossley

unread,
Apr 16, 2016, 6:02:45 AM4/16/16
to mapsforge-dev
Progress update (16 Apr 2016): I can now do a full decode of a mapsforge binary into tiles, POIs and way nodes, coded natively in Swift/iOS (well, OSX actually for testing on a Mac). I'm now working on the best strategy for selecting tiles according to the zoom level and orientation.

Dirk Weltz

unread,
Apr 21, 2016, 3:41:08 AM4/21/16
to mapsforge-dev
Am Donnerstag, 21. Januar 2016 21:24:24 UTC+1 schrieb Maki:
Are you aware (or already using!) a Mapsforge iOS implementation?

I know about http://www.vectorialmap.com that runs on Windows too. But I haven't tried it on iOS.

I tried to contact the author for the last 2 years. Two years ago the author starts to make a library of his project, but than stopped development. It seems, that he dropped the project (even in app store).
 
I know that at least one big name in the iOS world is working on it, but I'm not sure I can disclose more info than that.

It would be great to know, who do this :)

I thought about converting the project to C# to use it with Android (Xamarin), iOS (Xamarin), Windows, Mac (Xamarin). For drawing NGraphics or SkiaSharp could be used. Do you think, this is possible?

Best regards,
Dirk

Mike78

unread,
Apr 28, 2016, 3:06:06 AM4/28/16
to mapsforge-dev
Hi,

I started this days with porting mapsforge to C#/Xamarin. First step would be a nearly 1-1 port of the java-Code to C#. Based on this, it would be possible to enhance the C#-Code to use the optimal features of C#.NET/Xamarin.

Best Regards
Mike

Dirk Weltz

unread,
Apr 28, 2016, 6:54:17 AM4/28/16
to mapsforge-dev
Hi Mike,

nice to hear, but perhaps we could work together.

Up to now I have the following results:
- Core is converted without errors and tests work
- Reader is converted without errors, but not tested
- Map is converted with around 60 errors. Most in PausableThread :(

Cheers,
Dirk

Mike78

unread,
Apr 28, 2016, 7:48:59 AM4/28/16
to mapsforge-dev
Hi Dirk,

nice :-)
Is your source already available in github or similar?
I've already started a (current empty ;-)) project on github.

Cheers 
Mike 

Dirk Weltz

unread,
Apr 28, 2016, 8:44:04 AM4/28/16
to mapsforge-dev
No, I didn't upload my project up to now. It is possible to yours. Or we could ask the Mapsforge team, if it is possible to create one at there account.

Dirk Weltz

unread,
Apr 28, 2016, 9:38:17 AM4/28/16
to mapsforge-dev
Ok, the core and the reader are translated and have 99 passed tests :)

Both are PCL projects. For file IO I use PCLStorage.

Emux

unread,
Apr 28, 2016, 10:40:18 AM4/28/16
to mapsfo...@googlegroups.com
On 28/04/2016 03:44 μμ, Dirk Weltz wrote:
Or we could ask the Mapsforge team, if it is possible to create one at there account.

(after discussion with Ludwig)
We prefer to see a completed project before hosting in Mapsforge official repository.

There have been many attempts until now that ran out of steam, so we must be careful providing the users a workable solution.

Nevertheless we're all interested to see the outcome of this and discuss it again.

--
Emux
Message has been deleted

Dirk Weltz

unread,
Apr 28, 2016, 11:04:53 AM4/28/16
to mapsforge-dev
That's perfect. If the project should run so far, that it is usable, we could do this. In this case, a repository of mapsforge user would the best place.

The first step for me is to have a tile provider. This could be used with different MapViews (Android with Google MapView and iOS with MKMapView).

Mike78

unread,
Apr 30, 2016, 2:56:28 AM4/30/16
to mapsforge-dev
I think perfect, too :-) So I try to go on and convert the java-Code. :-)
Some questions for license: Allows the mapsforge-license to port the code 1:1 to another language/platform and publish this port to the public?
And which license should this port get?

Dirk Weltz

unread,
Apr 30, 2016, 3:24:47 AM4/30/16
to mapsforge-dev
Hi Mike,

do you think it is usefull to convert the code twice? I don't know, how far you are, but I have a totally converted project for C# with setup in VS2015. Core and reader are error free and tests are converted too (error free too). All modules are designed as PCL. I'm now doing the conversion from GraphicFactory to SkiaSharp for drawing, because it's available on all major platforms, it is supported by Xamarin and it is very similar to the Mapsforge approach ;)

If it is ok for you, I could upload the code to GitHub and you could take a look, if it is ok and it is useful for you. Perhaps we could work together. As I already told, my next step is to create a tile provider, which could create any tile from a given map file with a internal or external render theme.

Cheers,
DIrk

Emux

unread,
Apr 30, 2016, 3:44:53 AM4/30/16
to mapsfo...@googlegroups.com
On 30/04/2016 09:56 πμ, Mike78 wrote:
Some questions for license: Allows the mapsforge-license to port the code 1:1 to another language/platform and publish this port to the public?
And which license should this port get?

Mapsforge is licensed under the LGPL3 license.

Any modifications or derivative work (i.e. translate to another language / platform) should be published under the same license.

--
Emux

Emux

unread,
Apr 30, 2016, 3:49:44 AM4/30/16
to mapsfo...@googlegroups.com
I recommend to coordinate somehow and make the work public in a repository.

That way the project can have broad visibility and users can start testing when it reaches a workable state.



On 30/04/2016 10:24 πμ, Dirk Weltz wrote:
it is supported by Xamarin

+1

--
Emux

Mike78

unread,
Apr 30, 2016, 3:59:24 AM4/30/16
to mapsforge-dev
Hi Dirk,

indeed, your port seems to be more far than mine :-). So, if you can upload your code, it would be a point to start with. :-)

Cheers 
Mike

Dirk Weltz

unread,
Apr 30, 2016, 5:27:10 AM4/30/16
to mapsforge-dev
Sorry for the delay. Git is up to now a little bit difficult for me ;). You could find the work in progress now at GitHub.

The most remarkable change I did, was to move the datastore folder from map to core. Only in case you searching it. Thought it would be better at this place :)

Emux

unread,
Apr 30, 2016, 5:37:35 AM4/30/16
to mapsfo...@googlegroups.com
On 30/04/2016 12:27 μμ, Dirk Weltz wrote:
The most remarkable change I did, was to move the datastore folder from map to core. Only in case you searching it. Thought it would be better at this place :)

Core module is to be used in many cases and contains various core classes and utilities.

For example we use it also in POI API, which does not connect directly with Map API.
So I'd vote to keep the map elements together.


BTW I created a new topic about Mapsforge C#, where it could be more suitable to continue the discussion, since C# can cover more platforms.

--
Emux

Marc Walker

unread,
May 4, 2016, 6:19:29 AM5/4/16
to mapsforge-dev
>> Are you aware (or already using!) a Mapsforge iOS implementation?

Hi

I was made first version OSM offline (*.map files) viewer for iOS with my own GDI engine.
Searchable layer: city, town, suburb, village, hamlet (indexed after first map loading).
App wait for Apple review.
Beta review is approved and testers run app without problems.

Regards
Marek


Dirk Weltz

unread,
May 4, 2016, 6:41:30 AM5/4/16
to mapsforge-dev
Hi Marek,

is it possible so say something about language of your project and if it is open source?

Cheers,
Dirk

Marc Walker

unread,
May 4, 2016, 6:59:34 AM5/4/16
to mapsforge-dev
Hi

Currently isn't open source.
UI language is polish (pl-PL) ora english (all others), automatic.

Cheers,
Marek

Dirk Weltz

unread,
May 4, 2016, 7:18:30 AM5/4/16
to mapsforge-dev
Thanks for your fast answer.

The question regarding language was, if you use Swift, Objectiv-C or C# :)

Marc Walker

unread,
May 4, 2016, 7:52:00 AM5/4/16
to mapsforge-dev

:)

Mixed; universal engine for iOS, Android, Win is in C.
UI in this case Obj-C.

Cheers,
Marek

Dirk Weltz

unread,
May 7, 2016, 2:01:19 PM5/7/16
to mapsforge-dev
@Marek: Thanks. Do you use the native MapView from iOS (MKMapKit) or did you made one by your own?
Message has been deleted

Marc Walker

unread,
May 8, 2016, 11:48:50 AM5/8/16
to mapsforge-dev
@Dirk, its made by my own. First version is the same universal C engine on pixel level, like in other platforms. Only different between platforms is bitmap copying to screen buffer.

First release of app now is in store:

I work about it: another menu conception, better graphics, more functionality.
I don't know how with streets search. Streets (ways) indexing is more longer like cities; I think about it.

Cheers,
Marek

Martin Crossley

unread,
May 23, 2016, 7:46:47 AM5/23/16
to mapsforge-dev
OK an update on my native implementation in Swift. At present I'm in fact I'm targeting OSX for ease of development but once everything is good I will switch over to Swift.
Here's a video showing the results of the work so far: https://youtu.be/yx48txBZB94

In summary the progress today (May 2016) is as follows:
  • decoding of the Mapsforge binary map format is now fully working
  • I have a fairly basic capability on the rendering rules (this is good enough for now while I concentrate on the tricky bits)
  • the tile cache is working
  • identification of which tiles are visible is now fully tested and working
  • the viewer app is working for pan, zoom and rotate about arbitrary points on the map
Performance (8GB Mac Mini) seems to be OK so far without having to resort to OpenGL. Still plenty of work to do, but basically it feels like most of the really tricky parts are now in a functional state at least :)





On Thursday, 21 January 2016 12:46:24 UTC, Emux wrote:
I know there have been efforts, but how far were they and is there a usable result anywhere?

So instead of resurrecting again the various topics of our forum or check every GitHub Mapsforge named project, I ask our community.


Are you aware (or already using!) a Mapsforge iOS implementation?

--
Emux

Martin Crossley

unread,
May 23, 2016, 7:59:44 AM5/23/16
to mapsforge-dev
FWIW, just to note that all of this an entirely new implementation of the Mapsforge decoder and the viewer from scratch with no reused code. 
T
he viewer renders the content with Apple CoreGraphics, and does all the rotation, zooming etc. by manipulating of the view's affine transformation matrix.

At present the project is not Open Source but I might change that at some point down the line.

Dirk Weltz

unread,
Jun 2, 2016, 3:18:16 AM6/2/16
to mapsforge-dev

The viewer renders the content with Apple CoreGraphics, and does all the rotation, zooming etc. by manipulating of the view's affine transformation matrix.

If you say, that you do all the zooming with an affine transformation matrix, did this mean, that you create the tiles at highest zoom level and than zoom them in and out?

There aren't any labels on the video. Did you managed to draw them?

Martin Crossley

unread,
Jun 2, 2016, 3:36:27 AM6/2/16
to mapsforge-dev
Hi Dirk -

Well I'm still in the middle of the development, so there is quite a lot of work to do ;-)  I should say that the view is just a snapshot during the work :)

> did this mean, that you create the tiles at highest zoom level and than zoom them in and out?
No... LoL!  I use the affine transformation to change the presentation of the cached tiles for the user when (s)he pans/rotates/zooms by small amounts within a zoom interval. For zoom changes within a zoom interval there are differing numbers of ways and PoI's to show of course, but if you zoom outside the interval then I reload the cache with tiles from the next interval.

There is one more 'trick' by the way, which is that if the time to redraw all the visible tiles is getting too long, I am now use CoreAnimation to cache everything into a bitmap image that I manipulate as a CALayer while the user is actually performing the gesture - then when he stops moving it I hide the layer and redraw the tiles 'properly'. This works quite well but it's a bit complex... I don't think it will finally be needed on the Mac but probably it's going to be valuable on the lower end iOS versions.

> There aren't any labels on the video. Did you managed to draw them?
Heh! not yet - I decode them all of course but I haven't tried rendering them. I am anticipating the potential issues around placement of overlapping labels, which should be 'fun'...

So at the moment I am focussed on improving the handling of the rendering theme - at the moment I used a very simplified syntax, so right now I am working on a parser for the mapsforge theme XML.  However, this is just a spare time project, so I have to fit in 'real' work too :)

Martin

Dirk Weltz

unread,
Jun 2, 2016, 4:25:02 AM6/2/16
to mapsforge-dev
Thanks a lot for your answer.

Martin Crossley

unread,
Jul 17, 2016, 2:52:40 PM7/17/16
to mapsforge-dev
Making continued progress with my native Swift/OSX library and viewer. It took me a long time to work out how I could efficiently handle the rendering for the tiles, so that the ways got drawn in the same order as they appear in the theme. It took me even longer to work out how to pre-cache the results by storing lists of 'pass' and 'fail' tags :). Most recent progress has been to move the tile caching and rendering onto a background thread so that all that heavy lifting doesn't lag the user interface - I just got that working today...  Example video here:  https://www.youtube.com/watch?v=rRyJoRlKR8E

Some time soon I'm really going to have to start looking at text rendering.

MARTIN
Reply all
Reply to author
Forward
0 new messages