Friday, February 24, 2017

A little MapTile update

Aloha,

After playing around with the MapTileSkin in the TilesFX project I thought it might make sense to add the ability to also visualize points of interest and a track...and so I've added those features :)
I've also added the ability to set the color of the current location marker and the color of the track (it's only one track supported at the moment).
To realize this behavior the Location class now also contains a color property.
For the colors I also decided to offer a defined set of colors which are the ones that you can find in Tile.TileColor

  • GRAY
  • RED
  • GREEN
  • BLUE
  • ORANGE
  • YELLOW_ORANGE
  • YELLOW
  • MAGENTA

These colors will be used wherever possible within TilesFX to create a homogene look over all tiles.
To give you an idea how this new stuff is looking, here are some screenshots...


Map provider: Hydda

Map provider: OpenStreetMap HOT

Map provider: OpenStreetMap BlackWhite

Map provider: World Imagery


On the screenshot above you can see the current location icon (the bigger blue one), the start icon (green one at the end of the magenta track), the stop icon (the red one at the end of the magenta track) and some poi icons (the yellow, the red and the magenta one).
For the example above I've simply exported a track recorded by my Garmin watch to GPX format and imported the GPX file, converted the track points to a list of Locations and pass it to the Tile...done :)
If you are interested in the code I've used to convert the GPX file to my Location objects you can find a little gist that I've created on github which shows how it works. You simply have to provide a gpx file with the name track.gpx and put it besides the java file.
Here is the link to the gist.

Another feature that I've added is the ability to change the zoom level of the MapTileSkin via the current location. Therefor I've added a zoomLevel property to the Location class and if you change it e.g. by calling

tile.getCurrentLocation().setZoomLevel(0)

the map tile will zoom out completely. The range of zoom levels is going from 0-17.
I hope this features might be useful to create for example a fitness dashboard etc.

At the moment I've not added a live tracking feature which would create a track on the fly every time the current location changes but this would be easy to add if it's needed.

As always feedback is more than welcome, so please don't hesitate to contact me and let me know about ideas/improvements/feature requests etc.

The above mentioned features are part of the current release of TilesFX which is 1.3.5 and which can be found here

The source code at Github

The binary at Bintray

The dependency at Maven Central (it's published but might take some time to show up)

That's it for today, so keep coding...

5 comments:

  1. thanks

    it might be interesting to embed GMapsFX as one of the map providers. it has very good control API and depends on google maps.

    http://rterp.github.io/GMapsFX/

    ReplyDelete
    Replies
    1. Hi there,
      It should be easy to use it in combination with the CustomTileSkin. So you should set your GMapsFX instance as graphic on the tile and set the skinType to CUSTOM.
      Cheers,
      Gerrit

      Delete
  2. Hi Gerrit,

    For some reasons, when I run GpxParseDemo.java, I have to choose "OSM BW" on the top right hand corner map menu to see a black and white map. The other 3 map options won't load anything.

    I've also modified GpxParseDemo.java to define my own POI and load my own track.gpx. So far, only "OSM BW" works.

    Can you double check ? Does the osm.html need some update to connect to those map servers?

    Appreciate your work!

    Manny

    ReplyDelete
    Replies
    1. Hi Manny,
      Yep, I saw the same sometimes. Could you please file an issue on github?
      Cheers,
      Gerrit

      Delete
    2. You might want to try 1.3.6, I've made some modifications there and it seems to work now.
      Cheers,
      Gerrit

      Delete