2

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 = "-12942776.251415756,5411282.980420768,-12942623.377359185,5411435.8544773385";

        // 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);

   SELECT @p
   UNION ALL
   SELECT geography::STPolyFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326); -- Calculated bbox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.