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: 46
Registered: ‎04-14-2016
Accepted Solution

Zoom to pin, after spatial query SDK

[ Edited ]

 Hello,

 

I have a question about zooming on a pin after query operation. My code look like this:                                       

 

 

 

   function(queryResult)
                                            {
                                                $GP.queries.find({analysisId: queryResult.analysisId},
                                                function(findAnalysisResult)     {
                                                    findAnalysisResult.analysis.getData(function(getDataResult)
                                                    {\
                                                        if(getDataResult.data[0].features.length>0)
                                                        {
                                                            renderPins(getDataResult.data[0]);

                                                        }
                                                    else $GP.ui.info("Izabrana parcela nije pronadjena");
                                                    });
                                                                                },
function(e) { console.log(e);});


                                            }

 

 

Does anyone have an idea about of how can i zoom on pin?

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

Re: Zoom to pin, after spatial query SDK

Hi Mladen,

 

How about...

  1. Getting BBOX of the search results - you can utilize GJUtils for that
  2. $GP.map.zoom(bbox)

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Contributor
Posts: 46
Registered: ‎04-14-2016

Re: Zoom to pin, after spatial query SDK

How can i get bbox from my example?

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

Re: Zoom to pin, after spatial query SDK

Something like

$GP.queries.find({
   analysisId: result.analysisId,
}, function(result2) {
   result2.analysis.addToLegend();
   result2.analysis.getData(function(getDataResult) {
       $GP.map.zoom(gjutils.getBounds(getDataResult.data[0]));
   });
});
Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Contributor
Posts: 46
Registered: ‎04-14-2016

Re: Zoom to pin, after spatial query SDK

Thank you! It is working for me! But, I have another problem. I wrote about it in another topic.

 

https://community.hexagongeospatial.com/t5/Developer-Discussions/Repeating-search-results-geoportal-...