ThinkGeo.com    |     Documentation    |     Premium Support

Maybe a bug?

 Hi,


I have a function that I call to return the bouding box of an InMemoryFeatureLayer features(all), the wellkonwn text is then returned to the client.  The client issue the command Map1.zoomToExtent.... but the map does not zoom in the way that I expect, not all data points inside the current visible bounding box???


 


 


 



  [MapActionFilter]
        public JsonResult ClientZoomToMarkers(Map map, GeoCollection<object> args)
        {
            JsonResult _JsonResult = null;
            Feature LocationFeature = new Feature();

            _redrawLayers.Clear();

            if (map != null)
            {
                LayerOverlay EXISTINGLOCATIONOverlay = (LayerOverlay)map.CustomOverlays["EXISTINGLOCATIONOverlay"];
                InMemoryFeatureLayer EXISTINGLOCATIONLayer = (InMemoryFeatureLayer)EXISTINGLOCATIONOverlay.Layers["EXISTINGLOCATIONLayer"];
                EXISTINGLOCATIONLayer.Open();
                string _bb = EXISTINGLOCATIONLayer.FeatureSource.GetBoundingBox().GetWellKnownText();
                EXISTINGLOCATIONLayer.Close();

                _JsonResult = Json(_DtoDomain.EnveloppeDto(_bb, _redrawLayers, new ErrorPayload { code = 0, message = "SUCCESS", status = "SUCCESS" }), JsonRequestBehavior.AllowGet);
            }
            else
            {
                _JsonResult = Json(_DtoDomain.EnveloppeDto(null, null, "ERROR"), null, null, JsonRequestBehavior.AllowGet);
            }
            return (_JsonResult);
        }

   
function ClientZoomToMarkers() {
    Map1.ajaxCallAction(_controllerId, 'ClientZoomToMarkers', {}, function (result) {
        var _Dto = jQuery.parseJSON(result.get_responseData());
        if (_Dto.status.status == "SUCCESS") {
            var format = new OpenLayers.Format.WKT();
            var feature = format.read(_Dto.payLoad).geometry;
            Map1.zoomToExtent(feature.getBounds(),true);
        }
        else {
            window.location.href = rootURL;
        }
    }
   );
}


Hi JM,


 
Thanks for your post, we tested with code mainly based on your post, but the problem didn’t show up
Attached is our sample, would you please check it and tell us what we missed?
 
Hope it helps
 

Johnny



Post11228.zip (165 KB)