Directory

← Back

Map Add-on

This is Java API for Highmaps for Vaadin 8

Author

Rating

Popularity

<100

This is Java API for Highmaps for Vaadin 8.

Highmaps has similar API as Highcharts, and likewise the Java API in this add-on has been brought in similar fashion as Vaadin Charts.

Demo of the original Highmaps JavaScript library can be found here: https://www.highcharts.com/maps/demo

Highmaps license

Note: This add-on does not include commercial license for Highmaps. So in order to use to the component in a legit way you need to obtain also the appropriate commercial license.

License & Author

This Add-on is distributed under Apache 2.0

Component Factory Maps is written by Vaadin Ltd.

Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: Support and Pricing

Sample code

public class NordicCountries extends Map {
    public NordicCountries() {
        super();
        initConfiguration();

    }

    private void initConfiguration() {
        Configuration config = getConfiguration();
        // Import map data from JS file
        // File is "src/main/webapp/VAADIN/maps/europe.js"
        Page.getCurrent().addDependency(new Dependency(Type.JAVASCRIPT, "vaadin://maps/europe.js"));
        config.setTitle("Nordic Countries");
        config.setSubTitle("Demo of drawing all areas in the map, only highlighting partial data");
        config.getLegend().setEnabled(false);

        config.addSeries(getMapSeries());
        addPointClickListener(this::handlePointClick);
        setSizeFull();
    }

    private void handlePointClick(PointClickEvent event) {
        Notification.show("Point clicked: " + event.getSeries().getName() + " " + event.getPoint().getCode(),
                Notification.Type.HUMANIZED_MESSAGE);
    }

