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

Function msSOSAddMemberNode

mapogcsos.c:669–913  ·  view source on GitHub ↗

/ msSOSAddMemberNode */ / Add a memeber node corresponding to a feature. */ Assuming that the layer is opened and msLayerGetItems is */ called on it. */ /

Source from the content-addressed store, hash-verified

667/* called on it. */
668/************************************************************************/
669void msSOSAddMemberNode(xmlNsPtr psNsGml, xmlNsPtr psNsOm, xmlNsPtr psNsSwe, xmlNsPtr psNsXLink, xmlNsPtr psNsMs, xmlNodePtr psParent, mapObj *map, layerObj *lp,
670 int iFeatureId, const char *script_url, const char *opLayerName)
671{
672 xmlNodePtr psObsNode, psNode, psSubNode, psLayerNode = NULL;
673 const char *pszEpsg = NULL, *pszValue = NULL;
674 int status,i,j;
675 shapeObj sShape;
676 char szTmp[256];
677 layerObj *lpfirst = NULL;
678 const char *pszTimeField = NULL;
679 char *pszTmp = NULL;
680 char *pszOid = NULL;
681 char *pszTime = NULL;
682 char *pszValueShape = NULL;
683 const char *pszFeatureId = NULL;
684
685 if (psParent)
686 {
687 msInitShape(&sShape);
688
689 status = msLayerGetShape(lp, &sShape, &(lp->resultcache->results[iFeatureId]));
690 if(status != MS_SUCCESS) {
691 xmlFreeNs(psNsOm);
692 return;
693 }
694
695 psNode = xmlNewChild(psParent, NULL, BAD_CAST "member", NULL);
696
697 psObsNode = xmlNewChild(psNode, NULL, BAD_CAST "Observation", BAD_CAST pszValue);
698
699 pszFeatureId = msOWSLookupMetadata(&(lp->metadata), "OSG", "featureid");
700
701 if(pszFeatureId && msLayerGetItems(lp) == MS_SUCCESS)
702 { /* find the featureid amongst the items for this layer */
703 for(j=0; j<lp->numitems; j++) {
704 if(strcasecmp(lp->items[j], pszFeatureId) == 0) { /* found it */
705 break;
706 }
707 }
708 if (j<lp->numitems) {
709 pszOid = msStringConcatenate(pszOid, "o_");
710 pszOid = msStringConcatenate(pszOid, sShape.values[j]);
711 xmlNewNsProp(psObsNode, psNsGml, BAD_CAST "id", BAD_CAST pszOid);
712 }
713 }
714
715 /* order of elements is time, location, procedure, observedproperty
716 featureofinterest, result */
717
718 /* time*/
719 pszTimeField = msOWSLookupMetadata(&(lp->metadata), "SO",
720 "timeitem");
721 if (pszTimeField && sShape.values)
722 {
723 for(i=0; i<lp->numitems; i++)
724 {
725 if (strcasecmp(lp->items[i], pszTimeField) == 0)
726 {

Callers 1

msSOSGetObservationFunction · 0.85

Calls 15

msInitShapeFunction · 0.85
msLayerGetShapeFunction · 0.85
msOWSLookupMetadataFunction · 0.85
msLayerGetItemsFunction · 0.85
strcasecmpFunction · 0.85
msStringConcatenateFunction · 0.85
msGML3TimeInstantFunction · 0.85
msFreeFunction · 0.85
msLayerOpenFunction · 0.85
msEncodeHTMLEntitiesFunction · 0.85
msLayerCloseFunction · 0.85

Tested by

no test coverage detected