Skip to content

Commit

Permalink
Add cluster layer fix and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
geographika committed Mar 27, 2021
1 parent 6acfe65 commit 8efe80b
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mapmetadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ xmlNodePtr msMetadataGetLayerMetadata(mapObj *map, metadataParamsObj *paramsObj,
if(strcasecmp(GET_LAYER(map, i)->name, paramsObj->pszLayer) == 0) {
layer_found = MS_TRUE;
layer = GET_LAYER(map, i);
// when checking a layer with clustering msLayerGetExtent does not have access
// to the source layer, so remove clustering first
if (layer->cluster.region) {
layer->cluster.region = NULL;
}
break;
}
}
Expand Down
51 changes: 51 additions & 0 deletions msautotest/mssql/cluster_mssql.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Test a clustered layer with the MSSQL driver plugin
#
# REQUIRES: OUTPUT=PNG
#
# RUN_PARMS: cluster_mssql.png [SHP2IMG] -m [MAPFILE] -i png -o [RESULT]
# RUN_PARMS: cluster_mssql_getmetadata.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&REQUEST=GetMetadata&LAYER=cities" > [RESULT_DEMIME]

MAP
NAME 'cluster_mssql'

SYMBOL
NAME "circle"
TYPE ellipse
POINTS 1 1 END
FILLED true
END

EXTENT -20026376.39 -20048966.10 20026376.39 20048966.10
UNITS METERS
SIZE 300 300
IMAGETYPE png24
LAYER
NAME 'cities'
INCLUDE 'include/mssql_connection.map'
TYPE POINT
PROCESSING "CLUSTER_ALGORITHM=SIMPLE"
PROCESSING "CLUSTER_GET_ALL_SHAPES=OFF"
PROCESSING "CLUSTER_KEEP_LOCATIONS=OFF"
INCLUDE 'include/mssql_connection.map'
STATUS ON
DATA "ogr_geometry from (select * from cities) as foo USING UNIQUE ogr_fid USING SRID=3857"
CLUSTER
MAXDISTANCE 50
REGION "ELLIPSE"
END
CLASSGROUP "Clustered"
CLASS
EXPRESSION ( "[Cluster_FeatureCount]" != "1" )
GROUP "Clustered"
STYLE
SYMBOL "circle"
SIZE 6
COLOR "#ffd966"
END
LABEL
TEXT "[Cluster_FeatureCount]"
END
END
END
END
Binary file added msautotest/mssql/expected/cluster_mssql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions msautotest/mssql/expected/cluster_mssql_getmetadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version="1.0"?>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd">
<gmd:fileIdentifier>
<gco:CharacterString>cities</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gco:CharacterString>en-US</gco:CharacterString>
</gmd:language>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeSpace="ISOTC211/19115" codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<gmd:contact>
<gmd:CI_ResponsibleParty id="contact">
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone/>
</gmd:phone>
<gmd:address>
<gmd:CI_Address/>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeSpace="ISOTC211/19115" codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp gco:nilReason="missing"/>
<gmd:metadataStandardName>
<gco:CharacterString>ISO 19115:2003 - Geographic information - Metadata</gco:CharacterString>
</gmd:metadataStandardName>
<gmd:metadataStandardVersion>
<gco:CharacterString>ISO 19115:2003</gco:CharacterString>
</gmd:metadataStandardVersion>
<gmd:spatialRepresentationInfo>
<gmd:MD_VectorSpatialRepresentation>
<gmd:topologyLevel>
<gmd:MD_TopologyLevelCode codeSpace="ISOTC211/19115" codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopologyLevelCode" codeListValue="geometryOnly">geometryOnly</gmd:MD_TopologyLevelCode>
</gmd:topologyLevel>
<gmd:geometricObjects>
<gmd:MD_GeometricObjects>
<gmd:geometricObjectType>
<gmd:MD_GeometricObjectTypeCode codeSpace="ISOTC211/19115" codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_GeometricObjectTypeCode" codeListValue="point">point</gmd:MD_GeometricObjectTypeCode>
</gmd:geometricObjectType>
</gmd:MD_GeometricObjects>
</gmd:geometricObjects>
</gmd:MD_VectorSpatialRepresentation>
</gmd:spatialRepresentationInfo>
<gmd:referenceSystemInfo>
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code gco:nilReason="missing"/>
<gmd:codeSpace>
<gco:CharacterString>http://www.epsg-registry.org</gco:CharacterString>
</gmd:codeSpace>
<gmd:version>
<gco:CharacterString>6.14</gco:CharacterString>
</gmd:version>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
</gmd:referenceSystemInfo>
<gmd:identificationInfo>
<gmd:MD_DataIdentification id="cities">
<gmd:citation>
<gmd:CI_Citation>
<gmd:title gco:nilReason="missing"/>
<gmd:date gco:nilReason="missing"/>
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract gco:nilReason="missing"/>
<gmd:language>
<gco:CharacterString>en-US</gco:CharacterString>
</gmd:language>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-19121268.705604</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>19864091.077433</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-7324485.585568</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>17378510.082818</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<gmd:distributionInfo>
<gmd:MD_Distribution>
<gmd:distributor>
<gmd:MD_Distributor>
<gmd:distributorContact>
<gmd:CI_ResponsibleParty id="distributorContact">
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone/>
</gmd:phone>
<gmd:address>
<gmd:CI_Address/>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeSpace="ISOTC211/19115" codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:distributorContact>
</gmd:MD_Distributor>
</gmd:distributor>
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:unitsOfDistribution>
<gco:CharacterString>KB</gco:CharacterString>
</gmd:unitsOfDistribution>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>service=WMS&amp;version=1.3.0&amp;request=GetMap&amp;width=500&amp;height=300&amp;styles=&amp;layers=cities&amp;format=image/png&amp;crs=&amp;bbox=-7324485.585568,-19121268.705604,17378510.082818,19864091.077433</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:DOWNLOAD-1.0-http-get-map</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>cities</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>PNG Format</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onLine>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>service=WMS&amp;version=1.3.0&amp;request=GetMap&amp;width=500&amp;height=300&amp;styles=&amp;layers=cities&amp;format=image/jpeg&amp;crs=&amp;bbox=-7324485.585568,-19121268.705604,17378510.082818,19864091.077433</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:DOWNLOAD-1.0-http-get-map</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>cities</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>JPEG Format</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onLine>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>service=WFS&amp;version=1.1.0&amp;request=GetFeature&amp;typename=cities&amp;outputformat=GML2</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:DOWNLOAD-1.0-http--download</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>cities</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>GML2 Format</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onLine>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>service=WFS&amp;version=1.1.0&amp;request=GetFeature&amp;typename=cities&amp;outputformat=GML3</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:DOWNLOAD-1.0-http--download</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>cities</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>GML3 Format</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
</gmd:MD_Metadata>

0 comments on commit 8efe80b

Please sign in to comment.