Best Open Source Java Tool for GML Snippet Rendering

I am looking for a way to render the part of GML that I get. What is the best freely available java library to use for this task?

+4
source share
2 answers

GeoTools provides a library for reading GML files. They also provide user interface components for displaying geospatial formats supported by the library.

+1
source

You are warned that GML does not determine the file format. It provides an abstract starting point for defining your own xml schema. We use a scheme to sort the xml elements to map to that Java class (so dates are displayed as Date, geometry as JTS Geometry, etc.).

This causes a lot of grief among people who were provided with only a GML file; that I recently added a utility class (called GML) to GeoTools that assumes that any undefined element is a string.

Here is an example from test cases:

URL url = TestData.getResource(this, "states.gml"); InputStream in = url.openStream(); GML gml = new GML(Version.GML3); SimpleFeatureCollection featureCollection = gml.decodeFeatureCollection(in); 

You can take the resulting featureCollection and use the JMapPane class, as shown in quickstart GeoTools ::

  MapContext map = new DefaultMapContext(); map.setTitle("Quickstart"); map.addLayer(featureCollection, null); // Now display the map JMapFrame.showMap(map); 
0
source

Source: https://habr.com/ru/post/1277123/


All Articles