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
Regular Contributor
Posts: 209
Registered: ‎07-27-2016

Portal SDK: Apollo search always returns 10 items

[ Edited ]

Hi Jan,

 

Dont know if I am barking up the wrong tree,but I am basically trying to search apollo on a keyword and on the visible map area.

But the code is not returning the sme amound as if I would do it through the search erdas apollo catalog.

 

Code always returns 10 items...no matter where on the map...

 

var bbArea = $GP.map.info().bbox;


$GP.search({
searchType: "apollo",
keywords: "jpg",
profile: "full",
//classType: "com.erdas.rsp.babel.model.imagery.DatasetReference",
//addToMapEnabled: true,
//wmtsEnabled: true,
//ecwpEnabled: true,
//jpipEnabled: false,
//downladable: true,
//orderBy: "registrationDate desc",
//dateType: "1",
//startDate: "2008-06-19T00:00:00",
//endDate: "2016-06-25T23:59:59",
//cswQuery: null,
//start: 0,
limit: 100,
bbox: bbArea,
geometryType: "POLYGON"
}, function finish(response) {
$GP.ui.info("Found " + $GP.utils.serialize(response.results.length) + " items.");
});

 

Kind Regards

Jacques

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

Re: Portal SDK: Apollo search always returns 10 items

Hi Jacques,

 

The bbox parameter must be actually a closed polygon, so in case of simple rectangular BBOX you must specify the coordinates 5-times explicity instead of using simple rectangle defined by two points.

 

For example, instead of:

[x1, y1, x2, y2]

[-9406724, 4061127, -9404120, 4059483]

 

Use:

[x1,y1, x1, y2, x2, y2, x2, y1, x1, y1]

-9406724, 4061127, -9406724, 4059483, -9404120, 4059483, -9404120, 4061127, -9406724, 4061127

 

Untitled.png

 

You can also simply track the POST request to the Apollo catalog while doing the bbox search and see what paramaters are being sent.

Untitled.png

 

Regards,

Jan

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Regular Contributor
Posts: 209
Registered: ‎07-27-2016

Re: Portal SDK: Apollo search always returns 10 items

Hi Jan,

 

Thanks for the reply.

I noticed a bit earlier that $GP.map.info().bbox only returned 2 diagonally opposite points , I was under the impressions that it would returned a bounding box (closed polygon),so it makes sense why it would not have worked.

 

Thanks though for the nice explanation!!

 

Kind Regards

Jacques

Regular Contributor
Posts: 209
Registered: ‎07-27-2016

Re: Portal SDK: Apollo search always returns 10 items

[ Edited ]

Hi Jan,

 

What am I missing,According to me the script should return the same result as the search erdas apollo catalog.

But it seems like what ever I set the limit value to ... it returns that result.

 

As a test i copied the bbox values that was passed from search erdas apollo catalog to the script.

 

According to fiddler the result number returned was 29 , but the script was set to limit:100 and returned 100.

 

 Fiddler (002).PNG

 

Here is the test script :

 

//==VISIBLE MAP AREA(DIAGONAL POINTS)==
var DiagPoints = $GP.map.info().bbox;
//==SPLIT VALUES==
p_Val = DiagPoints.toString().split(",");
//==SET VARIABLES==
var x1 = p_Val[0];
var y1 = p_Val[1];
var x2 = p_Val[2];
var y2 = p_Val[3];

//==BUILD CLOSED POLYGON==
//c_Plgn = x1 + ", " + y1 + ", " + x1 + ", " + y2 + ", " + x2 + ", " + y2 + ", " + x2 + ", " + y1 + ", " + x1 + ", " + y1;

c_Plgn = "3149761.7807134953, -2968362.5227286597 ,3149761.7807134953, -2968120.969775993, 3150246.080947396,-2968120.969775993, 3150246.080947396,-2968362.5227286597";


$GP.search({
searchType: "apollo",
keywords: "JPG",
profile: "full",
classType: "com.erdas.rsp.babel.model.ResourceItem",
//addToMapEnabled: true,
//wmtsEnabled: true,
//ecwpEnabled: true,
//jpipEnabled: false,
//downladable: true,
//orderBy: "registrationDate desc",
dateType: "1",
//startDate: "2008-06-19T00:00:00",
//endDate: "2016-06-25T23:59:59",
//cswQuery: null,
start: 0,
limit: 100,
bbox: [c_Plgn],
geometryType: "POLYGON"
}, function finish(response) {
$GP.ui.info("Found " + $GP.utils.serialize(response.results.length) + " items.");
});
Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: Portal SDK: Apollo search always returns 10 items

I can see in the response totalAvailableResults: 29, maybe you should rather check this property.

 

But I wonder what are the results 30-100? Aren't those empty arrays?

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

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

Re: Portal SDK: Apollo search always returns 10 items

[ Edited ]

Hi Jacques,

 

From the file I received from you I can apparently see exactly 100 results that look different one from each other.

 

Perhaps you should watch what is being sent by Portal in POST request when using the Search panel and compare it to your search settings and criteria. Perhaps we still have the bbox definition incorrect?

 

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

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