Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 12
Registered: ‎10-14-2015

Styling query results as polygon in Geospatial portal

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

Technical Evangelist
Posts: 652
Registered: ‎09-11-2015

Re: Styling query results as polygon in Geospatial portal

[ Edited ]

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.

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Occasional Contributor
Posts: 12
Registered: ‎10-14-2015

Re: Styling query results as polygon in Geospatial portal

Hi Jan,

thankyou

 

I will try it.

Occasional Visitor
Posts: 1
Registered: ‎04-21-2017

Re: Styling query results as polygon in Geospatial portal

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! 

Highlighted
Dd
Senior Member
Posts: 5
Registered: ‎11-05-2017

Re: Styling query results as polygon in Geospatial portal

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();});
});
});
});

 

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.