Map source about mapsforge

402 views
Skip to first unread message

maven apache

unread,
Dec 18, 2013, 8:04:29 PM12/18/13
to mapsfo...@googlegroups.com
Hi:

I am new in mapsforge and I have two questions:

1 Does mapsforge support online map sourece?

We have our own map data(tiles) deployed by OGC, WMTS, I wonder if this is supported. Or may be it can be implement by some extra work.


2 The vector data format

Generally the vector data format is bound to the map rendering

And from the wiki, it seems that mapsforge support the "Mapsforge Binary Map File Format". And "POI" and "Way" are mentioned in the page. 

Then I want to know is it possible to create the Mapsforge Binary Map File from our own vector data(shapfile format), and render them?

In my opinion, we may do this:

1 create the " Mapsforge Binary Map File" according to the "Specification"

2 create the render theme( the map style file)

Is this the right way?

3 The projection

Mapsforge use "MercatorProjection" which tell the tile index for a given position(lat/lng), but I want to know when you generate map tile for a given x,y,level, does the projection is considered?

IMO,  the map data has nothing to do with the projection, different project with the same map data source will generate different map style.

If I am right, then I think we may change the projection at runtime.

Thanks.

emux

unread,
Dec 19, 2013, 2:52:19 AM12/19/13
to mapsfo...@googlegroups.com
Hi,

1) mapsforge supports again online tile providers at its rewrite branch.
You can try specifically Ludwig's rescue branch (its the rewrite with many improvements).
The relevant topic is at:
https://groups.google.com/forum/#!topic/mapsforge-dev/zhI6jMHOEOw
And an example of online provider is at Samples app:
http://code.google.com/r/ludwigbrinckmann-mapsforge/source/browse/Applications/Android/Samples/src/main/java/org/mapsforge/applications/android/samples/DownloadLayerViewer.java?name=rescue
Certainly you can create your own tile source class serving your WMS / TMS server (I use it already with mine).

2) You can create map files from your own vector data.
mapsforge map writer uses osmosis for this process, so you have to use for input what
osmosis can accept (e.g. osm files), converting your own vector files to the proper format.
Pay attention also to your custom tag-mapping.xml file you'll use to map writer.
Then you can create your own render theme.
The process consists of creating 2 files, the vector map file and the its render theme xml file (with its patterns / symbols).
I create often vector maps from own data without much hassle.

3) There is confusion about the fact that even though the map is in Web Mercator (EPSG: 3857) projection,
the actual coordinates used are in lat / long (EPSG: 4326).
i.e. the input osm data you feed to the map writer use EPSG:4326 projection.

Best regards, Emux
https://play.google.com/store/apps/details?id=gr.talent.cruiser

maven apache

unread,
Dec 19, 2013, 4:05:45 AM12/19/13
to mapsfo...@googlegroups.com
Hi emux:

Thanks for your reply.

在 2013年12月19日星期四UTC+8下午3时52分19秒,emux写道:
Hi,

1) mapsforge supports again online tile providers at its rewrite branch.
You can try specifically Ludwig's rescue branch (its the rewrite with many improvements).
The relevant topic is at:
https://groups.google.com/forum/#!topic/mapsforge-dev/zhI6jMHOEOw
And an example of online provider is at Samples app:
http://code.google.com/r/ludwigbrinckmann-mapsforge/source/browse/Applications/Android/Samples/src/main/java/org/mapsforge/applications/android/samples/DownloadLayerViewer.java?name=rescue
Certainly you can create your own tile source class serving your WMS / TMS server (I use it already with mine).


Wonderful, I will have a try.
 
2) You can create map files from your own vector data.
mapsforge map writer uses osmosis for this process, so you have to use for input what
osmosis can accept (e.g. osm files), converting your own vector files to the proper format.
Pay attention also to your custom tag-mapping.xml file you'll use to map writer.
Then you can create your own render theme.
The process consists of creating 2 files, the vector map file and the its render theme xml file (with its patterns / symbols).
I create often vector maps from own data without much hassle.


In fact, our own data have no tags like "way=hightway" or "waterway=river".

However, every feature(point,line,polygon) of our data will have a field named "fid" which is used to distinguish features of different category.

For example, a feature whose fid is 1001 would be a highway, and a 2004 will be a river and etc..

Then, it seems that the  osmosis can not meet my requirement, isn't it?
 
3) There is confusion about the fact that even though the map is in Web Mercator (EPSG: 3857) projection,
the actual coordinates used are in lat / long (EPSG: 4326).
i.e. the input osm data you feed to the map writer use EPSG:4326 projection.

