2

Hello I'm abit new here and I hope I'll even set the question right.

Recently I've started to work on a project that will include displaying maps in qgis-web-client. At the moment I've set up the server to display the basic examples. But now I'm trying to import my own qgis project. This specific project has an custom CRS. So far I've discovered on this site that the webclient does support custom CRSs. So without hesitating I've followed the guide and did the steps. The custom CRS file I created was Proj4js.defs["EPSG:4800"] = "+title=nevem +proj=tmerc +lat_0=0.0 +lon_0=15.0 +k=0.9999 +x_0=500000 +y_0=-5000000 +units=m +no_defs";

This CRS was copied from the project in the qgis desktop application. And I edited it so it would match with the other ones. After I run the web-client I get an error from the browser console that this.resolutions is undefined. Also I should mention that the layer names load properly. For the sake of testing I tried using the default CRS just to test my qgis project with it and it loaded the layers, but they were projected incorrectly because of the CRS.

So now the question is: How to make this CRS work with qgis-web-client? And what do the a and b variables mean in:Proj4js.defs["EPSG:3857"]= "+title=WGS 84 / Pseudo Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";

  • 1
    I don't know anything about QGIS thus a comment that someone can incorporate into an answer if needed. Your definition is either EPSG:3911 which uses MGI 1901 GeoCRS or EPSG:3794 based on Slovenia 1996 (ETRS89-equivalent at 1995). The first one would need a transformation to get to WGS84. a = semimajor/equatorial axis of ellipsoid; b = semiminor/polar radius. – mkennedy Dec 17 '14 at 18:41
  • @mkennedy Thanks for your comment, with the info you gave me, I was able to google the right EPSG which I can implement in the client. When I get back to work I'll write an answer. – Piskr Dec 18 '14 at 12:04
2

SO I'll start with how to set the CRS in your QGIS-webclient. First of all I got pink tiles over my project if the default background layers can't be projected with your CRS. Thats why I disabled the background layers and the client loaded without pink tiles. You can disable background layers in GlobalOptions.js file

var enableBingCommercialMaps = false;

var enableGoogleCommercialMaps = false;

var enableOSMMaps = false;

Now to the part where you set the CRS. First you should go check if the CRS you need is already in the CRS folder. You can find the definitions in the apache\htdocs\site\libs\proj4js\defs folder. If the CRS doesnt exist like in my case, then you need to make your own. I used the website http://spatialreference.org/ to find the desired CRS and when you do, use the Proj4js link and copy that to your definition in apache\htdocs\site\libs\proj4js\defs folder. After that you need to tell the client what projection to use. Simply change the line:

//EPSG projection code of your QGIS project var authid = "EPSG:"+3787;

After that the client should project with the correct CRS.

PS: If you are using PostGIS as your datasource, there is a possibility your CRS could be missing in the spatial_ref_sys. In that case use the link for PostGIS spatial_ref_sys INSERT statement, to insert your CRS into the table.

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.