openlayers中获得geojson格式数据

    		function getGeoJson(layerName){
				//layerName="TJDG:PipePoint",
    			var parr = {
						REQUEST: "GetFeature",
		                typeName:layerName,
		                SERVICE: "WFS",
		                version:'1.0.0',
		                request:'GetFeature',
		                outputFormat:"json",
		                maxFeatures:1000
						};
					OpenLayers.loadURL("http://localhost:8080/geoserver/TJDG/ows", parr, this, succ, faill);
					function succ(response){
						var gmlParse = new OpenLayers.Format.GML();
						alert(response.responseText);
					}
					function faill(response){
						alert("无数据");
					}
    			}

转载自:https://blog.csdn.net/wt346326775/article/details/50492033

You may also like...