use of au.org.emii.portal.menu.MapLayerMetadata in project spatial-portal by AtlasOfLivingAustralia.
the class MapComposer method mapSpeciesFilter.
MapLayer mapSpeciesFilter(Query q, String species, String rank, int count, int subType, String wkt, boolean grid, int size, float opacity, int colour, boolean mapExpertDistributions) {
String filter = q.getQ();
//just in case it fails
if (mapExpertDistributions) {
try {
if (q instanceof BiocacheQuery) {
String lsids = ((BiocacheQuery) q).getLsids();
List<String> extraLsids = ((BiocacheQuery) q).getLsidFromExtraParams();
if (lsids != null && lsids.length() > 0) {
loadDistributionMap(lsids, wkt);
}
for (String extraLsid : extraLsids) {
if (extraLsid != null && extraLsid.length() > 0) {
LOGGER.debug("loading layer for: " + extraLsid);
loadDistributionMap(extraLsid, wkt);
}
}
}
} catch (Exception e) {
LOGGER.error("failed to map species distribution areas", e);
}
}
MapLayer ml = mapSpeciesWMSByFilter(getNextAreaLayerName(species), filter, subType, q, grid, size, opacity, colour);
if (ml != null) {
addToSession(ml.getName(), filter);
MapLayerMetadata md = ml.getMapLayerMetadata();
md.setOccurrencesCount(count);
ml.setClustered(false);
if (grid) {
ml.setColourMode(StringConstants.GRID);
}
addLsidBoundingBoxToMetadata(md, q);
}
return ml;
}
use of au.org.emii.portal.menu.MapLayerMetadata in project spatial-portal by AtlasOfLivingAustralia.
the class ALOCComposer method loadMap.
public void loadMap(Event event) {
//get job inputs
try {
for (String s : getJob().split(";")) {
if (s.startsWith("gc")) {
layerLabel = tToolName.getValue();
generationCount++;
break;
}
}
} catch (Exception e) {
LOGGER.error("error getting ALOC job info", e);
}
if (layerLabel == null) {
layerLabel = "My Classification " + generationCount;
generationCount++;
}
String mapurl = CommonData.getGeoServer() + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=ALA:aloc_" + pid + "&FORMAT=image%2Fpng";
String legendurl = CommonData.getGeoServer() + "/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=10&HEIGHT=1" + "&LAYER=ALA:aloc_" + pid;
LOGGER.debug(legendurl);
legendPath = legendurl;
getMapComposer().addWMSLayer("aloc_" + pid, layerLabel, mapurl, (float) 0.5, null, legendurl, LayerUtilitiesImpl.ALOC, null, null);
MapLayer mapLayer = getMapComposer().getMapLayer("aloc_" + pid);
if (mapLayer != null) {
mapLayer.setPid(pid);
WMSStyle style = new WMSStyle();
style.setName(StringConstants.DEFAULT);
style.setDescription("Default style");
style.setTitle(StringConstants.DEFAULT);
style.setLegendUri(legendurl);
LOGGER.debug("legend:" + legendPath);
mapLayer.addStyle(style);
mapLayer.setSelectedStyleIndex(1);
MapLayerMetadata md = mapLayer.getMapLayerMetadata();
String infoUrl = CommonData.getSatServer() + "/output/aloc/" + pid + "/classification.html" + "\nClassification output\npid:" + pid;
md.setMoreInfo(infoUrl);
md.setId(Long.valueOf(pid));
getMapComposer().updateLayerControls();
try {
// set off the download as well
String fileUrl = CommonData.getSatServer() + "/ws/download/" + pid;
Filedownload.save(new URL(fileUrl).openStream(), "application/zip", tToolName.getValue().replaceAll(" ", "_") + ".zip");
} catch (Exception ex) {
LOGGER.error("Error generating download for classification model:", ex);
}
}
this.detach();
}
use of au.org.emii.portal.menu.MapLayerMetadata in project spatial-portal by AtlasOfLivingAustralia.
the class GDMComposer method loadMap.
public void loadMap(Event event) {
String[] envlist = getSelectedLayersWithDisplayNames().split(":");
for (String env2 : envlist) {
String env = env2.split("\\|")[0];
String displayName = env2.split("\\|")[1];
String mapurl = CommonData.getGeoServer() + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=ALA:gdm_" + env + "Tran_" + pid + "&styles=alastyles&FORMAT=image%2Fpng";
String legendurl = CommonData.getGeoServer() + "/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=10&HEIGHT=1" + "&LAYER=ALA:gdm_" + env + "Tran_" + pid + "&STYLE=alastyles";
LOGGER.debug(legendurl);
String layername = "Tranformed " + displayName;
getMapComposer().addWMSLayer(pid + "_" + env, layername, mapurl, (float) 0.5, null, legendurl, LayerUtilitiesImpl.GDM, null, null);
MapLayer ml = getMapComposer().getMapLayer(pid + "_" + env);
ml.setPid(pid + "_" + env);
String infoUrl = CommonData.getSatServer() + "/output/gdm/" + pid + "/gdm.html";
MapLayerMetadata md = ml.getMapLayerMetadata();
md.setMoreInfo(infoUrl + "\nGDM Output\npid:" + pid);
md.setId(Long.valueOf(pid));
}
}
use of au.org.emii.portal.menu.MapLayerMetadata in project spatial-portal by AtlasOfLivingAustralia.
the class MaxentComposer method loadMap.
public void loadMap(Event event) {
String mapurl = CommonData.getGeoServer() + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=ALA:species_" + pid + "&styles=alastyles&FORMAT=image%2Fpng";
String legendurl = CommonData.getGeoServer() + "/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=10&HEIGHT=1" + "&LAYER=ALA:species_" + pid + "&STYLE=alastyles";
LOGGER.debug(legendurl);
//get job inputs
String layername = tToolName.getValue();
getMapComposer().addWMSLayer("species_" + pid, layername, mapurl, (float) 0.5, null, legendurl, LayerUtilitiesImpl.MAXENT, null, null);
MapLayer ml = getMapComposer().getMapLayer("species_" + pid);
ml.setPid(pid);
String infoUrl = CommonData.getSatServer() + "/output/maxent/" + pid + "/species.html";
MapLayerMetadata md = ml.getMapLayerMetadata();
md.setMoreInfo(infoUrl + "\nMaxent Output\npid:" + pid);
md.setId(Long.valueOf(pid));
try {
// set off the download as well
String fileUrl = CommonData.getSatServer() + "/ws/download/" + pid;
Filedownload.save(new URL(fileUrl).openStream(), "application/zip", tToolName.getValue().replaceAll(" ", "_") + ".zip");
} catch (Exception e) {
LOGGER.error("Error generating download for prediction model:", e);
}
this.detach();
}
use of au.org.emii.portal.menu.MapLayerMetadata in project spatial-portal by AtlasOfLivingAustralia.
the class SitesBySpeciesComposer method loadLayer.
void loadLayer(String type, String name, int typeId) {
String mapurl = CommonData.getGeoServer() + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=ALA:" + type + "_" + pid + "&style=" + type + "_" + pid + "&FORMAT=image%2Fpng";
String legendurl = CommonData.getGeoServer() + "/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=10&HEIGHT=1" + "&LAYER=ALA:" + type + "_" + pid + "&STYLE=" + type + "_" + pid;
LOGGER.debug(legendurl);
String layername = getMapComposer().getNextAreaLayerName(name);
getMapComposer().addWMSLayer(pid + "_" + type, layername, mapurl, (float) 0.5, null, legendurl, typeId, null, null);
MapLayer ml = getMapComposer().getMapLayer(pid + "_" + type);
ml.setPid(pid + "_" + type);
String infoUrl = CommonData.getSatServer() + "/output/sitesbyspecies/" + pid + "/" + type + "_metadata.html";
MapLayerMetadata md = ml.getMapLayerMetadata();
md.setMoreInfo(infoUrl + "\n" + name + "\npid:" + pid);
md.setId(Long.valueOf(pid));
}
Aggregations