Useful information for developers interested in SMap.

SMap is an open service built on open source software. We encourage you to build new applications using the components and resources it provides. This page is a starting point for developers interesting in taking full advantage of SMap. It also includes links to the project's source code so anyone can build and customize their own SMap.

SMap Software

All the code that runs SMap is open source. The code is available at http://github.com/SMap/geonode/. The issue tracker for the project is at http://github.com/SMap/geonode/issues.

SMap is built using several open source projects, each with its own community. If you are interested in contributing new features to the SMap, we encourage you to do so by contributing to one of the projects on which it is built:

  • GeoServer - Standards based server for geospatial information
  • GeoWebCache - Cache engine for WMS Tiles
  • OpenLayers - Pure JavaScript library powering the maps of GeoExt
  • pycsw - CSW, OpenSearch and OAI-PMH metadata catalogue server

What are OGC Services?

The data in this application is served using open standards endorsed by ISO and the Open Geospatial Consortium; in particular, WMS (Web Map Service) is used for accessing maps, WFS (Web Feature Service) is used for accessing vector data, and WCS (Web Coverage Service) is used for accessing raster data. WMC (Web Map Context Documents) is used for sharing maps. You can use these services in your own applications using libraries such as OpenLayers, GeoTools, and OGR (all of which are open-source software and available at zero cost). Additionally, CSW (Catalog Service for the Web) supports access to collections of descriptive information (metadata) about data and services.

What is GeoWebCache?

GeoWebCache provides mapping tiles that are compatible with a number of mapping engines, including Google Maps, Bing Maps and OpenLayers. All the data hosted by SMap is also available through GeoWebCache. GeoWebCache improves on WMS by caching data and providing more responsive maps.

CSW Example Code

To interact with SMap's CSW you can use any CSW client (QGIS MetaSearch, GRASS, etc.). The following example illustrates a simple invocation using the OWSLib Python package:

from owslib.csw import CatalogueServiceWeb

from owslib.fes import PropertyIsLike

csw = CatalogueServiceWeb('https://giscloud.vn/catalogue/csw')

anytext = PropertyIsLike('csw:AnyText', 'birds')')

csw.getrecords2(constraints=[anytext])

print csw.results

print csw.records

OpenLayers Example Code

To include a SMap map layer in an OpenLayers map, first find the name for that layer. This is found in the layer's name field (not title) of the layer list. For this example, we will use the Nicaraguan political boundaries background layer, whose name is risk:nicaragua_admin. Then, create an instance of OpenLayers.Layer.WMS:

var geonodeLayer = new OpenLayers.Layer.WMS("SMap Risk Data", "https://giscloud.vn/geoserver/wms",{ layers: "risk:nicaragua_admin" });

Google Maps Example Code

To include a SMap map layer in a Google Map, include the layer namein the URL template.

var tilelayer = new GTileLayer(null, null, null, {tileUrlTemplate: 'https://giscloud.vn/geoserver/gwc/service/gmaps?layers=risk:nicaragua_admin&zoom={Z}&x={X}&y={Y}', isPng:true, opacity:0.5 } );

Shapefile/GeoJSON/GML Output

To get data from the SMap web services use the WFS protocol. For example, to get the full Nicaraguan admin boundaries use:

https://giscloud.vn/geoserver/wfs?request=GetFeature&typeName=risk:nicaragua_admin&outputformat=SHAPE-ZIP

Changing output format to json, GML2, GML3, or csv will get data in those formats. The WFS protocol also can handle more precise queries, specifying a bounding box or various spatial and non-spatial filters based on the attributes of the data.

GeoTools Example Code

Create a DataStore and extract a FeatureType from it, then run a Query. It is all documented on the wiki at http://geotools.org/.

SMap's Web Services

SMap's Web Services are available from the following URLs:

Gạch động thông qua WMS: WMS 1.1.1
Dữ liệu Vector qua WFS: WFS 1.1.0
Dữ liệu Raster qua WCS: WCS 1.1.1
Tìm kiếm siêu dữ liệu qua CSW: CSW 2.0.2
Metadata search via OpenSearch: OpenSearch 1.0
Metadata search via OAI-PMH: OAI-PMH 2.0
Gạch Cached qua WMTS: WMTS 1.0.0