Tag Archives: geoserver

Openlayer 保存错误 – outside of (-180.0,180.0)

先给出错误信息

An error occured while operating the transaction,detail: org.geotools.referencing.operation.projection.PointOutsideEnvelopeException: 229.37199228042 outside of (-180.0,180.0)
Parsing failed for LineString: org.geoserver.wfs.WFSException: org.geotools.referencing.operation.projection.PointOutsideEnvelopeException: 229.37199228042 outside of (-180.0,180.0)
org.geotools.referencing.operation.projection.PointOutsideEnvelopeException: 229.37199228042 outside of (-180.0,180.0)
229.37199228042 outside of (-180.0,180.0)

解决方法:
给你的地图加一个界限

layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                        "http://map.local:28080/geoserver/Test/wms", {layers: 'Test:Test'} );
    
                vlayer = new OpenLayers.Layer.Vector( "Editable" );
                graticuleCtl = new OpenLayers.Control.Graticule({
                    numPoints: 2, 
                    labelled: true
                });
                map = new OpenLayers.Map( 'map', {
                    controls: [
						graticuleCtl,
                        new OpenLayers.Control.PanZoom(),
                        new OpenLayers.Control.EditingToolbar(vlayer)
                    ],
                    zoomOffset:14,
                    maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
					restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
                });
                
                var nav = new OpenLayers.Control.NavigationHistory();
                // parent control must be added to the map
                map.addControl(nav);

                
                map.events.register('zoomend', map, function(e){
					if(map.getZoom()<3){
						//map.zoomTo(3);
						nav.previousTrigger();
					}
				});
                
                
                
                
                map.addLayers([layer, vlayer]);
    
                //map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
                map.zoomToMaxExtent();
				map.setCenter(new OpenLayers.LonLat(110, 0), 5);

使用geoserver-manager 删除一个layer

代码如下:(包括删除一个layer和它的store)

String geoserverURL = "http://localhost:8080/geoserver";
String geoserverUser = "admin";
String geoserverPassword = "geoserver";
new GeoServerRESTPublisher(geoserverURL, geoserverUser, geoserverPassword).removeDatastore("workspaceName", "storeName", true);
//		
new GeoServerRESTPublisher(geoserverURL, geoserverUser, geoserverPassword).removeCoverageStore("workspaceName", "storeName", true);

removeDatastore是用来删除shp等类型layer的方法
removeCoverageStore是用来删除图片类型layer的方法