02-08-2016 05:06 PM
Hi team!
I am working with queries in Geospatial Portal. from the API I get results and i add them on the map. but the layer style is the default (gray), i search info reagards to how to change the layer style but with my tests i could not to do it.
the geometry of results is polygon type.
I tried with this:
"style" : { "color" : "#f00", "name" : "Red area", "translucency" : 0.2 }
And with this:
style:{ "fill":{ "color":"#f00", "translucency":0.7 }, "stroke":{ "color":"#FF0", "width":2, "translucency":1 } }, defaultStyleName : "none",
my question is "what is the ok style?" only a color ,a x name and a translucency?
and what is the good style type?
styleType : "Intergraph.WebSolutions.Core.WebClient.Platform.Style.AreaStyle"
or
styleType : "Intergraph.WebSolutions.Core.WebClient.Platform.Style.SimpleFillStyle"
?
thanks in advance
I hope can help me
best regards
02-11-2016 01:45 AM - edited 02-11-2016 01:46 AM
Hi David,
how about something like this:
style: { type: "AreaStyle", styles: [{ type: "SimpleLineStyle", color: "#ff0000", width: 1, translucency: 0.0 }, { type: "SimpleFillStyle", color: "#aaaa00", translucency: 0.0 }] }
However as far as I know there is some problem with the styling configuration, mainly when applied to WMPS. That should be fixed in EP05.
02-11-2016 07:47 AM
Hi Jan,
thankyou
I will try it.
04-21-2017 09:26 AM
This is the json object that I return in the $GP.dynamicStyles.register default function that solve the same problem for me :
{
"styleType": "Intergraph.WebSolutions.Core.WebClient.Platform.Style.AreaStyle",
"style": {
"styles": [
{
"type": 2,
"color": "#800080"
},
{
"type": 3,
"translucency": 1
}
]
}
}
type 2 = SimpleLineStyle
type 3 = SimpleFillStyle
I Hope this can help someone!
01-10-2018 05:06 PM
Hi, I know it's late but this is my solution anyway for those who face the same issue:
// Styling for lot result var highlightStyle = new Intergraph.WebSolutions.Core.WebClient.Platform.Style.AreaStyle(null, { styles: [{ type: "SimpleLineStyle", color: "#e70707", width: 2 }, { type: "SimpleFillStyle", translucency: 0.9, color: "#e70707" }] }); // Add to the query
var queryName = "California State";
$GP.queries.add({
featureClassId: "{http://www.intergraph.com/geomedia/gml}OM_USA_STATES",
url: "http://demo.hexagongeospatial.com/GWM_WFS_NonTransactional/service.svc/get",
definitionName: "WFS",
queryName: queryName,
addToLegend: false,
style: highlightStyle,
filters: [{
operator: "=",
operands: ["{http://www.intergraph.com/geomedia/gml}STATE_NAME", "Oklahoma"]
}],
},
function (result) {
if (result.updated) {
$GP.ui.info("Analysis updated");
return;
}
$GP.queries.find({
analysisId: result.analysisId,
}, function (result2) {
result2.analysis.addToLegend(function () {
$GP.legend.find({
name: queryName
}, function (ret){ret.legendItems[0].fitLayer();});
});
});
});