Giter Club home page Giter Club logo

Comments (8)

p-lr avatar p-lr commented on August 17, 2024

TrekMe already has a built-in feature for downloading tiles for an offline usage.
If you go to Create a map > OpenStreetMap, you select your area and all tiles are downloaded.
Do you mean that it would be nice to import .osm files and create a map from it?
If so, that feature would be accessible from the main menu > Import a map

from trekme.

Not-Super-Nova avatar Not-Super-Nova commented on August 17, 2024

When trying to import a map from a .osm file, it's giving me a blank screen with a download F.A.B in the bottom right corner, so while that feature may work in other cases it's not what I'm looking for.

I'm talking about making a rendering system in the app, so that you need only load a .osm file, not import it.

Rendering the OSM instead of displaying pre-rendered tiles would reduce storage usage and would leave options open for routing and navigation in the future.

Finally, rendering the OSM data on the device lets you allow the user to have any LOD they want, without having separate datasets for it, keeping the same data size and effectively unlocking the zoom limits. Like how vector fonts are more useful than raster fonts when doing graphic design.

I'm fairly sure using a VectorDrawable would work great, when feeding in the right data.

I've been out of practise with android for quite some time now, but if you want me to I may be able to create an example activity once I get some downtime to show you what I mean?

from trekme.

Not-Super-Nova avatar Not-Super-Nova commented on August 17, 2024

Better yet, you could let someone else do all the work and use https://github.com/mapsforge/mapsforge

from trekme.

p-lr avatar p-lr commented on August 17, 2024

Well, I developed a library for rendering maps: https://github.com/peterLaurence/MapView
TrekMe uses that library.
It might be possible to directly render from an .osm file. Do you know how graphic data is stored in there? Is is tile-based, vector data?

from trekme.

Not-Super-Nova avatar Not-Super-Nova commented on August 17, 2024

Attached at the bottom is an excerpt from the OpenStreetMap Wiki.
It seems to be an XML schema, so loading it and manipulating it should be relatively easy.
If I were to do it, I'd probably project the points (as they are coordinates) and then render it like a vector image, using the tags (e.g. <tag k="highway" v="crossing"> to decide colouring and how zoomed in you have to be to render it.
If you want to re-use your existing code you could add a function which renders the OSM data to tiles as they're being loaded by MapView, letting you re-use the same bounding, zooming and chunking code.
Should you not want to do all of this, you can use the library I mentioned earlier that will handle it for you, and stores the data in a binary intermediate.

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="CGImap 0.0.2">
 <bounds minlat="54.0889580" minlon="12.2487570" maxlat="54.0913900" maxlon="12.2524800"/>
 <node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/>
 <node id="261728686" lat="54.0906309" lon="12.2441924" user="PikoWinter" uid="36744" visible="true" version="1" changeset="323878" timestamp="2008-05-03T13:39:23Z"/>
 <node id="1831881213" version="1" changeset="12370172" lat="54.0900666" lon="12.2539381" user="lafkor" uid="75625" visible="true" timestamp="2012-07-20T09:43:19Z">
  <tag k="name" v="Neu Broderstorf"/>
  <tag k="traffic_sign" v="city_limit"/>
 </node>
 ...
 <node id="298884272" lat="54.0901447" lon="12.2516513" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/>
 <way id="26659127" user="Masch" uid="55988" visible="true" version="5" changeset="4142606" timestamp="2010-03-16T11:47:08Z">
  <nd ref="292403538"/>
  <nd ref="298884289"/>
  ...
  <nd ref="261728686"/>
  <tag k="highway" v="unclassified"/>
  <tag k="name" v="Pastower Straße"/>
 </way>
 <relation id="56688" user="kmvar" uid="56190" visible="true" version="28" changeset="6947637" timestamp="2011-01-12T14:23:49Z">
  <member type="node" ref="294942404" role=""/>
  ...
  <member type="node" ref="364933006" role=""/>
  <member type="way" ref="4579143" role=""/>
  ...
  <member type="node" ref="249673494" role=""/>
  <tag k="name" v="Küstenbus Linie 123"/>
  <tag k="network" v="VVW"/>
  <tag k="operator" v="Regionalverkehr Küste"/>
  <tag k="ref" v="123"/>
  <tag k="route" v="bus"/>
  <tag k="type" v="route"/>
 </relation>
 ...
</osm>

from trekme.

p-lr avatar p-lr commented on August 17, 2024

Alright. Ideally, that could be transformed so that it could be read as vector tiles, like that. Using a custom renderer (using a third party library), that could work using MapView.
Do you know if there's a way to turn a big single .osm file into a stream of vector tiles?

from trekme.

Not-Super-Nova avatar Not-Super-Nova commented on August 17, 2024

from trekme.

p-lr avatar p-lr commented on August 17, 2024

This looks interesting:
https://dev.to/camptocamp-geo/creating-vector-tiles-from-openstreetmap-with-baremaps-jln

from trekme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.