MCPcopy Index your code
hub / github.com/MapServer/MapServer / msSOSReturnMemberResult

Function msSOSReturnMemberResult

mapogcsos.c:922–1005  ·  view source on GitHub ↗

/ msSOSReturnMemberResult */ / Add a result string to the result node (used for */ GetObservation using "observation" as the response output. */ Assuming here that the layer is already opened. */ /

Source from the content-addressed store, hash-verified

920/* Assuming here that the layer is already opened. */
921/************************************************************************/
922char* msSOSReturnMemberResult(layerObj *lp, int iFeatureId, char **ppszProcedure)
923{
924 char *pszFinalValue = NULL;
925 shapeObj sShape;
926 int i, j, status;
927 layerObj *lpfirst;
928 const char *pszTimeField = NULL, *pszValue=NULL, *pszProcedureField=NULL;
929 char *pszValueShape = NULL;
930 char szTmp[100];
931 const char *pszSep=NULL;
932
933 msInitShape(&sShape);
934 status = msLayerGetShape(lp, &sShape, &(lp->resultcache->results[iFeatureId]));
935 if(status != MS_SUCCESS)
936 return NULL;
937
938 pszTimeField = msOWSLookupMetadata(&(lp->metadata), "SO", "timeitem");
939 if (pszTimeField && sShape.values)
940 {
941 for(i=0; i<lp->numitems; i++)
942 {
943 if (strcasecmp(lp->items[i], pszTimeField) == 0)
944 {
945 pszFinalValue = msStringConcatenate(pszFinalValue, sShape.values[i]);
946 break;
947 }
948 }
949 }
950 if (ppszProcedure)
951 {
952 pszProcedureField = msOWSLookupMetadata(&(lp->metadata), "S", "procedure_item");
953 for(i=0; i<lp->numitems; i++)
954 {
955 if (strcasecmp(lp->items[i], pszProcedureField) == 0)
956 {
957 (*ppszProcedure) = msStrdup( sShape.values[i]);
958 break;
959 }
960 }
961 }
962
963 /* the first layer is the one that has to have all the metadata defined */
964 lpfirst = msSOSGetFirstLayerForOffering(lp->map,
965 msOWSLookupMetadata(&(lp->metadata), "S",
966 "offering_id"),
967 msOWSLookupMetadata(&(lp->metadata), "S",
968 "observedproperty_id"));
969
970
971 if (lp == lpfirst || (lpfirst && msLayerOpen(lpfirst) == MS_SUCCESS &&
972 msLayerGetItems(lpfirst) == MS_SUCCESS))
973 {
974 pszSep = msOWSLookupMetadata(&(lp->map->web.metadata), "S",
975 "encoding_tokenSeparator");
976 for(i=0; i<lpfirst->numitems; i++)
977 {
978 snprintf(szTmp, sizeof(szTmp), "%s_alias", lpfirst->items[i]);
979 pszValue = msOWSLookupMetadata(&(lpfirst->metadata), "S", szTmp);

Callers 1

msSOSGetObservationFunction · 0.85

Calls 11

msInitShapeFunction · 0.85
msLayerGetShapeFunction · 0.85
msOWSLookupMetadataFunction · 0.85
strcasecmpFunction · 0.85
msStringConcatenateFunction · 0.85
msStrdupFunction · 0.85
msLayerOpenFunction · 0.85
msLayerGetItemsFunction · 0.85
msEncodeHTMLEntitiesFunction · 0.85
msFreeFunction · 0.85

Tested by

no test coverage detected