    private MapDataSeries getMapSeries() {
        MapDataSeries series = new MapDataSeries("Country");
        series.setMapData("$wnd.VaadinMaps.maps[\"custom/europe\"]");
        series.add(new MapDataSeriesItem("IS", 1));
        series.add(new MapDataSeriesItem("NO", 1));
        series.add(new MapDataSeriesItem("SE", 1));
        series.add(new MapDataSeriesItem("FI", 1));
        series.add(new MapDataSeriesItem("DK", 1));
        series.setJoinBy("iso-a2", "code");
        PlotOptionsMap options = new PlotOptionsMap();
        DataLabels dataLabels = options.getDataLabels();
        dataLabels.setEnabled(true);
        dataLabels.setColor(SolidColor.WHITE);
        dataLabels.setFormatter("function () { if (this.point.value) { return this.point.name; } }");
        series.setPlotOptions(options);
        SeriesTooltip tooltip = options.getTooltip();
        tooltip.setHeaderFormat("");
        tooltip.setPointFormat("{point.name}");

        return series;
    }
}
window.VaadinMaps = window.VaadinMaps || {}
window.VaadinMaps.maps = window.VaadinMaps.maps || {}
window.VaadinMaps.maps["custom/europe"] = {"title":"Europe","version":"1.1.2","type":"FeatureCollection","copyright":"Copyright (c) 2015 Highsoft AS, Based on data from Natural Earth","copyrightShort":"Natural Earth","copyrightUrl":"http://www.naturalearthdata.com","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:102014"}},"hc-transform":{"default":{"crs":"+proj=lcc +lat_1=43 +lat_2=62 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs","scale":0.000169255094964,"jsonres":15.5,"jsonmarginX":-999,"jsonmarginY":9851.0,"xoffset":-1706316.2597,"yoffset":4824494.18154}},
"features":[{"type":"Feature","id":"DK","properties":{"hc-group":"admin0","hc-middle-x":0.19,"hc-middle-y":0.44,"hc-key":"dk","hc-a2":"DK","name":"Denmark","labelrank":"4","country-abbrev":"Den.","subregion":"Northern Europe","region-wb":"Europe & Central Asia","iso-a3":"DNK","iso-a2":"DK","woe-id":"23424796","continent":"Europe"},"geometry":{"type":"MultiPolygon","coordinates":[[[[3686,4530],[3743,4490],[3764,4508],[3787,4471],[3773,4443],[3724,4436],[3644,4481],[3658,4526],[3686,4530]]],[[[3536,4512],[3564,4499],[3541,4493],[3513,4524],[3536,4512]]],[[[3898,4549],[3847,4516],[3831,4533],[3864,4557],[3898,4549]]],[[[3443,4565],[3482,4530],[3472,4501],[3447,4513],[3443,4565]]],[[[3616,4524],[3599,4467],[3584,4496],[3635,4587],[3616,4524]]],[[[4282,4636],[4328,4610],[4317,4568],[4251,4596],[4260,4656],[4282,4636]]],[[[3217,4671],[3225,4667],[3223,4642],[3210,4667],[3217,4671]]],[[[3533,4717],[3608,4645],[3599,4563],[3567,4550],[3511,4568],[3458,4614],[3459,4642],[3424,4684],[3533,4717]]],[[[3899,4708],[3889,4727],[3902,4751],[3914,4724],[3899,4708]]],[[[3578,4795],[3579,4771],[3562,4769],[3572,4800],[3578,4795]]],[[[3306,5107],[3300,5063],[3263,5028],[3247,5060],[3264,5089],[3306,5107]]],[[[3664,5214],[3644,5204],[3639,5178],[3611,5196],[3664,5214]]],[[[3282,4516],[3255,4513],[3260,4582],[3227,4563],[3225,4595],[3261,4584],[3251,4670],[3201,4707],[3166,4708],[3184,4779],[3216,4802],[3200,4855],[3172,4868],[3178,4993],[3188,5027],[3208,5000],[3249,4999],[3274,4971],[3277,5015],[3312,5063],[3347,5035],[3326,5010],[3362,5013],[3345,5088],[3389,5126],[3417,5111],[3444,5148],[3362,5120],[3338,5136],[3269,5107],[3237,5058],[3245,5003],[3199,5057],[3260,5156],[3385,5166],[3411,5189],[3472,5289],[3508,5292],[3570,5336],[3544,5283],[3563,5244],[3562,5187],[3548,5172],[3519,5092],[3535,4992],[3603,4985],[3632,4960],[3598,4893],[3578,4899],[3563,4859],[3558,4910],[3542,4916],[3513,4872],[3517,4805],[3460,4782],[3487,4757],[3444,4736],[3454,4722],[3395,4683],[3430,4613],[3394,4588],[3434,4536],[3435,4494],[3409,4521],[3384,4487],[3384,4487],[3282,4516]]],[[[3717,4815],[3747,4806],[3772,4741],[3805,4817],[3779,4826],[3839,4872],[3901,4850],[3884,4814],[3901,4753],[3845,4704],[3842,4672],[3879,4649],[3871,4621],[3837,4612],[3834,4545],[3818,4538],[3838,4500],[3805,4457],[3768,4508],[3790,4538],[3750,4596],[3685,4601],[3656,4648],[3675,4656],[3665,4703],[3634,4751],[3681,4753],[3717,4786],[3717,4815]]]]}},{"type":"Feature","id":"FO","properties":{"hc-group":"admin0","hc-middle-x":0.56,"hc-middle-y":0.16,"hc-key":"fo","hc-a2":"FO","name":"Faroe Islands","labelrank":"6","country-abbrev":"Faeroe Is.","subregion":"Northern Europe","region-wb":"Europe & Central Asia","iso-a3":"FRO","iso-a2":"FO","woe-id":"23424816","continent":"Europe"},"geometry":{"type":"MultiPolygon","coordinates":[[[[1151,6735],[1169,6717],[1165,6663],[1146,6700],[1151,6735]]],[[[1176,6812],[1202,6782],[1190,6763],[1169,6796],[1176,6812]]],[[[1150,6888],[1163,6872],[1139,6859],[1115,6902],[1150,6888]]],[[[1158,6940],[1202,6846],[1193,6819],[1166,6880],[1143,6903],[1158,6940]]],[[[1199,6933],[1230,6870],[1208,6857],[1181,6898],[1172,6936],[1199,6933]]],[[[1236,6908],[1230,6914],[1227,6927],[1232,6941],[1236,6908]]],[[[1226,6902],[1222,6904],[1215,6942],[1217,6946],[1226,6902]]],[[[1254,6915],[1248,6943],[1254,6940],[1257,6921],[1255,6914],[1263,6903],[1246,6901],[1239,6895],[1243,6931],[1254,6915]]]]}},{"type":"Feature","id":"HR","properties":{"hc-group":"admin0","hc-middle-x":0.09,"hc-middle-y":0.39,"hc-key":"hr","hc-a2":"HR","name":"Croatia","labelrank":"6","country-abbrev":"Cro.","subregion":"Southern Europe","region-wb":"Europe & Central Asia","iso-a3":"HRV","iso-a2":"HR","woe-id":"23424843","continent":"Europe"},"geometry":{"type":"MultiPolygon","coordinates":[[[[4965,1080],[4964,1071],[4945,1066],[4938,1078],[4965,1080]]],[[[5060,1097],[5137,1081],[5142,1075],[5062,1089],[5060,1097]]],[[[4924,1135],[4980,1143],[5017,1129],[4944,1116],[4924,1135]]],[[[4799,1153],[4804,1142],[4785,1134],[4768,1148],[4799,1153]]],[[[4873,1205],[4915,1189],[5010,1189],[4904,1178],[4834,1192],[4873,1205]]],[[[4922,1243],[4925,1221],[4841,1228],[4840,1250],[4922,1243]]],[[[4813,1251],[4834,1236],[4825,1233],[4794,1244],[4813,1251]]],[[[4621,1380],[4603,1384],[4580,1409],[4607,1399],[4621,1380]]],[[[4572,1425],[4565,1419],[4550,1431],[4536,1450],[4572,1425]]],[[[4496,1441],[4573,1380],[4557,1376],[4526,1418],[4496,1441]]],[[[4482,1574],[4494,1578],[4572,1505],[4495,1543],[4482,1574]]],[[[4392,1569],[4391,1562],[4374,1601],[4388,1593],[4392,1569]]],[[[4458,1644],[4474,1623],[4481,1604],[4444,1643],[4458,1644]]],[[[4398,1672],[4394,1585],[4363,1666],[4381,1672],[4355,1720],[4372,1729],[4398,1672]]],[[[4412,1758],[4435,1713],[4468,1683],[4386,1710],[4412,1758]]],[[[5311,1013],[5150,1111],[5070,1120],[5023,1159],[5115,1130],[5161,1114],[5293,1053],[5298,1030],[5311,1013]]],[[[5272,2037],[5265,2001],[5308,1936],[5313,1878],[5390,1853],[5399,1831],[5332,1816],[5333,1734],[5308,1729],[5259,1787],[5229,1777],[5164,1799],[5120,1791],[5085,1763],[5051,1788],[5030,1773],[4966,1787],[4950,1773],[4893,1807],[4867,1774],[4805,1774],[4781,1716],[4754,1721],[4705,1771],[4662,1750],[4668,1659],[4747,1571],[4775,1482],[4881,1385],[4890,1365],[4976,1298],[5010,1291],[5019,1256],[5062,1201],[5095,1184],[5098,1143],[4981,1218],[4936,1263],[4860,1282],[4742,1274],[4729,1323],[4625,1387],[4544,1481],[4583,1510],[4492,1601],[4491,1679],[4468,1723],[4415,1769],[4362,1786],[4296,1624],[4219,1709],[4192,1822],[4209,1816],[4271,1801],[4286,1828],[4369,1822],[4403,1876],[4428,1842],[4525,1818],[4570,1837],[4542,1900],[4581,1934],[4624,1943],[4625,2002],[4602,2023],[4614,2053],[4734,2110],[4722,2143],[4777,2150],[4851,2116],[4877,2075],[4924,2054],[4959,2009],[5008,2009],[5070,1968],[5138,1979],[5180,1971],[5227,2026],[5272,2037]]]]}},{"type":"Feature","id":"NL","properties":{"hc-group":"admin0","hc-middle-x":0.34,"hc-middle-y":0.59,"hc-key":"nl","hc-a2":"NL","name":"Netherlands","labelrank":"5","country-abbrev":"Neth.","subregion":"Western Europe","region-wb":"Europe & Central Asia","iso-a3":"NLD","iso-a2":"NL","woe-id":"-90","continent":"Europe"},"geometry":{"type":"MultiPolygon","coordinates":[[[[2408,3636],[2399,3614],[2350,3647],[2395,3648],[2408,3636]]],[[[2593,4028],[2574,3998],[2561,4015],[2588,4051],[2593,4028]]],[[[2603,4061],[2593,4060],[2613,4079],[2625,4085],[2603,4061]]],[[[2691,4107],[2652,4094],[2648,4104],[2719,4119],[2691,4107]]],[[[2776,4121],[2783,4117],[2735,4111],[2734,4122],[2776,4121]]],[[[2817,4118],[2812,4122],[2827,4129],[2847,4126],[2817,4118]]],[[[2280,3553],[2316,3561],[2371,3536],[2395,3553],[2437,3537],[2380,3495],[2330,3523],[2285,3515],[2280,3553]]],[[[2444,3537],[2389,3565],[2367,3550],[2316,3574],[2305,3602],[2372,3613],[2422,3559],[2444,3580],[2400,3604],[2436,3629],[2402,3678],[2414,3716],[2438,3721],[2510,3811],[2565,3989],[2593,3969],[2677,4019],[2717,4076],[2786,4101],[2916,4110],[2993,4045],[2988,3965],[2969,3933],[2959,3874],[2912,3874],[2897,3827],[2945,3818],[2952,3754],[2887,3701],[2910,3678],[2832,3644],[2788,3666],[2751,3642],[2779,3594],[2794,3519],[2766,3475],[2780,3452],[2737,3419],[2761,3382],[2746,3338],[2690,3344],[2723,3456],[2660,3498],[2614,3492],[2581,3557],[2561,3534],[2537,3566],[2511,3546],[2486,3564],[2467,3530],[2444,3537]],[[2720,3812],[2735,3822],[2736,3825],[2736,3825],[2736,3825],[2750,3836],[2750,3869],[2717,3876],[2748,3862],[2736,3825],[2736,3825],[2736,3825],[2720,3812],[2720,381

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Version 1.3.0

  • Updating listeners not to log deprecation warnings
  • Vaadin 8.12 or newer required
Released
2021-08-25
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.10+
Browser
Browser Independent

Map Add-on - Vaadin Add-on Directory

This is Java API for Highmaps for Vaadin 8 Map Add-on - Vaadin Add-on Directory
## This is Java API for Highmaps for Vaadin 8. Highmaps has similar API as Highcharts, and likewise the Java API in this add-on has been brought in similar fashion as Vaadin Charts. Demo of the original Highmaps JavaScript library can be found here: https://www.highcharts.com/maps/demo ## Highmaps license Note: This add-on does not include commercial license for Highmaps. So in order to use to the component in a legit way you need to obtain also the appropriate commercial license. ## License & Author This Add-on is distributed under Apache 2.0 Component Factory Maps is written by Vaadin Ltd. ### Sponsored development Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: [Support](https://vaadin.com/support) and [Pricing](https://vaadin.com/pricing)
Online