** msWFSDumpLayer() */
| 538 | ** msWFSDumpLayer() |
| 539 | */ |
| 540 | int msWFSDumpLayer(mapObj *map, layerObj *lp) |
| 541 | { |
| 542 | rectObj ext; |
| 543 | const char *pszWfsSrs = NULL; |
| 544 | projectionObj poWfs; |
| 545 | int result = 0; |
| 546 | |
| 547 | msIO_printf(" <FeatureType>\n"); |
| 548 | |
| 549 | if (lp->name && strlen(lp->name) > 0 && |
| 550 | (msIsXMLTagValid(lp->name) == MS_FALSE || isdigit(lp->name[0]))) |
| 551 | msIO_fprintf(stdout, "<!-- WARNING: The layer name '%s' might contain spaces or " |
| 552 | "invalid characters or may start with a number. This could lead to potential problems. -->\n",lp->name); |
| 553 | |
| 554 | msOWSPrintEncodeParam(stdout, "LAYER.NAME", lp->name, OWS_WARN, |
| 555 | " <Name>%s</Name>\n", NULL); |
| 556 | |
| 557 | msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "FO", "title", |
| 558 | OWS_WARN, " <Title>%s</Title>\n", lp->name); |
| 559 | |
| 560 | msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "FO", "abstract", |
| 561 | OWS_NOERR, " <Abstract>%s</Abstract>\n", NULL); |
| 562 | |
| 563 | msOWSPrintEncodeMetadataList(stdout, &(lp->metadata), "FO", |
| 564 | "keywordlist", |
| 565 | " <Keywords>\n", |
| 566 | " </Keywords>\n", |
| 567 | " %s\n", NULL); |
| 568 | |
| 569 | /* In WFS, every layer must have exactly one SRS and there is none at */ |
| 570 | /* the top level contrary to WMS */ |
| 571 | /* */ |
| 572 | /* So here is the way we'll deal with SRS: */ |
| 573 | /* 1- If a top-level map projection (or wfs_srs metadata) is set then */ |
| 574 | /* all layers are advertized in the map's projection and they will */ |
| 575 | /* be reprojected on the fly in the GetFeature request. */ |
| 576 | /* 2- If there is no top-level map projection (or wfs_srs metadata) then */ |
| 577 | /* each layer is advertized in its own projection as defined in the */ |
| 578 | /* layer's projection object or wfs_srs metadata. */ |
| 579 | /* */ |
| 580 | if (msOWSGetEPSGProj(&(map->projection),&(map->web.metadata),"FO",MS_TRUE) != NULL) |
| 581 | { |
| 582 | /* Map has a SRS. Use it for all layers. */ |
| 583 | pszWfsSrs = msOWSGetEPSGProj(&(map->projection),&(map->web.metadata), "FO", MS_TRUE); |
| 584 | } |
| 585 | else |
| 586 | { |
| 587 | /* Map has no SRS. Use layer SRS or produce a warning. */ |
| 588 | pszWfsSrs = msOWSGetEPSGProj(&(lp->projection),&(lp->metadata), "FO", MS_TRUE); |
| 589 | } |
| 590 | |
| 591 | msOWSPrintEncodeParam(stdout, "(at least one of) MAP.PROJECTION, LAYER.PROJECTION or wfs_srs metadata", |
| 592 | pszWfsSrs, OWS_WARN, " <SRS>%s</SRS>\n", NULL); |
| 593 | |
| 594 | /* If layer has no proj set then use map->proj for bounding box. */ |
| 595 | if (msOWSGetLayerExtent(map, lp, "FO", &ext) == MS_SUCCESS) |
| 596 | { |
| 597 | msInitProjection(&poWfs); |
no test coverage detected