[Geomoose-users] NFHL WMS from mapfile

Eli Adam EAdam at co.lincoln.or.us
Mon Sep 20 14:26:32 EDT 2010


I have seen similar behavior on the TerraServer (now renamed Microsoft Research Maps see http://en.wikipedia.org/wiki/Microsoft_Research_Maps for more details) Topo maps. 

This is the map source that I used.   

  <map-source name="DRG" type="wms" projection="EPSG:4326" queryable="false" tiled="false">
                <url>http://msrmaps.com/ogcmap.ashx?</url>
				<layer name="DRG" queryable="false" />
				<param name="TRANSPARENT" value="TRUE"/>
				<param name="FORMAT" value="image/png"/>
       </map-source>

When using it just like this, I can (resolution dependent) run into pink tiles.  To solve this, I put tiled="true" which gave me similar results as Elizabeth described, tiles shifted proportionally to the level of zoom.  In my case, my map is in EPSG:2913.  I could use mapserver to consume and then serve it in a different epsg but that perhaps seems counter to the point of OGC services.  

Has anyone tried putting these WMS layers straight into OpenLayers to see if they shifted when tiled=true?  I've done some preliminary tests but not knowledgeable enough on OL to know definitively.  It seems that we would really want this to work in OL and then in GM too.  

Bests, Eli




>>> <geomoose-users-request at lists.sourceforge.net> 9/17/2010 8:48 AM >>>
Send Geomoose-users mailing list submissions to
	geomoose-users at lists.sourceforge.net 

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.sourceforge.net/lists/listinfo/geomoose-users 
or, via email, send a message with subject or body 'help' to
	geomoose-users-request at lists.sourceforge.net 

You can reach the person managing the list at
	geomoose-users-owner at lists.sourceforge.net 

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Geomoose-users digest..."


Today's Topics:

   1. Re: NFHL WMS from mapfile (Johan Forsman)


----------------------------------------------------------------------

Message: 1
Date: Fri, 17 Sep 2010 10:47:47 -0500
From: Johan Forsman <Johan.Forsman at LA.GOV>
Subject: Re: [Geomoose-users] NFHL WMS from mapfile
To: "Miller, Elizabeth (DOT)" <Elizabeth.Miller at state.mn.us>, Len Kne
	<lkne at houstoneng.com>, Dan Little <danlittle at yahoo.com>,
	"geomoose-users at lists.sourceforge.net"
	<geomoose-users at lists.sourceforge.net>
Message-ID:
	<D697C50705266B4B826C7322C809F00D695E0856 at MAILMBX09.MAIL.LA.GOV>
Content-Type: text/plain; charset="utf-8"

That browser size problem I have also seen, but only with screens of 1280x1024 dimensions and greater. As you identified, not maximizing the browser is the solution there. GM adds a considerable buffer to the image request. On my 1280x1024 main screen I need to shrink the browser window to around 950x920 to obtain an image from the FEMA WMS. The actual viewport of the map is only about 720x640 then.

With the ?fix? below the FEMA WMS returns an image even on a browser window covering most (not all) of my 1920x1200 screen. I also have MAXSIZE 10000 in the global mapfile.

As you also have experienced, specifying the HEIGHT and WIDTH parameters in the mapbook has no effect. However, if you do it in the compile.js file it does work. At least it does for me. You can test too, but please make a backup copy of compiled.js first! This of course will fix the size for all sources, so it may break something else for you.

File is geomoose2/htdocs/compiled.js, change lines 1473 and 1474 like so:

            /* reproject the bounds */
            if(this.singleTile && this.projection.projCode != this.map.getProjection()) {
                        bounds = bounds.transform(this.map.projection, this.projection);
            }

        var imageSize = this.getImageSize();
        var newParams = {
            'BBOX': this.encodeBBOX ?  bounds.toBBOX() : bounds.toArray(),
            'WIDTH': 1024, //The image request is too large unless fixed.
            'HEIGHT': 1024
//           'WIDTH': imageSize.w, //These are the original parameters.
//           'HEIGHT': imageSize.h
       };
        var requestString = this.getFullRequestString(newParams);
        return requestString;
    },

I am typically reluctant to change source code since I do not program much myself, and am leery of making changes where I do not fully understand a function. In this case it did not appear too complex and I felt it did not hurt to try once I made a backup copy.

Much like you, I am also unable to make the WMS-thru-MapServer method work, copying Len?s suggested mapsource. If creating a legend is easier using a mapfile intermediary, then that?s what I would prefer also.

And my disclaimer is still in effect: I may be going about this entirely the wrong way. I can?t argue with the results, however: It appears to work for me this way.

