-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b68522
commit 05c2cf0
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.ays.common.util; | ||
|
||
import lombok.experimental.UtilityClass; | ||
import org.locationtech.jts.geom.*; | ||
import org.locationtech.jts.geom.impl.CoordinateArraySequence; | ||
|
||
/** | ||
* Utility class for handling location-related operations. | ||
* Provides methods to generate geometric points based on latitude and longitude coordinates. | ||
*/ | ||
@UtilityClass | ||
public class AysLocationUtil { | ||
|
||
/** | ||
* Generates a Point object representing a location based on the provided latitude and longitude coordinates. | ||
* | ||
* @param latitude The latitude coordinate of the location. | ||
* @param longitude The longitude coordinate of the location. | ||
* @return A Point object representing the location. | ||
*/ | ||
public static Point generatePoint(final Double latitude, final Double longitude) { | ||
final Coordinate[] coordinates = new Coordinate[]{new Coordinate(latitude, longitude)}; | ||
final CoordinateSequence coordinateSequence = new CoordinateArraySequence(coordinates); | ||
final PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); | ||
return new GeometryFactory(precisionModel, 4326).createPoint(coordinateSequence); | ||
} | ||
|
||
} |