Skip to content

Commit

Permalink
Fix layer panel filtering
Browse files Browse the repository at this point in the history
- Filter obeys user permissions
- Filter by BBOX obeys SRID definition
- Add unit tests
  • Loading branch information
lucernae committed Oct 11, 2018
1 parent 76eb545 commit 1f2289f
Show file tree
Hide file tree
Showing 5 changed files with 755 additions and 27 deletions.
167 changes: 167 additions & 0 deletions tasks/tests/data/misc/flood_epsg_23833.geojson

Large diffs are not rendered by default.

307 changes: 307 additions & 0 deletions tasks/tests/data/misc/flood_epsg_23833.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
<?xml version="1.0" encoding="UTF-8"?>
<gmd:MD_Metadata xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" 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>None</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="eng" codeSpace="ISO 639-2">eng</gmd:LanguageCode>
</gmd:language>
<gmd:characterSet>
<gmd:MD_CharacterSetCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode" codeListValue="utf8" codeSpace="ISOTC211/19115">utf8</gmd:MD_CharacterSetCode>
</gmd:characterSet>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="ISOTC211/19115">dataset</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString/>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString/>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact" codeSpace="ISOTC211/19115">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp>
<gco:Date/>
</gmd:dateStamp>
<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:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>Jakarta Floods - 2018-02-24 16:08:11.013886+07:00</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date/>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication" codeSpace="ISOTC211/19115">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date/>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision" codeSpace="ISOTC211/19115">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date/>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation" codeSpace="ISOTC211/19115">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:identifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>None</gco:CharacterString>
</gmd:code>
</gmd:RS_Identifier>
</gmd:identifier>
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString/>
</gmd:abstract>
<gmd:credit>
<gco:CharacterString/>
</gmd:credit>
<gmd:status>
<gmd:MD_ProgressCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ProgressCode" codeListValue="revision" codeSpace="ISOTC211/19115">revision</gmd:MD_ProgressCode>
</gmd:status>
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString/>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString/>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact" codeSpace="ISOTC211/19115">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="continual" codeSpace="ISOTC211/19115">continual</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>Human health and safety</gco:CharacterString>
</gmd:keyword>
<gmd:type>
<gmd:MD_KeywordTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="theme" codeSpace="ISOTC211/19115">theme</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>GEMET - INSPIRE themes, version 1.0</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2008-06-01</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication" codeSpace="ISOTC211/19115">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
<gmd:resourceConstraints>
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString/>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="eng" codeSpace="ISO 639-2">eng</gmd:LanguageCode>
</gmd:language>
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>geoscientificInformation</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
<gmd:extent>
<gmd:EX_Extent>
</gmd:EX_Extent>
</gmd:extent>
<gmd:supplementalInformation>
<inasafe>
<hazard_category>
<gco:CharacterString>single_event</gco:CharacterString>
</hazard_category>
<thresholds>
<gco:Dictionary/>
</thresholds>
<continuous_hazard_unit>
<gco:CharacterString/>
</continuous_hazard_unit>
<inasafe_fields>
<gco:Dictionary>{&quot;hazard_value_field&quot;: &quot;state&quot;}</gco:Dictionary>
</inasafe_fields>
<inasafe_default_values>
<gco:Dictionary/>
</inasafe_default_values>
<scale>
<gco:CharacterString/>
</scale>
<source>
<gco:CharacterString>Hazard File</gco:CharacterString>
</source>
<layer_geometry>
<gco:CharacterString>polygon</gco:CharacterString>
</layer_geometry>
<value_map>
<gco:Dictionary>{&quot;road&quot;: {&quot;flood_hazard_classes&quot;: {&quot;active&quot;: false, &quot;classes&quot;: {&quot;dry&quot;: [0, 1], &quot;wet&quot;: [2, 3, 4]}}, &quot;flood_petabencana_hazard_classes&quot;: {&quot;active&quot;: true, &quot;classes&quot;: {&quot;high&quot;: [4], &quot;medium&quot;: [3], &quot;use_caution&quot;: [1], &quot;low&quot;: [2]}}}, &quot;place&quot;: {&quot;flood_hazard_classes&quot;: {&quot;active&quot;: false, &quot;classes&quot;: {&quot;dry&quot;: [0, 1], &quot;wet&quot;: [2, 3, 4]}}, &quot;flood_petabencana_hazard_classes&quot;: {&quot;active&quot;: true, &quot;classes&quot;: {&quot;high&quot;: [4], &quot;medium&quot;: [3], &quot;use_caution&quot;: [1], &quot;low&quot;: [2]}}}, &quot;land_cover&quot;: {&quot;flood_hazard_classes&quot;: {&quot;active&quot;: false, &quot;classes&quot;: {&quot;dry&quot;: [0, 1], &quot;wet&quot;: [2, 3, 4]}}, &quot;flood_petabencana_hazard_classes&quot;: {&quot;active&quot;: true, &quot;classes&quot;: {&quot;high&quot;: [4], &quot;medium&quot;: [3], &quot;use_caution&quot;: [1], &quot;low&quot;: [2]}}}, &quot;structure&quot;: {&quot;flood_hazard_classes&quot;: {&quot;active&quot;: false, &quot;classes&quot;: {&quot;dry&quot;: [0, 1], &quot;wet&quot;: [2, 3, 4]}}, &quot;flood_petabencana_hazard_classes&quot;: {&quot;active&quot;: true, &quot;classes&quot;: {&quot;high&quot;: [4], &quot;medium&quot;: [3], &quot;use_caution&quot;: [1], &quot;low&quot;: [2]}}}, &quot;population&quot;: {&quot;flood_hazard_classes&quot;: {&quot;active&quot;: false, &quot;classes&quot;: {&quot;dry&quot;: [0, 1], &quot;wet&quot;: [2, 3, 4]}}, &quot;flood_petabencana_hazard_classes&quot;: {&quot;active&quot;: true, &quot;classes&quot;: {&quot;high&quot;: [4], &quot;medium&quot;: [3], &quot;use_caution&quot;: [1], &quot;low&quot;: [2]}}}}</gco:Dictionary>
</value_map>
<hazard>
<gco:CharacterString>flood</gco:CharacterString>
</hazard>
<extra_keywords>
<gco:Dictionary/>
</extra_keywords>
<keyword_version>
<gco:CharacterString>4.3</gco:CharacterString>
</keyword_version>
<layer_purpose>
<gco:CharacterString>hazard</gco:CharacterString>
</layer_purpose>
<active_band>
<gco:Integer/>
</active_band>
<layer_mode>
<gco:CharacterString>classified</gco:CharacterString>
</layer_mode>
</inasafe>
</gmd:supplementalInformation>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<gmd:distributionInfo>
<gmd:MD_Distribution>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>unknown</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>unknown</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL/>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope>
<gmd:DQ_Scope>
<gmd:level>
<gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="ISOTC211/19115">dataset</gmd:MD_ScopeCode>
</gmd:level>
</gmd:DQ_Scope>
</gmd:scope>
<gmd:report>
<gmd:DQ_DomainConsistency>
<gmd:result>
<gmd:DQ_ConformanceResult>
<gmd:specification>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString/>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date/>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation" codeSpace="ISOTC211/19115">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:specification>
<gmd:explanation>
<gco:CharacterString>See the referenced specification</gco:CharacterString>
</gmd:explanation>
<gmd:pass>
<gco:Boolean>true</gco:Boolean>
</gmd:pass>
</gmd:DQ_ConformanceResult>
</gmd:result>
</gmd:DQ_DomainConsistency>
</gmd:report>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString/>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
<gmd:metadataMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="continual" codeSpace="ISOTC211/19115">continual</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
<gmd:maintenanceNote>
<gco:CharacterString>This record was generated by InaSAFE (http://inasafe.org)</gco:CharacterString>
</gmd:maintenanceNote>
</gmd:MD_MaintenanceInformation>
</gmd:metadataMaintenance>
</gmd:MD_Metadata>
2 changes: 1 addition & 1 deletion urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
),
url(
r'^analysis/layer-panel'
r'(?:/(?P<bbox>[\[\],.\d-]*))?',
r'(?:/(?P<bbox>[\[\] ,.\d-]*))?',
layer_panel,
name='layer-panel'
),
Expand Down
Loading

0 comments on commit 1f2289f

Please sign in to comment.