提交 2af08eb596b54cd4cc8e7da21bca393d1e96733a
Merge branch 'master' of http://gitlab.ctune.cn/DMapServer/DMapServer4.1
正在显示
4 个修改的文件
包含
21 行增加
和
14 行删除
| ... | ... | @@ -64,7 +64,7 @@ namespace DmpWfs |
| 64 | 64 | rootname = "WFS_Capabilities"; |
| 65 | 65 | xmlRoot.add("<xmlattr>.xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"); |
| 66 | 66 | xmlRoot.add("<xmlattr>.xmlns","http://www.opengis.net/wfs"); |
| 67 | - xmlRoot.add("<xmlattr>.ogc","http://www.ogc.net/wfs"); | |
| 67 | + xmlRoot.add("<xmlattr>.xmlns:ogc","http://www.ogc.net/wfs"); | |
| 68 | 68 | xmlRoot.add("<xmlattr>.xmlns:sld","http://www.opengis.net/sld"); |
| 69 | 69 | xmlRoot.add("<xmlattr>.xsi:schemaLocation","http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd"); |
| 70 | 70 | xmlRoot.add("<xmlattr>.version", version); |
| ... | ... | @@ -160,7 +160,7 @@ namespace DmpWfs |
| 160 | 160 | if (pPgsqlConn != nullptr) |
| 161 | 161 | { |
| 162 | 162 | boost::property_tree::ptree ptFeatureType; |
| 163 | - std::string srs = "EPSG:" + std::__cxx11::to_string(project->crs().srid()); | |
| 163 | + std::string srs = "EPSG:" + layer->srid(); | |
| 164 | 164 | ptFeatureType.add("<xmlattr>.id", i); |
| 165 | 165 | ptFeatureType.add("Name", layer->name()); |
| 166 | 166 | ptFeatureType.add("Title", layer->title()); | ... | ... |
| ... | ... | @@ -591,12 +591,20 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 591 | 591 | std::string sql = format(ss.c_str(), layer->schema().c_str(), tableName.c_str()); |
| 592 | 592 | |
| 593 | 593 | string shapeName = layer->geom(); |
| 594 | - // WHERE \"%s\" && \'BOX3D(%lf %lf,%lf %lf)\'::box3d | |
| 595 | - //sql += format(" ST_DWithin(\"%s\", ST_GeometryFromText('POINT(%f %f)',%s),%f) limit %d ", | |
| 596 | - // shapeName.c_str(), x, y,layer->srid().c_str(), dis, feature_count); | |
| 597 | - | |
| 598 | - sql += format(" \"%s\" && \'BOX3D(%lf %lf,%lf %lf)\'::box3d limit %d ", | |
| 594 | + if(!layer->srid().empty() && layer->srid().length()==4) | |
| 595 | + { | |
| 596 | + // WHERE \"%s\" && \'BOX3D(%lf %lf,%lf %lf)\'::box3d | |
| 597 | + sql += format(" ST_DWithin(\"%s\", ST_GeometryFromText('POINT(%f %f)',%s),%f) limit %d ", | |
| 598 | + shapeName.c_str(), x, y,layer->srid().c_str(), dis, feature_count); | |
| 599 | + } | |
| 600 | + else | |
| 601 | + { | |
| 602 | + sql += format(" \"%s\" && \'BOX3D(%lf %lf,%lf %lf)\'::box3d limit %d ", | |
| 599 | 603 | shapeName.c_str(), x - dis, y - dis, x + dis, y + dis, feature_count); |
| 604 | + } | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 600 | 608 | |
| 601 | 609 | |
| 602 | 610 | //cout<<sql.c_str() <<endl; |
| ... | ... | @@ -612,9 +620,9 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 612 | 620 | |
| 613 | 621 | double x0 = (x - m_dXdis) / m_dR; |
| 614 | 622 | double y0 = (m_dYdis - y) / m_dR; |
| 615 | - double dis = 1 / m_dR; | |
| 623 | + double dis = 2 / m_dR; | |
| 616 | 624 | |
| 617 | - for (int i = (int)(m_vLayers.size()) - 1; i >= 0; i--) | |
| 625 | + for (int i = 0; i < m_vLayers.size(); i++) | |
| 618 | 626 | { |
| 619 | 627 | DmpVectorLayer *layer = (DmpVectorLayer *)m_vLayers[i]; |
| 620 | 628 | |
| ... | ... | @@ -632,7 +640,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 632 | 640 | string layerName = layer->name(); |
| 633 | 641 | if (pPgsqlConn->ExecWaitBinary(sql)) |
| 634 | 642 | { |
| 635 | - if(pPgsqlConn->GetRowCount()>0 || i==0) | |
| 643 | + if(pPgsqlConn->GetRowCount()>0 || i== m_vLayers.size()-1) | |
| 636 | 644 | { |
| 637 | 645 | string srid = std::__cxx11::to_string(layer->crs().srid()); |
| 638 | 646 | mapserver::DmpMapServerUtil::responseGeojson(pPgsqlConn, responseData, layerName, srid); |
| ... | ... | @@ -1078,7 +1086,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 1078 | 1086 | } |
| 1079 | 1087 | else |
| 1080 | 1088 | { |
| 1081 | - sql = GetRegionQuerySQL(layer, pExtent.get(), format("%d", layer->crs().srid()), strRegionLayerNameDefs, strRegionColDefs, strLayerDef); | |
| 1089 | + sql = GetRegionQuerySQL(layer, pExtent.get(), layer->srid(), strRegionLayerNameDefs, strRegionColDefs, strLayerDef); | |
| 1082 | 1090 | } |
| 1083 | 1091 | |
| 1084 | 1092 | pVectorVacuateLayer = layer->GetCurrentScaleTable(1 / this->m_dR); |
| ... | ... | @@ -1274,7 +1282,7 @@ ST_GeometryFromText('POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))',%s),\ |
| 1274 | 1282 | } |
| 1275 | 1283 | else |
| 1276 | 1284 | { |
| 1277 | - sql = GetRegionQuerySQL(layer, pExtent.get(), format("%d", layer->crs().srid()), strRegionLayerNameDefs, strRegionColDefs, strLayerDef); | |
| 1285 | + sql = GetRegionQuerySQL(layer, pExtent.get(), layer->srid(), strRegionLayerNameDefs, strRegionColDefs, strLayerDef); | |
| 1278 | 1286 | } |
| 1279 | 1287 | |
| 1280 | 1288 | pVectorVacuateLayer = layer->GetCurrentScaleTable(1 / this->m_dR); | ... | ... |
请
注册
或
登录
后发表评论