Give it a shot, temporarily? You can always revert, and I am curious to hear what you find.

Take care,
Johan.

From: Miller, Elizabeth (DOT) [mailto:Elizabeth.Miller at state.mn.us] 
Sent: Friday, September 17, 2010 9:55 AM
To: Johan Forsman; Len Kne; Dan Little; geomoose-users at lists.sourceforge.net 
Subject: RE: [Geomoose-users] NFHL WMS from mapfile

Regarding the first half of Johan?s email, I believe the issue may be one that we experienced here with monitors that were set to a higher screen resolution. That is, when I reference the FEMA WMS directly from the mapbook, I do not have a problem if my monitor is set to 1024 x 768. However, when set to a higher resolution I will get a pink screen in Geomoose. (It will correct itself if I scale the browser window down to a smaller size though.) With other WMS?s I can eliminate that problem by setting tiled=?true? but with the FEMA service that won?t work as it won?t project correctly if tiled=?true.? I did play around with trying to hardcode the WIDTH and HEIGHT in the mapsource to force them to be less than 1024x1024 but didn?t get it to work. I also tried using the ?fixedwidth? parameter. Right now the solution here is ?change your screen resolution to something lower.?

I would prefer to access the WMS through Mapserver and a mapfile anyway because of the greater control at building a legend. Right now I am still stumped about how Len has gotten it to work! I have been trying to imitate what he did but so far, no success.




From: Johan Forsman [mailto:Johan.Forsman at LA.GOV] 
Sent: Friday, September 17, 2010 8:49 AM
To: Len Kne; Miller, Elizabeth (DOT); Dan Little; geomoose-users at lists.sourceforge.net 
Subject: RE: [Geomoose-users] NFHL WMS from mapfile

Now this is an interesting discussion. On my end using the same sources I also get similar errors.
I have seen these errors with just about every WMS I have tried as a direct source in the mapbook (I have not tried using MapServer as an intermediary before), and in every case it appears to be related to the size of the image requested by GM. I may be going about this the wrong way, but here is what I have investigated:

Using GM 2.2 under FGS 95 on linux, with EPSG:900913 mapbook.

For mapbook WMS sources I may have something like:

<map-source name="fema_wms" type="wms" tiled="false" projection="EPSG:4326" >
            <url>http://hazards.fema.gov/wmsconnector/wmsconnector/com.esri.wms.Esrimap/NFHL?</url>
            <layer name="Q3 Flood Hazards (red)" ></layer>
            <param name="format" value="image/png"/>
            <param name="TRANSPARENT" value="TRUE"/>
</map-source>

This layer will work just fine once I get to ~1:110000, presumably there is a scale limit on the WMS.

The issue is it will ONLY work if I hard-code the WIDTH and HEIGHT parameters in compiled.js using 1024 or less.

The URL GM sends if I do not restrict the sizes looks like e.g.
http://hazards.fema.gov/wmsconnector/wmsconnector/com.esri.wms.Esrimap/NFHL?FORMAT=image%2Fpng&TRANSPARENT=TRUE&STYLES=&LAYER=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&LAYERS=Q3%20Flood%20Hazards%20(red)&BBOX=-91.08713148755879,30.503635126158578,-90.62673567465326,30.80975363607718&WIDTH=1341&HEIGHT=1036 

The end of that URL is the culprit I think. Max size for the FEMA WMS source is 1024x1024.

I attempted to include the 1024 size parameters in the mapbook but that did not change the requested size. It did however change the position of the size parameters in the URL:
http://hazards.fema.gov/wmsconnector/wmsconnector/com.esri.wms.Esrimap/NFHL?FORMAT=image%2Fpng&TRANSPARENT=TRUE&STYLES=&HEIGHT=1036&WIDTH=1341&LAYER=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&LAYERS=Q3%20Flood%20Hazards%20(red)&BBOX=-90.98756788893812,30.416629347292723,-90.52717207603257,30.723022605026703 

If I hard-code the sizes in compiled.js, and remove the size parameter in the mapbook, then the URL looks like
http://hazards.fema.gov/wmsconnector/wmsconnector/com.esri.wms.Esrimap/NFHL?FORMAT=image%2Fpng&TRANSPARENT=TRUE&STYLES=&LAYER=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&LAYERS=Q3%20Flood%20Hazards%20(red)&BBOX=-90.98825453445235,30.411299939414775,-90.52785872152884,30.717710003563038&WIDTH=1024&HEIGHT=1024 

This last one produces a successful image. Note the WIDTH and HEIGHT parameters at the end.

I noticed this in the Firefox Page Info tool for the successful image request:
Dimensions: 1,024px ? 1,024px (scaled to 1,341px ? 1,036px).

