Ignore:
Timestamp:
Jun 4, 2012, 12:21:19 PM (12 years ago)
Author:
djay
Message:

Small fix in MS Support, reproject extent to epsg:4326 when no authority name and code can be found. Thanks to Truong Xuan Quang for pointing this issue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal_ms.c

    r356 r357  
    125125  char* webService_url=(char*)malloc((strlen(msUrl->value)+strlen(format->value)+strlen(tmpI->name)+strlen(width->value)+strlen(height->value)+strlen(extent->value)+256)*sizeof(char));
    126126
    127   if(proto>0)
     127  if(proto>0){
     128    map* test=getMap(tmpI->content,"real_extent");
     129    if(test!=NULL)
     130        extent=test;
    128131    sprintf(webService_url,
    129132            "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
     
    140143            crs->value
    141144            );
    142   else
     145  }
     146  else{
     147    map* test=getMap(tmpI->content,"real_extent_reverse");
     148    if(test!=NULL)
     149        extent=test;
    143150    sprintf(webService_url,
    144151            "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",
     
    157164            crs->value
    158165            );
     166  }
    159167  addToMap(tmpI->content,"Reference",webService_url);
    160168
     
    224232      msInsertHashTable(&(m->web.metadata),"ows_srs", "EPSG:4326 EPSG:900913");
    225233      msInsertHashTable(&(myLayer->metadata),"ows_srs","EPSG:4326 EPSG:900913");
     234
     235      addToMap(output->content,"real_extent","true");
     236
    226237    }
    227238  }
     
    270281 
    271282  if(output!=NULL){
    272     sprintf(tmpExtent,"%f,%f,%f,%f",minX, minY, maxX, maxY);
    273     map* isGeo=getMap(output->content,"crs_isGeographic");
    274     fprintf(stderr,"isGeo = %s\n",isGeo->value);
    275     if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0)
    276       sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
    277     addToMap(output->content,"wms_extent",tmpExtent);
    278     sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",minX,minY,maxX,maxY);
    279     addToMap(output->content,"wcs_extent",tmpExtent);
     283    map* test=getMap(output->content,"real_extent");
     284    if(test!=NULL){
     285      pointObj min, max;
     286      projectionObj tempSrs;
     287     
     288      min.x = m->extent.minx;
     289      min.y = m->extent.miny;
     290      max.x = m->extent.maxx;
     291      max.y = m->extent.maxy;
     292      char tmpSrsStr[1024];
     293     
     294      msInitProjection(&tempSrs);
     295      msLoadProjectionStringEPSG(&tempSrs,"EPSG:4326");
     296     
     297      msProjectPoint(&(m->projection),&tempSrs,&min);
     298      msProjectPoint(&m->projection,&tempSrs,&max);
     299     
     300      sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x);
     301      addToMap(output->content,"wms_extent",tmpExtent);
     302      sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
     303      addToMap(output->content,"wcs_extent",tmpExtent);
     304     
     305    }else{
     306      sprintf(tmpExtent,"%f,%f,%f,%f",minX, minY, maxX, maxY);
     307      map* isGeo=getMap(output->content,"crs_isGeographic");
     308      fprintf(stderr,"isGeo = %s\n",isGeo->value);
     309      if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0)
     310        sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
     311      addToMap(output->content,"wms_extent",tmpExtent);
     312      sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",minX,minY,maxX,maxY);
     313      addToMap(output->content,"wcs_extent",tmpExtent);
     314    }
    280315  }
    281316
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png