Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to use a map service which is available in WMS format. The server is Mapserver, and the spatialreference of the map service is 4326.

I wish to use it in a slippy map (web based Javascript Map), with a custom projection. This projection does not have a EPSG code. Is it possible to request the output, by providing the well known text for the projection?


Update

I can see that the GetMap request has a SRS paramter, and usually an EPSG code is supplied, like this: SRS=EPSG:4326. Can we pass something else to this SRS Paramter?

share|improve this question
    
I thought a 'slippy map' would be in the 3857 projection? If not, can you use a tool like proj4js to reproject the custom bbox to 4326 before making the request? In OpenLayers I believe you would only have to replace the getURL method (dev.openlayers.org/docs/files/OpenLayers/Layer/…). –  ca0v Aug 17 '12 at 13:37
    
@ca0v Web maps usually are in 3857 or Web Mercator, but that is not necessary. It can be in any projection that you desire –  Devdatta Tengshe Aug 21 '12 at 3:43
    
Do you have any direct control of the Mapserver, or are you just accessing a 3rd party WMS? –  MerseyViking Aug 21 '12 at 7:59
    
@MerseyViking I am using a third party service. I do not have any direct control over the MapServer –  Devdatta Tengshe Aug 21 '12 at 12:37
    
I was going my OSM's definition of slippy map...thanks for the clarification. Are you already displaying imagery in this custom projection? Can you share the WKT/spatialReference information with us? See answer below for context. –  ca0v Aug 24 '12 at 18:30

4 Answers 4

up vote 4 down vote accepted
+50

It really depends on the capabilities of the mapserver as to what CRSes it supports (in the WMS 1.3.0 spec, CRS is used as the parameter instead of SRS, but they're essentially the same thing for your purposes). When you make a GetCapabilities request, part of the layers tag will be one or more crs tags which will list the CRSes supported by that layer. The WMS spec describes the CRS, EPSG, and AUTO namespaces (so your CRS parameter might look like CRS=CRS:1 or CRS=EPSG:4326), but I think the server is free to use whatever it likes. Practically speaking however, you'll rarely see anything other than the EPSG namespace.

But that said, if you don't mind getting your hands dirty, and you have a server to run it on, one possibility would be to set up your own MapServer that becomes a WMS client for the originating server - a sort of proxy server. You can then provide it whatever projection you like using the PROJECTION keyword.

This does mean however that a client application will not be able to get at the GetCapabilites metadata for the originating server unless you write some Javascript or similar to communicate with both servers. Alternatively, you could write some pass-through code on your server that modifies requests and/or responses, so it masquerades more completely as the originating server.

share|improve this answer
    
Following your suggestion I managed to use GeoServer to project the WMS service on the fly. It works, but seems kind of overkill, for this. I'll keep this question open for some more time, hoping to get a simpler answer. –  Devdatta Tengshe Aug 22 '12 at 12:56
    
Cool, glad you got it working in principle at least. It's not the simplest solution for sure, but it does mean you get to control caching and so on. And MapServer is considerably more lightweight than GeoServer - it is just a single executable that's FastCGI compatible. –  MerseyViking Aug 22 '12 at 16:26
1  
@DevdattaTengshe I think this is the only solution available to you. The issue is not as simple as just transforming the coordinates of the bounding box from your custom projection to EPSG:4326 and then making the request to the WMS. The WMS response itself must be transformed from EPSG:4326 to your custom projection. Therefore something must sit in the middle to do the transformation, creating a cascading WMS service seems to me the most logical and straight-forward solution. I think this should be the accepted answer. –  CHenderson Aug 25 '12 at 0:29
    
@CHenderson: I was hoping that there would be a way of telling the server itself that I wanted the output in a specific projection. Most of my GIS experience is with ESRI products, and you can request map output from ArcGIS server in any projection that you wish. I was hoping for a similar operation with the WMS server. –  Devdatta Tengshe Aug 25 '12 at 5:40
1  
That's what I was driving at Devdatta, the WMS sever exposes only the projections it can handle; in many cases this is just EPSG:4326 so you may not even be able to request a standard UTM projection for instance, yet alone a custom one. –  MerseyViking Aug 25 '12 at 7:50

A solution conceptually similiar to the suggested by MerseyViking would be settting up a Web Processing Service (WPS) that performs direct and inverse coordinate transforming between EPSG:4326 and your custom projection. This WPS would be in the middle of the WMS service and the web based JavaScript map.

It is worth mentioning that "The WPS standard defines how a client can request the execution of a process, and how the output from the process is handled." That is, if you choose you will have to code the direct and inverse reprojection operations.

In case you use a Java stack, an insteresting combination could be degree as WPS framework plus GeoTools for reprojection.

share|improve this answer

What is this custom projection? Can you express it as WKT?

Have you considered using proj4js and EPSG:4326 on the client and reproject the coordinates into the custom projection (via proj4js) to obtaining custom imagery?

Are you only wanting to display coordinates in the custom projection?

The OL map can manage both a map projection and a display projection but you'd need to know how to express the coordinate system in proj4js format (e.g. Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";)

share|improve this answer
    
The projection is as follows: PROJCS["WGS_1984_Lambert_Conformal_Conic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_198‌​4",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["De‌​gree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False‌​_Easting",4000000.0],PARAMETER["False_Northing",4000000.0],PARAMETER["Central_Mer‌​idian",80.0],PARAMETER["Standard_Parallel_1",12.472944],PARAMETER["Standard_Paral‌​lel_2",35.1728055],PARAMETER["Latitude_Of_Origin",24.0],UNIT["Meter",1.0]] –  Devdatta Tengshe Aug 25 '12 at 5:42
    
I don't want to just show the coordinates; I want to show the wms map service as a layer in my web map; The problem is that the webmap is in the above projection (which does not have a EPSG code), and the WMS services's native Spatial reference is EPSG 4326; You can ask for the WMS output in any projection which has a EPSG code, but not for those projections without a EPSG code –  Devdatta Tengshe Aug 25 '12 at 5:46

The WMS protocol is a mature (2009) standard, and not have alternatives to SRS parameter for express projection. EPSG code is another mature standard, and any standard projection have a EPSG (SRID) code. Then your problem is about "How to create a new EPSG code for a custom projection?". Well... There are some examples.

Mapserver bypass the EPSG to the "map generator" (ex. PostGIS), then, if you can define a custom projection (to make up a custom SRID; say 99996), you can use your exotic projetion, else not.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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