If I try using MapServer as the intermediary to the WMS source, copying Elizabeth?s mapfile nearly verbatim, it does not work at all. Pink screen and the following error in the logfile:
msDrawMap(): WMS connection error. Failed to draw WMS layer named 'avail_data'. This most likely happened because the remote WMS server returned an invalid image, and XML exception or another unexpected result in response to the GetMap request. Also check and make sure that the layer's connection URL is valid. msDrawRaster(): Image handling error. Unrecognized or unsupported image format drawEPP(): Image handling error. /opt/fgs/tmp/ms_tmp/4c936dca_4f68_0.img.tmp is not an EPPL file.

The URL sent by GM looks like
http://geoview.dhh.la.gov:8080/cgi-bin/mapserv?map=%2Fopt%2Ffgs%2Fapps%2Fgeomoose2%2Fmaps%2Fsdwp%2Fother_agency_data%2Ffema_wms.map&layers=avail_data&mode=map&mapext=-10997759.439297+3010701.1615728+-9357726.5607032+4278332.8384272&imgext=-10997759.439297+3010701.1615728+-9357726.5607032+4278332.8384272&map_size=1341+1036&imgx=670.5&imgy=518&imgxy=1341+1036 

A direct URL to MapServer using the same extents works just fine and looks like
http://geoview.dhh.la.gov:8080/cgi-bin/mapserv?map=%2Fopt%2Ffgs%2Fapps%2Fgeomoose2%2Fmaps%2Fsdwp%2Fother_agency_data%2Ffema_wms.map&layers=avail_data&mode=map&mapext=-10997759.439297+3010701.1615728+-9357726.5607032+4278332.8384272&imgext=-10997759.439297+3010701.1615728+-9357726.5607032+4278332.8384272 

The only difference I see between those two URLs is the last bit about the size.

Please note for the MapServer examples I used a layer I know will draw at the full-state scale.

I have stared at this for so long I am very likely missing something terribly and embarrassingly obvious, but there appears to be an issue, at least on my version of GM2.2, with the requested image size being too large.

Perhaps we can instruct the responsible code to look for size parameters in the mapbook first, then default to a reasonably safe maximum if none is specified?

Thanks for taking the time to read all this. I hope some of it helps troubleshooting.

/Johan.
----------------------
Johan Forsman
Geologist
Safe Drinking Water Program
Louisiana Department of Health and Hospitals
Office of Public Health
Telephone: 225.342.7309
Telefax: 225.342.7303



From: Len Kne [mailto:lkne at houstoneng.com] 
Sent: Wednesday, September 15, 2010 11:56 AM
To: 'Miller, Elizabeth (DOT)'; Dan Little; geomoose-users at lists.sourceforge.net 
Subject: Re: [Geomoose-users] NFHL WMS from mapfile

I tried your map file and it works for me http://dev.houstoneng.net/geomoose.html  ? using this as the map-source:

                <map-source name="flood" type="mapserver" tiled="true" >
                                <file>./demo/landrecords/flood.map</file>
                                <layer name="Flood Data Availability"/>
                </map-source>

Generally if there are no error messages or pink screens, the issue is in the Mapbook - like the map-source/layer does not match in the catalog.

Len

From: Miller, Elizabeth (DOT) [mailto:Elizabeth.Miller at state.mn.us] 
Sent: Wednesday, September 15, 2010 9:57 AM
To: Dan Little; geomoose-users at lists.sourceforge.net 
Subject: Re: [Geomoose-users] NFHL WMS from mapfile

I put tiled=?true? in the map-source and still get nothing. I?ve also tried resizing the browser window to see if that made a difference for Geomoose but it didn?t.

From: Dan Little [mailto:danlittle at yahoo.com] 
Sent: Wednesday, September 15, 2010 9:07 AM
To: Miller, Elizabeth (DOT); geomoose-users at lists.sourceforge.net 
Subject: Re: [Geomoose-users] NFHL WMS from mapfile

