11-29-2016
05:21 AM
- last edited on
11-29-2016
11:51 PM
by
jan.neumann
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
11-30-2016 12:11 AM
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
You can also simply track the POST request to the Apollo catalog while doing the bbox search and see what paramaters are being sent.
Regards,
Jan
11-30-2016 12:27 AM
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
11-30-2016
02:14 AM
- last edited on
11-30-2016
04:51 AM
by
jan.neumann
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.
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."); });
11-30-2016 04:53 AM
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?
12-05-2016 07:38 AM - edited 12-05-2016 07:39 AM
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