Pages

Friday, December 3, 2021

All things countries...

Aloha,

As some of you might know I've created a JavaFX world map component a while back which I also integrated in my TilesFX and charts library.

Well the component itself works so far but it was always only a world map. I mean it is possible to strip out single countries and draw them but then you have the problem that this country map won't come with the same features as the world map.

So in principle I was always looking for something similar to Googles GeoChart. Well...long story short...I've created something similar :)

And I simply named it countries...because it is all about countries. It is another JavaFX library and it comes with 3 JavaFX controls:

- CountryPane

- RegionPane

- WorldPane

Each of those panes has more or less the same functionality. They show at least 1 country (CountryPane), a set of countries (RegionPane) or the whole world (WorldPane).

The WorldPane and the RegionPane in addition have the ability to select countries by clicking on them.

All 3 panes can overlay a heatmap and also so called connections (e.g. flight connections between airports).

In addition to the countries with their shapes the library also contains around 41000 cities with information about their population (if available), location, country and if it is a capital (if available). In addition I've also added around 8500 airports that you can use.

Countries can have value objects (metadata if you like) and can also have simple values, you can color them as you like. I hope I have build in enough capabilities to use for data visualization (if you miss something...just let me know).

Yep this is great...but it comes with lots of data...so the library is 13 MB in size!!!

But to be honest I don't care, it is just handy if you can directly make use of this data without loading other external data. Of course you can use your own data if you like, as long as you have latitude/longitude information it will work.

The library is build on JDK17, meaning to say if you would like to use it...move your stuff to JDK17 ;)

To give you an idea how it could be used, here are some screenshots...

This is the CountryPane showing Germany with some cities (population > 300000). To make it easier I simply added the same cities as heatmapSpots. In addition you see a connection between the FMO airport and the MUC airport.


Here you see the RegionPane showing the European Union. In this map I show the available capitals (cyan dots) and used cities with a population > 200000 for the heatmap. In addition I here show 3 connections between some airports (LIS -> ARN, MAD -> ARN, FMO -> ARN). I already added some predefined country regions in the BusinessRegion class. There you will find regions like DACH, EMEA, APAC, AMERICAS, CENTRAL_ASIA, NORTHERN_AMERICA etc. You can define your own regions by using the CountryRegion class.



And finally the WorldPane which again shows the available capitals (cyan spots), cities with a population > 1000000 for the heatmap and again some connections between international airports.

Not sure if this might be interesting for you but I needed it :)

As always the source is available over at github where you can also find the latest release. And of course it is also availble on maven central.

That's it for today...so keep coding... :)


No comments:

Post a Comment