Last active
April 7, 2016 09:28
-
-
Save jusabatier/e495c178982195912415d96b86715a6f to your computer and use it in GitHub Desktop.
Handle Geoserver OGC service calls without params
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( $request_uri ~ ^/geoserver/(wms|wfs|wmts)$ ) { | |
set $test_ogc_request "G"; | |
} | |
if ( $args = '' ) { | |
set $test_ogc_request "${test_ogc_request}G"; | |
} | |
if ( $request_method = GET ) { | |
set $test_ogc_request "${test_ogc_request}G"; | |
} | |
if ($test_ogc_request = "GGG") { | |
rewrite ^/geoserver/(wms|wfs|wmts)$ /ogc-service.html?url=/geoserver/$1 permanent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.min.js"></script> | |
<script type="text/javascript"> | |
function getParamameter(key) { | |
var result = null, tmp = []; | |
var items = location.search.substr(1).split("&"); | |
for (var index = 0; index<items.length; index++) { | |
tmp = items[index].split("="); | |
if (tmp[0] === key) result = decodeURIComponent(tmp[1]); | |
} | |
return result; | |
} | |
var urlInfos = window.location.href.split("/"), | |
domainUrl = urlInfos[0] + "//" + urlInfos[2], | |
service = getParamameter("url"), | |
serviceUrl = domainUrl+service, | |
serviceType = service.split("/").slice(-1).pop(); | |
function mapfishRedirect() { | |
var json = '{"services":[{"owstype":"'+serviceType.toUpperCase()+'","owsurl":"'+serviceUrl+'"}]}', | |
form = '<form method="post" action="'+domainUrl+'/mapfishapp/"><input type="hidden" value=\''+json+'\' name="data" /></form>'; | |
$(form).appendTo("body").submit(); | |
} | |
$(function() { | |
$("#serviceName").append('<a href="'+serviceUrl+'">'+service+'</a>'); | |
$("#voir-carte").click(mapfishRedirect); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1 style="text-align: center;">Attention !</h1> | |
<p style="text-align: center;"> | |
Le service <span id="serviceName"></span> est fait pour être utilisé par des solutions SIG, et non directement dans un navigateur.<br/> | |
<br/> | |
Ces solutions peuvent être des logiciels de bureau comme : <br/> | |
<br/> | |
<a href="https://www.qgis.org/fr/site/" target="_blank">QGis</a><br/> | |
<a href="http://udig.refractions.net/" target="_blank">uDIG</a><br/> | |
<a href="http://openjump.org/" target="_blank">OpenJUMP</a><br/> | |
<a href="http://www.gvsig.com:9090/" target="_blank">GvSIG</a><br/> | |
<br/> | |
Ou bien via des visualiseurs web comme celui proposé par le GéoPortail du Velay :<br/> | |
<br/> | |
<a href="#" id="voir-carte">Afficher sur le GéoPortail du Velay</a> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment