fixed wfs parameters to MapServer

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gis-viewer@99424 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-09-03 12:52:28 +00:00
parent 2e9ae4bf18
commit ce7e76f3f5
2 changed files with 37 additions and 3 deletions

View File

@ -93,6 +93,7 @@ public class URLMakers {
String outputformat = null;
String srsName = null;
String boundingBox = bbox;
//CASE MAP SERVER
SERVERTYPE mapserverType = MapServerRecognize.recongnize(l);
@ -103,8 +104,10 @@ public class URLMakers {
GWT.log("wms url contains wxs is a map server? no appending /wfs ");
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, format);
srsName = "EPSG:4326";
boundingBox = reverseCoordinate(bbox, ",");
System.out.println("SERVERTYPE.MAPSERVER outputformat: "+outputformat);
System.out.println("SERVERTYPE.MAPSERVER srsName: "+srsName);
System.out.println("SERVERTYPE.MAPSERVER boundingBox: "+boundingBox);
}else {
GWT.log("is geoserver append /wfs");
link+="/wfs";
@ -130,8 +133,9 @@ public class URLMakers {
link +="?service=wfs&version=1.1.0"
+ "&REQUEST=GetFeature"
+ "&srsName="+srsName
+ "&TYPENAME=" + l.getLayer()
+ "&BBOX=" + bbox +
+ "&TYPENAME=" + l.getLayer()+
(boundingBox==null ? "" : "&BBOX="+boundingBox)+
// + "&BBOX=" + boundingBox +
(limit==0 ? "" : "&MAXFEATURES="+limit) +
(outputformat==null ? "" : "&OUTPUTFORMAT="+outputformat);
@ -145,6 +149,29 @@ public class URLMakers {
{"&","%26"},
};
/**
*
* @param BBOX
* @param split eg. ,
* @return a BBOX with reverse x and y coordinate
*/
public static String reverseCoordinate(String BBOX, String split){
if(BBOX==null || BBOX.isEmpty())
return BBOX;
String[] splitted = BBOX.split(split);
for (String string : splitted) {
System.out.println(string);
}
if(splitted.length==4){
return splitted[1]+split+splitted[0]+split+splitted[3]+split+splitted[2];
}else
return null;
}
public static String encodeUrl(String url) {
String urlNew = url;
@ -172,5 +199,12 @@ public class URLMakers {
return gsUrl;
}
public static void main(String[] args) {
String split =",";
String BBOX = "47.13134765625,2.87841796875,47.57080078125,3.31787109375";
System.out.println(URLMakers.reverseCoordinate(BBOX, split));
}
}

View File

@ -297,7 +297,7 @@ public class MapGeneratorUtils {
}
public static void main(String[] args) {
String LINK1 = "http://romeo.jrc.it/maps/mapserv.cgi?map=../mapfiles/acpmap_static.map&LAYERS=truemarble&TRANSPARENT=FALSE&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180,-90,180,90&WIDTH=1024&HEIGHT=768";
String LINK1 = "http://romeo.jrc.it/maps/mapserv.cgi?map=../mapfiles/acpmap_static.map&LAYERS=truemarble&TRANSPARENT=FALSE&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180,90,180,-90&WIDTH=1024&HEIGHT=768";
String LINK2 = "http://egip.brgm-rec.fr/wxs/?SERVICE=WMS&version=1.1.0&REQUEST=GetMap&LAYERS=HeatFlowUnit&BBOX=-14.52392578125,37.94677734375,43.70361328125,56.27197265625&WIDTH=1325&HEIGHT=417&SRS=EPSG:4326&FORMAT=image/png";
BufferedImage img1 = null;