New to using OpenLayers 3 I want to display two layers from GeoServer: An image layer and a vector layer. So far I have the following:

// Aerial Tile Layer
        var aerialLayer = new ol.layer.Tile({
            title: "Aerial",
            source: new ol.source.TileWMS({
                url: 'http://server01:8080/geoserver/sf/wms',
                params: {
                    'LAYERS': 'sf:TEST01',
                    'STYLES': ''
                serverType: 'geoserver'

        // View
        var view = new ol.View({
            projection: "EPSG:2236",
            units: 'm'

        // Map
        var map = new ol.Map({
            target: 'map',
            renderer: 'canvas',
            layers: [aerialLayer],
            view: view

However, I am getting the following error. (I am using the ol-debug.js to see a better description of the error):

TypeError: projection is undefined.

Somehow it does not like the projection I am using. I am not sure why it cannot find that projection.


Ol3 only supports "EPSG:4326" and "EPSG:3857". For every other projection you need proj4js ( http://proj4js.org/ - either install it via npm or manually).

To register a new projection you need its specifications described by a so called proj4js string. You can look it up at http://epsg.io/.

For "EPSG:2236" it is:

"+proj=tmerc +lat_0=24.33333333333333 +lon_0=-81 +k=0.999941177 +x_0=200000.0001016002 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs"

Once you included the "proj4.js" to your page you can simply call the proj4.defs() function to register the new projection (before using it of course).

it should look like:

proj4.defs("EPSG:2236","+proj=tmerc +lat_0=24.33333333333333 +lon_0=-81 +k=0.999941177 +x_0=200000.0001016002 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs");

Without doing anything further Ol3 should now recognize this new projection.


the projection of your View is EPSG:2236 so the projection of your Geoserver's layer should be same. one of the most easy way that you can handle this is that you provide re-projection inside geoserver. Geoserver is powerful in this situation. So it can help you to set new projection without any coding. follow these steps: 1. when you want publish the layer in geoserver, in the first page, in the section of "Coordinate Reference Systems" the "Native SRS" is set to something.(not important) 2. in "Declared SRS" click on the find and then search 2236. and choose the result. 3. from "SRS handling" choose "reproject native to declared"

Just this. then you can enjoy from your application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.