## grits-wms grits-wms — Web Map Service |

## Synopsis

                        GritsWms;
    gchar *             grits_wms_fetch                     (GritsWms *wms,
                                                             GritsTile *tile,
                                                             GritsCacheType mode,
                                                             GritsChunkCallback callback,
                                                             gpointer user_data);
    void                grits_wms_free                      (GritsWms *wms);
    GritsWms *          grits_wms_new                       (const gchar *uri_prefix,
                                                             const gchar *uri_layer,
                                                             const gchar *uri_format,
                                                             const gchar *prefix,
                                                             const gchar *extension,
                                                             gint width,
                                                             gint height);

## Description

Provides an API for accessing image tiles form a Web Map Service (WMS) server. GritsWms integrates closely with GritsTile. The remote server must support the EPSG:4326 cartographic projection.

## Details

### GritsWms

    typedef struct {
    	GritsHttp *http;
    	gchar *uri_prefix;
    	gchar *uri_layer;
    	gchar *uri_format;
    	gchar *extension;
    	gint   width;
    	gint   height;
    } GritsWms;

### grits_wms_fetch ()

    gchar *             grits_wms_fetch                     (GritsWms *wms,
                                                             GritsTile *tile,
                                                             GritsCacheType mode,
                                                             GritsChunkCallback callback,
                                                             gpointer user_data);

Fetch a image coresponding to a GritsTile from a WMS server.

`wms` : | the GritsWms to fetch the data from
`tile` : | a GritsTile representing the area to be fetched
`mode` : | the update type to use when fetching data
`callback` : | callback to call when a chunk of data is received
`user_data` : | user data to pass to the callback
Returns : | the path to the local file.

### grits_wms_free ()

    void                grits_wms_free                      (GritsWms *wms);

Free resources used by `wms` and cancel any pending requests.

`wms` : | the GritsWms to free

### grits_wms_new ()

    GritsWms *          grits_wms_new                       (const gchar *uri_prefix,
                                                             const gchar *uri_layer,
                                                             const gchar *uri_format,
                                                             const gchar *prefix,
                                                             const gchar *extension,
                                                             gint width,
                                                             gint height);

Creates a GritsWms for some layer on a WMS server. The returned GritsWms stores information about the images so it does not need to be entered each time a images is fetched.

`uri_prefix` : | the base URL for the WMS server
`uri_layer` : | the layer the images should be fetched from (wms LAYERS)
`uri_format` : | the format the images should be fetch in (wms FORMAT)
`prefix` : | prefix to use for local files
`extension` : | file extension for local files, should correspond to `uri_format`
`width` : | width in pixels for downloaded images (wms WIDTH)
`height` : | height in pixels for downloaded images (wms HEIGHT)
Returns : | the new GritsWms