Given the email I just got from Elizabeth and looking at the results of shp2img (from Brent's email), I would bet serious money (like $20 or a couple cases of beer) that MapServer is trying to request an image greater than 1024 x 1024.  This is causing MapServer to get an invalid response and returning a blank image.

Tell GeoMOOSE to tile the layer and see if you start getting reasonable results.


From: "Miller, Elizabeth (DOT)" <Elizabeth.Miller at state.mn.us>
To: Dan Little <danlittle at yahoo.com>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Wed, September 15, 2010 8:59:00 AM
Subject: RE: [Geomoose-users] NFHL WMS from mapfile
No, no pink screen. Just nothing.

From: Dan Little [mailto:danlittle at yahoo.com] 
Sent: Wednesday, September 15, 2010 8:46 AM
To: Miller, Elizabeth (DOT); geomoose-users at lists.sourceforge.net 
Subject: Re: [Geomoose-users] NFHL WMS from mapfile

Are you getting a Pink Screen of Death in GeoMOOSE? If the image is blank then I would be that MapServer is trying to request an image larger than the restricted size (1024x1024).

From: "Miller, Elizabeth (DOT)" <Elizabeth.Miller at state.mn.us>
To: Dan Little <danlittle at yahoo.com>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Wed, September 15, 2010 8:33:21 AM
Subject: RE: [Geomoose-users] NFHL WMS from mapfile
Here is the map-source from the mapbook:

<map-source name="fema" type="mapserver" tiled="false" reference="false">
                <file>/ms4w/apps/metrogis/maps/mapfiles_metro/WMS/fema_wms.map</file>
<layer name="Flood Data Availability"/>
</map-source>

And in the catalog portion of the mapbook:

http://msc.fema.gov 


I should also add that there are scale restrictions on the various layers in the service, but I have tried various layers and can?t get any of them to work. ?Flood Data Availability? may not have been the best example to use here because it does not display at large scales (larger than 1:300,000).

Also, the service is not tiled and the maximum image size is 1024 x 1024 pixels. ArcMap is able to bring it in and it displays correctly.

I can get the service to display in Geomoose if I reference it directly from the mapbook but I would like to use a mapfile and bring it in that way. If I pull it in directly in the mapbook this works:

                <map-source name="fema" type="wms" tiled="false" reference="false" projection="EPSG:4326">
                                                http://hazards.fema.gov/wmsconnector/wmsconnector/Servlet/NFHL? 
                                                <layer name="Flood_Hazard_Zones_General"/>
                                                <layer name="Q3 Flood Hazards (red)"/>
                                                <layer name="Floodways"/>
                                                <param name="format" value="image/jpeg"/>
                                                <param name="TRANSPARENT" value="TRUE"/>
                                                <param name="styles" value=""/>
                </map-source>



From: Dan Little [mailto:danlittle at yahoo.com] 
Sent: Tuesday, September 14, 2010 3:19 PM
To: Miller, Elizabeth (DOT); geomoose-users at lists.sourceforge.net 
Subject: Re: [Geomoose-users] NFHL WMS from mapfile

Can you attach the Mapbook? or Copy and paste the mapbook entry that pertains to the WMS?

From: "Miller, Elizabeth (DOT)" <Elizabeth.Miller at state.mn.us>
To: "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Tue, September 14, 2010 11:32:59 AM
Subject: [Geomoose-users] NFHL WMS from mapfile
I have not been able to bring in the FEMA NFHL Flood Mapping WMS into my Geomoose map via a mapfile. What am I missing? Can anyone help??? Here is my mapfile. I have tried both ?Flood Data Availability? and ?HDM:Q3_COUNTYMAP? as the wms_name, and have tried calling both from the map-source in the mapbook file. Maybe there is a problem with the extent?

Thank you for any help.

Liesa Miller
MnDOT
Saint Paul, Minnesota

---------------------------------------------------------------------------------------------------------------------
MAP
  NAME 'fema_wms'
  SIZE 800 650
  STATUS ON
  EXTENT 189783.560000 4816309.330000 761653.524114 5472346.500000
  UNITS METERS
  IMAGETYPE PNG
  TRANSPARENT TRUE


                WEB
                                INCLUDE "../../temp_directory.map"
                END

  PROJECTION
    'init=epsg:26915'
  END


  LAYER

      NAME        Flood Data Availability
      TYPE           RASTER
      STATUS      DEFAULT
      OFFSITE     0 0 0

      CONNECTIONTYPE WMS
      CONNECTION "http://hazards.fema.gov/wmsconnector/wmsconnector/Servlet/NFHL?"



      METADATA
        "wms_title" "Flood Data Availability"
        "wms_srs" "EPSG:4326"
        "wms_name" "HDM:Q3_COUNTYMAP"
        "wms_server_version" "1.1.1"
        "wms_format" "image/png"
        "wms_styles" ""
        "wms_exceptions" "application/vnd.ogc.se_inimage"

       END

      PROJECTION
        "init=epsg:4326"
      END



  END #layer



END #Map






-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev 

------------------------------

_______________________________________________
Geomoose-users mailing list
Geomoose-users at lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/geomoose-users 


End of Geomoose-users Digest, Vol 36, Issue 12
**********************************************




More information about the Geomoose-users mailing list