return out.toString();
}
private CreateStreamDataSetRequestJson createStreamDataSetRequestObject(String layerId) throws JsonParseException {
CreateStreamDataSetRequestJson createDataSetRequestJson = new CreateStreamDataSetRequestJson();
Metadata layerInfo;
try {
layerInfo = createLayerInfoObject(layerId);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return null;
}
if (!layerInfo.getAccess().equals(AccessLevel.Public)){
//throw new SecurityException();
}
//needs to be changed to kml service point, format
BoundingBox bounds = layerInfo.getBounds();
Double minX = bounds.getMinX();
Double maxX = bounds.getMaxX();
Double minY = bounds.getMinY();
Double maxY = bounds.getMaxY();
if (minX > maxX){
//this is supposed to mean that the layer crosses the dateline. this causes problems with kml & geoserver,
//so we give the full extent
minX = -180.0;
maxX = 180.0;
}
if (minY > maxY){
Double temp = minY;
minY = maxY;
maxY = temp;
}
String bbox = Double.toString(minX) + "," + Double.toString(minY) + ",";
bbox += Double.toString(maxX) + "," + Double.toString(maxY);
String workspaceName = layerInfo.getWorkspaceName();
String layerName = layerInfo.getOwsName();
String SRS = "EPSG:4326";
//http://geoserver01.uit.tufts.edu/wms?LAYERS=sde:GISPORTAL.GISOWNER01.CHELSEACULVERTSDITCHES05&request=getmap&format=kml&bbox=-71.052205,42.385485,-71.0138,42.41027&srs=EPSG:4326&width=1&height=1
String wmsUrl = ParseJSONSolrLocationField.getWmsUrl(layerInfo.getLocation());
//Note; this only works for GeoServer
wmsUrl = wmsUrl.replace("/wms", "/" + workspaceName + "/" + layerName + "/wms");
wmsUrl += "?request=getCapabilities";
//+ "?layers=" + workspaceName + ":" + layerName + "&request=getMap&format=kml&bbox="
//+ bbox + "&srs=" + SRS + "&width=1&height=1";
//this.layerName = workspaceName + ":" + layerName;
//height and width don't seem to matter; should test with a raster layer
logger.info("WMS Url: " + wmsUrl);
createDataSetRequestJson.setUrl(wmsUrl);
String layerTitle = layerInfo.getTitle();
createDataSetRequestJson.setTitle(layerTitle);
String layerOriginator = layerInfo.getOriginator();
createDataSetRequestJson.setAuthor(layerOriginator);
String layerAbstract = layerInfo.getDescription();
//layerAbstract = "test data";
if (layerAbstract.length() > 1951){
layerAbstract = layerAbstract.substring(0, 1950);
}
createDataSetRequestJson.setDescription(layerAbstract);
//String keywords = cleanString(requestedLayerInfo.get("ThemeKeywords")) + " " + cleanString(requestedLayerInfo.get("PlaceKeywords"));
//String[] keywordArray = keywords.split(" ");
String[] placeKeywords = layerInfo.getPlaceKeywords();
String[] themeKeywords = layerInfo.getThemeKeywords();
String[] keywordArray = concat(placeKeywords, themeKeywords);
for (String keywordElement : keywordArray){
//System.out.println(keywordElement);
try {
this.allTags.add(keywordElement);