# MsSql Create bbox of a point proportional to image height and width

• ### Question

• User-1447802497 posted

Short question is how do I create bbox dimensions that is proportional to image height and width?

I'm working on a asp.net webservice to generate a map using geoserver. The parameters I have are Point, Width and Height of Image, and zoom level.

My need to calculate the bbox size and position based on the point and the height and width of the parameters.

```    public void MapCreate( string Point, int Width, int Height, int ZoomLevel )     {         // Calculate bbox using sql or c#         string bbox = spCalculateFromBBox();         // Url for GeoServer         string url = string.Format( "/wms?service=WMS&version=1.1.0&request=GetMap&layers=vvv:ccc&styles=&bbox={0}&width=432&height=468&srs=EPSG:3857&format=image/png", bbox, Width, Height );     } ```

I was thinking it might be easier to do this in mssql but I have no idea on how to pursue on this.

```-- SP Parameters
DECLARE @ImgWidth INT;
DECLARE @ImgHeight INT;
DECLARE @Zoom INT;
SET @ImgWidth = 400;
SET @ImgHeight = 600;
SET @Zoom = 10;

DECLARE @p geography;
SET @p = geography::Point(40, -40, 4326);

-- Calculated bbox from Point with Width and Height
SELECT '-12942776.251415756,5411282.980420768,-12942623.377359185,5411435.8544773385'```

Wednesday, March 30, 2016 2:08 PM

### All replies

• User1009646345 posted

Hi kathyjudd75,

#### kathyjudd75

I was thinking it might be easier to do this in mssql but I have no idea on how to pursue on this.

Could you please provide the algorithm.

in addition, it's a GIS issue, you could also post your issue on the following for some support about algorithm

http://gis.stackexchange.com/questions

Thursday, April 7, 2016 1:37 AM