Event the coordinates is "EPSG:4326", there must be a projection when the mapsforge generate a image(tile) isn't it?

Since the mapforge use the "Mercator" to calculate the tile index, so does it mean that the mapsforage will use the "Mecator" to generate the tile. Isn't  it?


 
Best regards, Emux
https://play.google.com/store/apps/details?id=gr.talent.cruiser

On Thursday, December 19, 2013 3:04:29 AM UTC+2, maven apache wrote:
Hi:

I am new in mapsforge and I have two questions:

1 Does mapsforge support online map sourece?

We have our own map data(tiles) deployed by OGC, WMTS, I wonder if this is supported. Or may be it can be implement by some extra work.


2 The vector data format

Generally the vector data format is bound to the map rendering

And from the wiki, it seems that mapsforge support the "Mapsforge Binary Map File Format". And "POI" and "Way" are mentioned in the page. 

Then I want to know is it possible to create the Mapsforge Binary Map File from our own vector data(shapfile format), and render them?

In my opinion, we may do this:

1 create the " Mapsforge Binary Map File" according to the "Specification"

2 create the render theme( the map style file)

Is this the right way?

3 The projection

Mapsforge use "MercatorProjection" which tell the tile index for a given position(lat/lng), but I want to know when you generate map tile for a given x,y,level, does the projection is considered?

IMO,  the map data has nothing to do with the projection, different project with the same map data source will generate different map style.

If I am right, then I think we may change the projection at runtime.

Thanks.

在 2013年12月19日星期四UTC+8下午3时52分19秒,emux写道:
Message has been deleted

emux

unread,
Dec 19, 2013, 4:26:56 AM12/19/13
to mapsfo...@googlegroups.com
In fact, our own data have no tags like "way=hightway" or "waterway=river".

However, every feature(point,line,polygon) of our data will have a field named "fid" which is used to distinguish features of different category.

For example, a feature whose fid is 1001 would be a highway, and a 2004 will be a river and etc..

Then, it seems that the  osmosis can not meet my requirement, isn't it?


I think you're missing a point here.
The original tap-mapping.xml is compatible with original OpenStreetMap data (and their tags).

If you're going to use your own vector data (which probably have their own fields as said)
you have to build a custom tag-mapping.xml using your new custom tags.
And obviously to use these also at your custom render theme.
This is perfectly doable (and osmosis certainly meets this purpose).
Message has been deleted

maven apache

unread,
Dec 19, 2013, 5:12:07 AM12/19/13
to mapsfo...@googlegroups.com
Hi Emux:

I am sorry, I miss the "tag-mapping.xml". I will have a try. 

But one more thing, how about the feature of our own does not have a correspond tag in OSM tags?

在 2013年12月19日星期四UTC+8下午5时26分56秒,emux写道:

maven apache

unread,
Dec 20, 2013, 2:57:31 AM12/20/13
to mapsfo...@googlegroups.com
Hi Emux:

I am afraid that we have miss a key point: the data model of our own data I mentioned is not compatible with the OSM data model.

And I read both the "osmosis" introduction and   the source codes of "mapsforge-map-writer".

And I am sure again the "mapsforge-map-writer" is a plugin of "osmosis" for generate "Mapsforge Binary Map File Format" from the OSM data.

This is the key point, it means that the "osmosis" may even not regonize our data format.

Do I miss anything else?

emux

unread,
Dec 20, 2013, 3:20:18 AM12/20/13
to mapsfo...@googlegroups.com
Hi,

Yes actually I think there is a confusion here.
There is absolutely no need to have your vector files compatible with OSM data model.
That's the purpose of a custom tag-mapping.xml which you feed the map writer.

If you want to check one of the apps I participate:
https://play.google.com/store/apps/details?id=gr.talent.cyprusHunt
You'll see a custom made vector map of Cyprus (with its own render theme).

This vector map is made from custom Cyprus shp files (EPSG:32636).
- The shp files were converted to osm format (EPSG:4326).
- Then a custom tag-mapping.xml file was used.
Within it, the layers zoom levels were described using the original fields of the shp files.
- You can certainly modify the fields to your needs, altering the shp files prior converting them to osm,
or by using TagTransform as a step for osmosis.
- Then a custom render theme was made, using also the shp files field names.

maven apache

unread,
Dec 20, 2013, 4:52:06 AM12/20/13
to mapsfo...@googlegroups.com
Thank you so much, I will  have a try. :)

在 2013年12月20日星期五UTC+8下午4时20分18秒,emux写道:
Reply all
Reply to author
Forward
0 new messages