Requesting Gml, Kml, And Shapefiles From Geoserver
<h3 class="heading-h6"><a name="THLToolboxhomegtDevelopersZonegtGisDevelopmentgtRequestingGmlKmlAndShapefilesFromGeoserver" class="anchorpoint"></a><a href="/tools/wiki/home.html">THL Toolbox</a> > <a href="/tools/wiki/Developers%27%20Zone.html">Developers' Zone</a> > <a href="/tools/wiki/Gis%20Development.html">Gis Development</a> > Requesting Gml, Kml, And Shapefiles From Geoserver</h3><p class="paragraph">
</p><h3 class="heading-h1"><a name="RequestingGmlKmlandShapefilesfromGeoserver" class="anchorpoint"></a>Requesting Gml, Kml, and Shapefiles from Geoserver</h3><p class="paragraph"><strong class="bold">Contributor(s)</strong>: Tom Benner</p><p class="paragraph">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.</p><ul class="star"><li>To get data for a single feature, the cql_filter parameter and value would look like this: "cql_filter=(fid=200)".</li>
<li>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)".</li></ul><p class="paragraph">CQL also allows for boolean expressions and other expressions. For more information on CQL, see <a href="/tools/wiki/OpenLayers.html">OpenLayers</a>.</p><p class="paragraph">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)"):
</p><h3 class="heading-h4"><a name="Shapefile" class="anchorpoint"></a>Shapefile</h3><p class="paragraph">
<img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="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]" target="rwikiexternal">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]</a></span>
</p><h3 class="heading-h4"><a name="GML" class="anchorpoint"></a>GML</h3><p class="paragraph">
<img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="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]" target="rwikiexternal">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]</a></span>
</p><h3 class="heading-h4"><a name="KML" class="anchorpoint"></a>KML</h3><p class="paragraph">
<img src="/" alt="external link: " title="external link"/><span class="nobr"><a href="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]" target="rwikiexternal">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]</a></span>
</p><h3 class="heading-h3"><a name="UsingthePlaceDictionarysGISResourceWebService" class="anchorpoint"></a>Using the Place Dictionary's GIS Resource Web Service</h3><p class="paragraph">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 <a href="/tools/wiki/Using%20RoR%20Place%20Dictionary%20Web%20Services.html">Using RoR Place Dictionary Web Services</a>.
</p><h3 class="heading-h6"><a name="ProvidedforunrestrictedusebythespanclassnobrimgsrcsakairwikitoolimagesicklearrowgifaltexternallinktitleexternallinkahrefhttpwwwthliborgtargetrwikiexternalTibetanandHimalayanLibraryaspan" class="anchorpoint"></a><em class="italic">Provided for unrestricted use by the <span class="nobr"><img src="/" alt="external link: " title="external link"/><a href="http://www.thlib.org" target="rwikiexternal">Tibetan and Himalayan Library</a></span></em></h3>