Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.gluonhq:maps:1.0.4'
	}
	dependencies {
		implementation("com.github.gluonhq:maps:1.0.4")
	}
	<dependency>
	    <groupId>com.github.gluonhq</groupId>
	    <artifactId>maps</artifactId>
	    <version>1.0.4</version>
	</dependency>

                            
    libraryDependencies += "com.github.gluonhq" % "maps" % "1.0.4"
        
        

                            
    :dependencies [[com.github.gluonhq/maps "1.0.4"]]
        
        

Readme


Gluon

Build Maven Central License javadoc JFXCentral

Gluon Maps

Gluon Maps provides an easy way to integrate OpenStreetMaps into a JavaFX application. It is blazing fast and offers layer overlays, multiple tile-sets, and much more.

API Overview

MapPoint

Represents a set of latitude and longitude values.

MapPoint point = new MapPoint(latitude, longitude);

MapLayer

Shows the map tiles along with any user defined nodes. This class can be extended by overloading the layoutLayer method.

The following code snippet shows how to create a custom layer that displays red circles at the given map points:

public class CustomMapLayer extends MapLayer {

    @Override
    protected void layoutLayer() {
        for (Pair<MapPoint, Node> candidate : points) {
            MapPoint point = new MapPoint(lat, long);
            Node icon = new Circle(5, Color.RED);
            Point2D mapPoint = getMapPoint(point.getLatitude(), point.getLongitude());
            icon.setVisible(true);
            icon.setTranslateX(mapPoint.getX());
            icon.setTranslateY(mapPoint.getY());
        }
    }
}

MapView

Top level map component which supports multiple MapLayer. The section of viewable map can be changed using input events (mouse/touch/gestures), or by calling the methods setCenter and setZoom directly.

MapView mapView = new MapView();
mapView.addLayer(new CustomMapLayer());
mapView.setZoom(3);

Usage

Map can be added to a JavaFX project by using the artifact published in Maven Central:

Maven:

<dependency>
    <groupId>com.gluonhq</groupId>
    <artifactId>maps</artifactId>
    <version>${version}</version>
</dependency>

Gradle:

dependencies {
    implementation 'com.gluonhq:maps:${version}'
}

The project can be also be installed in the local Maven repository:

mvn install

Sample

A sample is provided in the repository to get started with the library.

To run the sample:

mvn javafx:run -f samples

Contribution

All contributions are welcome!

There are two common ways to contribute:

Follow contributing rules for this repository.

Commercial License

Commercial licences available at: http://gluonhq.com/labs/maps/buy/