Requesting Gml, Kml, And Shapefiles From Geoserver

THL Toolbox > Developers' Zone > Gis Development > Requesting Gml, Kml, And Shapefiles From Geoserver

Requesting Gml, Kml, and Shapefiles from Geoserver

Contributor(s): Tom Benner

GeoServer provides methods of requesting data in commonly-used formats, such as GML, KML and shapefile. To determine which features are returned, you should include a CQL filter in the cql_filter parameter.

  • To get data for a single feature, the cql_filter parameter and value would look like this: "cql_filter=(fid=200)".
  • To get data all features of a specific feature type, the cql_filter parameter and value would look like this: "cql_filter=(object_type=59)".

CQL also allows for boolean expressions and other expressions. For more information on CQL, see OpenLayers.

For the THL's GeoServer instance, the URLs of these data requests have the following formats, where "[cql]" should be replaced with CQL (e.g. "(object_type=59)"):

Shapefile

external link: http://sds1.itc.virginia.edu:8080/thdl-geoserver/wfs?typename=thdl%3Atest2&layers=thdl%3Atest2&projection=EPSG%3A4326&service=wfs&version=1.0.0&request=GetFeature&srs=EPSG%3A4326&outputformat=shape-zip&cql_filter=[cql]

GML

external link: http://sds1.itc.virginia.edu:8080/thdl-geoserver/wfs?typename=thdl%3Atest2&layers=thdl%3Atest2&projection=EPSG%3A4326&service=wfs&version=1.0.0&request=GetFeature&srs=EPSG%3A4326&outputformat=GML2&cql_filter=[cql]

KML

external link: http://sds1.itc.virginia.edu:8080/thdl-geoserver/wms?typename=thdl%3Atest2&layers=thdl%3Atest2&projection=EPSG%3A4326&service=wms&version=1.0.0&request=GetMap&srs=EPSG%3A4326&width=1600&height=750&bbox=-180.0,-90.0,180.0,90.0&format=application/vnd.google-earth.kml%20XML&cql_filter=[cql]

Using the Place Dictionary's GIS Resource Web Service

Since the above URLs involve a number of parameters that may be somewhat opaque to some users, we also provide a GIS resource web service in the Place Dictionary, which makes similar queries to the ones above, but involves far fewer parameters. Information on this can be found in Using RoR Place Dictionary Web Services.

Provided for unrestricted use by the external link: Tibetan and Himalayan Library