Commit 4bd72a7da2b4b5ad2db799546291d7fffc640418
1 parent
34c6b428
Exists in
master
and in
7 other branches
--no commit message
Showing
4 changed files
with
42 additions
and
6 deletions
Show diff stats
pacotes/cswclient/csw.html
| ... | ... | @@ -28,6 +28,8 @@ |
| 28 | 28 | </select> |
| 29 | 29 | <input type="text" name="query" value="" size="24"/> |
| 30 | 30 | <p/> |
| 31 | + Região (xmin ymin xmax ymax): <input type="text" name="bbox" value="-180 -90 180 90" size="24"/> | |
| 32 | + <p/> | |
| 31 | 33 | <span id="csw-hosts"></span> |
| 32 | 34 | <select id="schema" name="schema"> |
| 33 | 35 | <option value="http://www.opengis.net/cat/csw/2.0.2">csw:Record</option> |
| ... | ... | @@ -46,7 +48,7 @@ |
| 46 | 48 | <!--input type="hidden" name="schema" value="http://www.isotc211.org/2005/gmd"/--> |
| 47 | 49 | <!--input type="hidden" name="displaymode" value="html"/--> |
| 48 | 50 | <input type="button" value="limpar" onClick="javascript:void(csw_client.clearPage())"/> |
| 49 | - <input type="button" value="pesquisar" onClick="javascript:void(csw_client.getRecords())"/> | |
| 51 | + <input type="button" value="pesquisar" onClick="javascript:void(csw_client.clearResposta());void(csw_client.getRecords())"/> | |
| 50 | 52 | </form> |
| 51 | 53 | </div> |
| 52 | 54 | ... | ... |
pacotes/cswclient/lib/scripts/cswclient.js
| ... | ... | @@ -109,6 +109,16 @@ CSWClient.prototype.getRecords = function(start) |
| 109 | 109 | |
| 110 | 110 | var operator = document.theForm.operator.value; |
| 111 | 111 | var query = trim(document.theForm.query.value); |
| 112 | + var bbox = document.theForm.bbox.value; | |
| 113 | + if (bbox == ""){ | |
| 114 | + var lowerCorner = ""; | |
| 115 | + var upperCorner = "" | |
| 116 | + } | |
| 117 | + else{ | |
| 118 | + bbox = bbox.split(" "); | |
| 119 | + var lowerCorner = bbox[1]+" "+bbox[0]; | |
| 120 | + var upperCorner = bbox[3]+" "+bbox[2]; | |
| 121 | + } | |
| 112 | 122 | if (operator == "contains" & query != "") {query = "%" + query + "%";} |
| 113 | 123 | |
| 114 | 124 | var schema = "http://www.opengis.net/cat/csw/2.0.2"; // force outputSchema always to csw:Record for GetRecords requests |
| ... | ... | @@ -119,13 +129,16 @@ CSWClient.prototype.getRecords = function(start) |
| 119 | 129 | this.setXpathValue(this.defaults_xml, "/defaults/startposition", start + ''); |
| 120 | 130 | var sortby = document.theForm.sortby.value; |
| 121 | 131 | this.setXpathValue(this.defaults_xml, "/defaults/sortby", sortby + ''); |
| 122 | - | |
| 132 | + if (bbox != ""){ | |
| 133 | + this.setXpathValue(this.defaults_xml, "/defaults/lowerCorner", lowerCorner + ''); | |
| 134 | + this.setXpathValue(this.defaults_xml, "/defaults/upperCorner", upperCorner + ''); | |
| 135 | +} | |
| 123 | 136 | var processor = new XSLTProcessor(); |
| 124 | 137 | processor.importStylesheet(this.getrecords_xsl); |
| 125 | 138 | |
| 126 | 139 | var request_xml = processor.transformToDocument(this.defaults_xml); |
| 127 | 140 | var request = new XMLSerializer().serializeToString(request_xml); |
| 128 | - | |
| 141 | + //alert(request);return; | |
| 129 | 142 | csw_response = this.sendCSWRequest(request); |
| 130 | 143 | var results = "<results><request start=\"" + start + "\""; |
| 131 | 144 | results += " maxrecords=\""; |
| ... | ... | @@ -227,7 +240,12 @@ CSWClient.prototype.setXpathValue = function(_a,_b,_c) |
| 227 | 240 | return false; |
| 228 | 241 | } |
| 229 | 242 | }; |
| 230 | - | |
| 243 | +CSWClient.prototype.clearResposta = function() | |
| 244 | +{ | |
| 245 | + var outputDiv = document.getElementById("csw-output"); | |
| 246 | + outputDiv.innerHTML = "Aguarde..."; | |
| 247 | + this.hideDiv(document.getElementById('popup')) | |
| 248 | +} | |
| 231 | 249 | |
| 232 | 250 | CSWClient.prototype.clearPage = function() |
| 233 | 251 | { | ... | ... |
pacotes/cswclient/lib/xml/defaults.xml
| ... | ... | @@ -4,11 +4,12 @@ |
| 4 | 4 | <startposition>1</startposition> |
| 5 | 5 | <outputformat>application/xml</outputformat> |
| 6 | 6 | <outputschema>http://www.opengis.net/cat/csw/2.0.2</outputschema> |
| 7 | -<!--outputschema>http://www.isotc211.org/2005/gmd</outputschema--> | |
| 8 | 7 | <resulttype>results</resulttype> |
| 9 | 8 | <propertyname>AnyText</propertyname> |
| 10 | 9 | <literal></literal> |
| 11 | 10 | <sortby></sortby> |
| 12 | 11 | <sortorder>ASC</sortorder> |
| 13 | 12 | <id></id> |
| 13 | +<lowerCorner></lowerCorner> | |
| 14 | +<upperCorner></upperCorner> | |
| 14 | 15 | </defaults> | ... | ... |
pacotes/cswclient/lib/xsl/getrecords.xsl
| ... | ... | @@ -41,7 +41,21 @@ |
| 41 | 41 | <xsl:if test="./literal !=''"> |
| 42 | 42 | <csw:Constraint version="1.1.0"> |
| 43 | 43 | <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"> |
| 44 | - <ogc:PropertyIsLike escape="\" singleChar="_" wildCard="%"> | |
| 44 | + <ogc:And> | |
| 45 | + <xsl:if test="./lowerCorner !=''"> | |
| 46 | + <ogc:Intersects> | |
| 47 | + <ogc:PropertyName>iso:BoundingBox</ogc:PropertyName> | |
| 48 | + <gml:Envelope xmlns:gml="http://www.opengis.net/gml"> | |
| 49 | + <gml:lowerCorner> | |
| 50 | + <xsl:value-of select="./lowerCorner"/> | |
| 51 | + </gml:lowerCorner> | |
| 52 | + <gml:upperCorner> | |
| 53 | + <xsl:value-of select="./upperCorner"/> | |
| 54 | + </gml:upperCorner> | |
| 55 | + </gml:Envelope> | |
| 56 | + </ogc:Intersects> | |
| 57 | + </xsl:if> | |
| 58 | + <ogc:PropertyIsLike escape="\" singleChar="_" wildCard="%"> | |
| 45 | 59 | <ogc:PropertyName> |
| 46 | 60 | <xsl:value-of select="./propertyname"/> |
| 47 | 61 | </ogc:PropertyName> |
| ... | ... | @@ -49,6 +63,7 @@ |
| 49 | 63 | <xsl:value-of select="./literal"/> |
| 50 | 64 | </ogc:Literal> |
| 51 | 65 | </ogc:PropertyIsLike> |
| 66 | + </ogc:And> | |
| 52 | 67 | </ogc:Filter> |
| 53 | 68 | </csw:Constraint> |
| 54 | 69 | </xsl:if> | ... | ... |