I want to use my mapserver.map file

Aug 13, 2010 at 8:25 AM

Hi radioman!

I have a running mapserver with this .map file

MAP
  NAME "QGIS-MAP"
  SIZE 100 100
  UNITS meters
  EXTENT 596319.685021 1138931.858174 600111.769729 1140712.489254
  FONTSET './fonts/fonts.txt'
  SYMBOLSET './symbols/symbols.txt'
  PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
  END
  IMAGECOLOR 255 255 255
  IMAGEQUALITY 80
  IMAGETYPE png
  OUTPUTFORMAT
    NAME png
    DRIVER 'AGG/PNG'
    MIMETYPE 'image/png'
    IMAGEMODE RGBA
    EXTENSION 'png'
  END
  LEGEND
      IMAGECOLOR 255 255 255
    STATUS ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END
  WEB
    IMAGEPATH '/tmp/'
    IMAGEURL '/tmp/'
    METADATA
      'ows_title'           'QGIS-MAP'
      'ows_onlineresource'  'http://localhost/cgi-bin/mapserv.exe?map=maps/basemap.map'
      'ows_srs'             'EPSG:4326'
      'wms_title'           'QGIS-MAP'
      'wms_onlineresource'  'http://localhost/cgi-bin/mapserv.exe?map=maps/basemap.map'
      'wms_srs'             'EPSG:4326'
    END
    TEMPLATE 'fooOnlyForWMSGetFeatureInfo'
  END

LAYER
    NAME 'layout'
    TYPE POLYGON
    EXTENT 565881.175914 1134094.551561 625516.846460 1162097.388165
    DATA 'D:/Van/Docs/Business Locator/AOR_POL/aor.shp|layerid=0'
    METADATA
      'ows_title' 'Layout'
      'wms_title' 'Layout'
    END
    PROCESSING "CLOSE_CONNECTION=DEFER"
    STATUS OFF
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    END
    CLASS
       NAME 'layout'
       STYLE
         SYMBOL 0
         SIZE 7.0
         COLOR 242 239 233
       END
    END
  END
END

as you can see, it has its own extent and i want to stick with it.. i tried the MapType.MapBenderWMS by replacing the url with the correct url i have but to no avail.. pls help me..

Coordinator
Aug 13, 2010 at 9:08 AM

so where is the server url?

Aug 13, 2010 at 9:39 AM

hi,

your   EXTENT 596319.685021 1138931.858174 600111.769729 1140712.489254 and EPSG:4326 aka LatLong don't go well together ;)

but it should work just correct WMS demo: (if your source data is really EPSG:4326)

Coordinator
Aug 13, 2010 at 9:42 AM

he he ;} localhost

Aug 13, 2010 at 11:20 AM

The localhost address is inside his MAP file, so thats the address WMS should be called with. I guess hi is doing this for test purposes.

But as I said, if you configure MapServer correctly it's working just file (even with tilecache addon)

Best regards

Coordinator
Aug 13, 2010 at 11:41 AM

i see

Aug 14, 2010 at 4:10 AM
radioman wrote:

so where is the server url?

hi radioman,

tnx for the quick reply... im not in the office right now nd i forgot the url i used.. i'll post it as soon as im in the office..

Aug 14, 2010 at 4:14 AM
krneki99 wrote:

hi,

your   EXTENT 596319.685021 1138931.858174 600111.769729 1140712.489254 and EPSG:4326 aka LatLong don't go well together ;)

but it should work just correct WMS demo: (if your source data is really EPSG:4326)

hi.. tnx for the reply...

i tried it already before asking for help... sorry for the lack of details with regards to my problem

Aug 14, 2010 at 4:16 AM

is it possible to set the current view/rectangle with this extent 596319.685021 1138931.858174 600111.769729 1140712.489254?

Coordinator
Aug 14, 2010 at 9:27 AM

what do you mean?

Aug 16, 2010 at 2:59 AM

Hi radioman,

this is the code

case MapType.MapBenderWMS:
            {
               var px1 = ProjectionForWMS.FromTileXYToPixel(pos);
               var px2 = px1;

               px1.Offset(0, ProjectionForWMS.TileSize.Height);
               PointLatLng p1 = ProjectionForWMS.FromPixelToLatLng(px1, zoom);

               px2.Offset(ProjectionForWMS.TileSize.Width, 0);
               PointLatLng p2 = ProjectionForWMS.FromPixelToLatLng(px2, zoom);

               var ret = string.Format(CultureInfo.InvariantCulture, "http://192.168.5.162/cgi-bin/mapserv.exe?map=maps/basemap.map&VERSION=1.0.0&REQUEST=GetMap&SERVICE=WMS&LAYERS=layout&styles=&bbox={0},{1},{2},{3}&width={4}&height={5}&srs=EPSG:4326&format=image/png", p1.Lng, p1.Lat, p2.Lng, p2.Lat, ProjectionForWMS.TileSize.Width, ProjectionForWMS.TileSize.Height);

               return ret;
            }

while debugging, i found this:

http://192.168.5.162/cgi-bin/mapserv.exe?map=maps/basemap.map&VERSION=1.0.0&REQUEST=GetMap&SERVICE=WMS&LAYERS=layout&styles=&bbox=25.3564453125,54.7246201949245,25.400390625,54.7499909702269&width=256&height=256&srs=EPSG:4326&format=image/png

what should i do to change the range of values given by p1.Lng, p1.Lat, p2.Lng and p2.Lat to this range 596319.685021,1138931.858174,600111.769729,1140712.489254...?

i want it to be like http://192.168.5.162/cgi-bin/mapserv.exe?map=maps/basemap.map&VERSION=1.0.0&REQUEST=GetMap&SERVICE=WMS&LAYERS=layout&styles=&bbox=596319.685021,1138931.858174,600111.769729,1140712.489254&width=256&height=256&srs=EPSG:4326&format=image/png

pls help....

 

Coordinator
Aug 16, 2010 at 6:41 AM

you need to know geographic coordinates

Aug 16, 2010 at 9:06 AM

Hi VanL,

The problem is that you specify in your MAP file that the source file is EPSG:4326 but it's not!

If you set you wms_srs to EPSG:4326 and LAYER projection of the source file correctly. The WMS can be addressed as you see in the WMS demo.

Best regards,

Blaz

Aug 20, 2010 at 1:32 AM
krneki99 wrote:

Hi VanL,

The problem is that you specify in your MAP file that the source file is EPSG:4326 but it's not!

If you set you wms_srs to EPSG:4326 and LAYER projection of the source file correctly. The WMS can be addressed as you see in the WMS demo.

Best regards,

Blaz

hi krneki99,

Thank you for clearing things. This really solved my problem. I'm able to display my map and can proceed with my project... Thank you.