- String includePath = path + url.getPath();
- String geoExt = includePath.substring(includePath.lastIndexOf('.'));
- Content geoContent = session.get(includePath);
- if (".gpx".equals(geoExt)) {
- try (InputStream in = geoContent.open(InputStream.class)) {
- SimpleFeature field = GpxUtils.parseGpxToPolygon(in);
- SimpleFeatureCollection features = new ListFeatureCollection(field.getType(), field);
- try (StringWriter writer = new StringWriter()) {
- GeoUtils.exportToSvg(features, writer, 100, 100);
- StreamSource res = new StreamSource(new StringReader(writer.toString()));
- return res;
+ int lastDot = url.getPath().lastIndexOf('.');
+ Polygon polygon;
+ if (lastDot > 0) {
+ String includePath = path + url.getPath();
+ Content geoContent = session.get(includePath);
+ String geoExt = includePath.substring(lastDot);
+ if (".gpx".equals(geoExt)) {
+ try (InputStream in = geoContent.open(InputStream.class)) {
+ polygon = GpxUtils.parseGpxTrackTo(in, Polygon.class);