Skip to content

Instantly share code, notes, and snippets.

@russellhoff
Created May 25, 2017 08:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russellhoff/54af4abd5862baf86afceb8407ff85e4 to your computer and use it in GitHub Desktop.
Save russellhoff/54af4abd5862baf86afceb8407ff85e4 to your computer and use it in GitHub Desktop.
A simple factory to create Points and Linestrings with 4326 srid.
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.PrecisionModel;
public class GeometriesFactory {
private static GeometryFactory factory4326 = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326);
public static Point createPoint(Double pLatitude, Double pLongitude){
return factory4326.createPoint(new Coordinate(pLongitude, pLatitude));
}
public static LineString createLineString(Coordinate[] pCoordsArray){
return factory4326.createLineString(pCoordsArray);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment