DataBC KML Applications and Templates
The purpose of this repo is to convert existing mapserver kml applications and templates to use geoserver and house the results.
dbc-kml-apps/apps is for converted kml apps
dbc-kml-apps/apps/icons is for custom icons organized by kml app
dbc-kml-apps/geoserver is for geoserver ftl templates, named sld's, and xslts grouped by data source
dbc-kml-mapserver/kml holds the original kml apps that need to be converted
Here is a handy table for understanding the layers in existing mapserver templates.
The need for creating custom output type is stil unclear. If they are needed, this is how its done. To create a custom output type in GeoServer using XSLT, you need to define two files:
a. A custom output type declaration file
b. A custom output transformation file
Each pair of custom output files should specify the transformation of one and only one feature class.
A custom output type declaration file should be named .xml (e.g., kayml_geodetic_control.xml) where is "kayml_" and is a meaningful contraction of the featureClass name in the BC Geographical WhereHouse
A custom output transformation file should be named .xslt (e.g., kayml_geodetic_control.xslt)
Here is an example request for a custom output type called kayml_geodetic_control.xml:
http://delivery.openmaps.gov.bc.ca/geo/pub/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=pub:WHSE_REFERENCE.MASCOT_GEODETIC_CONTROL&maxFeatures=50&outputFormat=kayml_geodetic_control&srsname=EPSG:4326
Given a feature class called WHSE_REFERENCE.MASCOT_GEODETIC_CONTROL, the custom output type declaration file is named kayml_geodetic_control.xml
The custom output type transformation file for this feature class is called kayml_geodetic_control.xslt
-
Connect to Government network (VPN)
-
Get mapserver layer name from the KML file in /mapserver/kml-name.kml. It should be in the href tag within the url to mapserver.
-
Use this layer name in a subversion query to find an associated map file.
-
This will hopefully return a mapfile.map file. Open this and look for the DATA parameter within a LAYER entry. This is the features class name geoserver uses. There will most likely be multiple layers entries in which we must coincide with individual kml templates.
-
An alternative is to checkout all the map files like this:
svn checkout http://apps.bcgov/svn/webmaps/sites/trunk/mapfiles
Then use a search tool like grep
grep 'TA_MUNICIP' *.map
This is handy if you don't want to operate in VPN all the time.
-
Use the feature class name to look up the layer name and style with a wms getFeatureInfo request. Use the style closely resembling the layer entry in the mapserver mapfile.
http://openmaps.gov.bc.ca/geo/pub/**feature-class-name**/wms?request=getcapabilities
-
Use the feature class name to look up exposed attributes and their associated names.
http://openmaps.gov.bc.ca/geo/pub/**feature-class-name**/wfs?request=DescribeFeatureType
WMS GetCapabilities WFS GetCapabilities WMS GetMap KML BCGOV Web Map Libary KML FrontCounter BC KML Airphoto Viewer
Geodetic control Jenkins Build
You can also specify it by data store:layer format like this Geodetic Control
Node must be installed on the system. Make sure the following modules are installed globally.
npm i -g pug-cli html2pug jstransformer-cdata livescript
Convert the existing kml files into pug files like this
html2pug kmlfile.kml
There is an npm step for building pug files back into kml:
npm run build