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
Highlighted
Contributor
Posts: 43
Registered: ‎07-12-2016
Accepted Solution

Is there a Geospatial Portal 2016 API method for zooming to a WMPS feature?

[ Edited ]

I found the example to zoom to an Apollo feature, which looks like:

 

function finish(response) {
 response.results[0].zoom(callback);
}

function example() {
 $GP.search({
 searchType: "apollo",
 keywords: "Cherokee"
 }, finish)
}

 

I want to do something similar on a WMPS feature, like this:

 

function finish(response) {
	response.featureId.zoom(callback);
}

function select() {
    $GP.selectedFeatures.add({
        featureId: featureId,
        featureClassId: featureClassId
    }, finish);
}

 

but I get the error:

 

         response.featureId.zoom is not a function

 

Is there another way of zooming to a WMPS feature?

 

Thanks.

Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: Is there a Geospatial Portal 2016 API method for zooming to a WMPS feature?

Hi Jason,

 

Yes, it looks like this method is not populated in the SDK. The selectedFeatures returns Feature object offering those methods (functions):

  • center
  • get_featureClassId
  • get_GeoJSON
  • get_id

 

To zoom to this feature, I would:

  1. Use get_GeoJSON
  2. Calculcate BBOX of this GeoJSON, for instance using this free JS library https://github.com/geosquare/geojson-bbox
  3. If needed, transform the coordinates to the map CRS
  4. Use $GP.map.zoom with the bbox parameter

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Contributor
Posts: 43
Registered: ‎07-12-2016

Re: Is there a Geospatial Portal 2016 API method for zooming to a WMPS feature?

Thanks Jan, this a good solution for now.

 

Regards,

Jason

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