Hexagon Geospatial
MENU

GeoMedia Smart Client

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 95
Registered: ‎11-17-2015
Accepted Solution

GMSC - Add WMS Layer programatically

Hello,

 

Is it technically possible to add a WMS Layer programatically in GMSC?

Any code available in JAVA?

 

Thank you.

Yohann.

Frequent Contributor
Posts: 109
Registered: ‎04-05-2016

Re: GMSC - Add WMS Layer programatically

Hi Yohann,

 

on the GMSC client it is only possible to programmatically create a temporary layer and add vector data in any form. So it is not possible to add a WMS layer just from GMSC client customization.

 

As far as I know, raster data including data coming from a WMS can only be added if it is configured in the GMSC admin database. We have a solution that is using a custom webservice on the GMSC host that registers WMS layers in the database that then can be used on the client side once again.

 

I know that this isn't helping much, but at least you have an idea where you are going to head towards.

 

Regards,

Sven

Frequent Contributor
Posts: 95
Registered: ‎11-17-2015

Re: GMSC - Add WMS Layer programatically

Hello Sven,

 

Thank you for your reply.

That's what I was afraid of. I've heard that GMSC will consume WMS directly from the client side instead of calling WMS from server but I'am not sure about that. Tha's why I had this hope of adding WMS source directly on client side using JAVA command.

 

The initial need is to search into a catalog explorer and add the WMS source.

Because we control the catalog data I think we will add the catalog records (WMS layers) into GMSC using a batch.

On client side, the catalog explorer will display on/off the different WMS layers.

Not the best solution (all the WMS layers will be in the GMSC legend, problem of refreshing the GMSC metadata vs WMS update, etc) but at least we can cover a part of the inintial requirement.

 

If anyone has a way to add a WMS programatically using JAVA I'am still interested.

 

Thank you.

Yohann.

 

 

Frequent Contributor
Posts: 109
Registered: ‎04-05-2016

Re: GMSC - Add WMS Layer programatically

Hi Yohann,

 

what you heard is right. The new WMS feature loader in GMSC 2016 doesn't rely on GeoMedia WebMap anymore and the communication happens directly between the GMSC client and the WMS. Nevertheless you are not able to programatically add a legend entry in GMSC that is using the new WMS feature loader.

 

As I said before, an alternative could be that you build a webservice using the GMSC API on the server and manage the WMS features that way.

 

Regards,

Sven

Staff
Posts: 950
Registered: ‎10-19-2015

Re: GMSC - Add WMS Layer programatically

Hi guys,

 

that seems to be possible.

You must use

 

ApplicationContext.getProject().addFeature(com.intergraph.services.emea._2011._03.types.Feature data, Theme parent, int level)

 

The data feature object is the server object, so you have to define the same properties as the server does. In order to have an example you can use fiddler to check GetLegendMetadata request on an existing client side WMS.

Here is anyway an example:

 

Capture.PNG

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Occasional Contributor
Posts: 13
Registered: ‎08-23-2016

Re: GMSC - Add WMS Layer programatically

I got the solution (Thanks to Stefano and Azzurra)

 

 

 

String WMSUrl = "http://localhost/TestWMS2/service.svc/get?SERVICE=WMS&request=GetCapabilities&FORMAT=image/png&AXISORDER=1&SRS=3945&MAXTILEWIDTH=256&MAXTILEHEIGHT=512";

AddWMSFeature(WMSUrl);

public void AddWMSFeature(String url) {
		try
		{
		
			com.intergraph.web.core.data.Project project = ApplicationContext.getProject();
			 
			com.intergraph.web.core.data.Theme myTheme = com.intergraph.web.core.data.Theme.createTheme("WMS", false, false);
			 project.addThemeToProject(null, myTheme);
			 
			 
			 com.intergraph.services.emea._2011._03.types.TilingInfo ti = new com.intergraph.services.emea._2011._03.types.TilingInfo();
			 ti.setColumns(0);
			 ti.setRows(0);
			 
			 com.intergraph.services.emea._2011._03.types.ScaleRange sr = new com.intergraph.services.emea._2011._03.types.ScaleRange();
			 sr.setFrom(new Long(0));
			 sr.setTo(new Long(150000));
			 
			 com.intergraph.services.emea._2011._03.types.ArrayOfDisplayRule listDr = new com.intergraph.services.emea._2011._03.types.ArrayOfDisplayRule();
			 com.intergraph.services.emea._2011._03.types.DisplayRule dr = new com.intergraph.services.emea._2011._03.types.DisplayRule();
			 dr.setName("DEFAULT");
			 dr.setSymbologyId("2c4af96e-d739-49a5-87d0-7e8f7459179d");
			 listDr.getDisplayRule().add(dr);
			 
			 com.intergraph.services.emea._2011._03.types.Feature feature = new com.intergraph.services.emea._2011._03.types.Feature();
			 feature.setId(100);
			 feature.setName("WMS");
			 feature.setDescription("WMS");
			 feature.setGeometryType(GeometryTypes.RASTER);
			 feature.setMapInterpretaionType(MapInterpretationTypes.DEFAULT);
			 feature.setKeyAttribute("ID1");
			 feature.setTilingInfo(ti);
			 
			 Bounds bounds = new Bounds();
			 Point northEast = new Point();
			 northEast.setX(1428544.0);
			 northEast.setY(4211414.0);
				
			 Point southWest = new Point();
			 southWest.setX(1401321.0);
			 southWest.setY(4178618.0);
				
			 bounds.setNorthEast(northEast);
			 bounds.setSouthWest(southWest);
			 feature.setBoundingBox(bounds);
			 
			 feature.setScaleRange(sr);
			 feature.setDisplayRules(listDr);
			 feature.setFitFactor(new Float(1.25));
			 feature.setOpacity(new Float(1));
			 java.util.Date date= new java.util.Date();
			 feature.setPublishTimestamp(date.getTime());
			 feature.setLoaderId("0d4a4b4e-cdc5-4494-94cd-19f90f606b03");
			 feature.setRightOnFeature(FeatureRight.VISIBLE);
			 feature.setCopyright("");
			 feature.setDataProjectName("BM_TEST");
			 feature.setIsSnapable(true);
			 //feature.setParentId(null);
			 feature.setUrlConnect(url);
			 feature.setEntity("FV_COMMU_S");
			 
			 
			 project.addFeature(feature, myTheme, 0);
		}
		catch (Exception e)
		{
			Log.getLogger().log(Level.SEVERE, e.getMessage(), e);
		}
	}

AddWMSFeaturesGMSC.PNG

 

 

Hopping it will be usefull for somebody else !

 

David Beguin

Highlighted
Staff
Posts: 950
Registered: ‎10-19-2015

Re: GMSC - Add WMS Layer programatically

looks great David! Thanks for sharing!

 

ciao,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Polls
Please register to vote
Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.