Developers Knowledge Base

Learn how to manipulate, modify, and tune your GeoMedia WebMap, Geospatial Portal and Consumer portal instances.
Showing results for 
Search instead for 
Do you mean 

FitLayer To Analysis

by Technical Evangelist on ‎09-09-2015 04:09 AM - edited on ‎02-07-2018 06:43 AM by Technical Evangelist (1,595 Views)

Problem

This example uses GJUtils library

Portal "fitLayer" on analyses zooms by default to the whole layer and not just to the resulting objects. What we need in some cases is to fit the query results to the bbox of the results and not the whole layer.

Solution

Code sample

Comments
by
on ‎12-26-2017 01:44 PM

I went to this page

https://bitbucket.org/HGDN/hgdn_webgis/src/cca36cff51a373f5f98cb3e7af629f6b54c681b8/KB_CodeExamples/...

and tried the example, but it did not zoom to the query.  It is still fitting the entire continental USA map.

Is there a way to zoom to the queryset rather than the whole feature?

Thanks,

Jane

 

example I retrieved is listed below:

 


var queryName = "Sample query";

$GP.ui.info("after zoom");
$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,
filters: [{
operator: "OR",
operands: [{
operator: "=",
operands: ["{http://www.intergraph.com/geomedia/gml}STATE_NAME", "Oklahoma"]
}, {
operator: "=",
operands: ["{http://www.intergraph.com/geomedia/gml}STATE_NAME", "Arkansas"]
}, {
operator: "=",
operands: ["{http://www.intergraph.com/geomedia/gml}STATE_NAME", "Alabama"]
}]
}],
},
function(result) {
$GP.queries.find({
analysisId: result.analysisId,
}, function(result2) {
result2.analysis.addToLegend();
result2.analysis.getData(function(getDataResult) {
$GP.map.zoom(gjutils.getBounds(getDataResult.data[0]));

});
});
});

Overview