3

I'm development an android app for navigate inside the university campus, it's my graduation project :). I did the campus map with Josm, now I have it in .osm

I found many libraries and frameworks for rendering of maps based on OpenStreetMap data but for politics things of the university I can't load the map to publics servers like Open Steet Maps :( (so bad), then, I think make a local map and I found mapsforge as rendering (I don't know for routing) but my osm file doesn't have all information that Mapsforge Map-Writer request for made the Binary Map File for this library.

Now I'm going to try with CartoType but also I have to convert the format type and this apparently it's conflictive

someone did something like this? any recomendation? any way to render a native osm file?

2

As long as you have the data in OpenStreetMap format (i.e., you created it in JOSM, and exported as .osm), you should be able to load it into any tool that works with OSM data.

I'd take a look at OpenTripPlanner, which has a heavy transit focus but should also work for simple walk trips. You should be able to build a graph file that is then loaded into an OTP server for routing.

We built an open-source OTP Android app as well, which you're free to use (and contribute to ;)). You basically set up an OTP server, and point the app to it. Then you can plan any trip in the app based on the underlying data in OTP.

Note that the above is for routing, but won't help you with visualizing map tiles. However, we do support custom tile servers (right now we support Mapbox, Lyrk, MapQuest OSM, CycleMap, and Google tiles) in our Android app. So, if you're able to render tiles based on your .osm file and load them into a tile server, you should be able to add the tile server fairly easily into OTP Android (just a matter of configuring a new URL for a tile provider in a resource file, and adding an entry for that in the app user interface).

Feel free to contact us via mailing list if you have any more questions on these projects.

2

When displaying the map data as vector graphic via mapsforge,

have a closer look at GraphHopper when you need a routing engine on mobile systems like android.

There is a demo apk file for android testing purposes, and instructions how to get routing map data from raw OSM data.

I also remember some topics on Graphhoppers mailing list about android use cases.

0

I'm not sure how to do this in Android, but here's how to do it on the computer: I was able to use Maperitive to mark a bounding area, download OSM data for the area, generate tiles for it locally, and deploy the map on a local webpage using leaflet.js . I can browse this map without any internet connection.

Download and run Maperitive.

First, click "Map > Clear Map" from the top menu (or Ctrl+N) to remove any web maps. Then, load your OSM file from "File > Open Map Sources".

You can now Generate tiles by typing a line like this into the in-app command line:

generate-tiles minzoom=1 maxzoom=16

To get a fix on the min and max zoom extents you need, type zoom 12 , zoom 16 etc to see till where you want to go. The tileset will get generated. You can now make a simple HTML page, like this:

<html>
<head>
<link rel="stylesheet" href="lib/leaflet.css" />
</head>
  <style>
        body {
            padding: 0;
            margin: 0;
        }
        html, body, #map {
            height: 100%;
            width: 100%;
        }
    </style>
<body>
<div id="map"></div>
<script src="lib/leaflet.js"></script>
<script>
var map = L.map('map', {
    center: [18.512224413095872, 73.868436919390348],
    zoom: 12,
    minZoom: 8,
    maxZoom: 16,
    maxBounds: [
    [18.443790655688225, 73.741131698096311],
    [18.672919555595893, 73.955365096533811]
    ]
});
L.tileLayer('tiles/{z}/{x}/{y}.png', { attribution: 'Map tiles generated for local use by <a href="http://maperitive.net">Maperitive</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.' }).addTo(map);
</script>
</body>
</html>

Get the leaflet.js and css paths here: http://leafletjs.com/examples/quick-start.html (or download from that site).

There is a tiles.json file generated along with the tiles. You will find the bounding lat-long parameters, center point etc in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.