ThinkGeo.com    |     Documentation    |     Premium Support

Nooa

Hi,



could you provide a sample application  on how to use the new NOOA features?



USA layer and WORLD layer for the weather.





thanks a lot.



jm.

Hi Jm,



We are so good to hear you are interesting in it.



I are just thinking this feature is a very fresh feature and so we didn’t publish any sample or style source codes for more tests. But like the announcement said "


Hope it helps.

Regards,

Johnny


Hi Johnny, 
  
 I got the information but I don’t get it…   I understand about layers and starting / stopping the data refresh but I don’t get how to make thing to popup on the map…  any help will be greatly appreciated. 
  
 thanks in advance. 
  
 jm

Hi Jm,



Merry Christmas!



There is a sample which works fine but built with WPF Edition. But I guess you can follow its codes. As for the NOOA samples, I guess we will publish them in next MapSuite release 8.0.



Please check the attached sample and ask the questions if anything confused.



Regards,

Johnny

NoaaWeatherSample.zip (1.78 MB)

Hi, 
  
 I got the sample but I cannot find how to make it to work in the context of a web MVC application. 
  
 jm.

Hi Jm,

Please try the below codes:


Controller:
public ActionResult DisplayASimpleMap()
        {
            NoaaWeatherStationMonitor.RefreshInterval = new TimeSpan(0, 0, 30);
            // Monitor weather station service.
            NoaaWeatherStationMonitor.StartMonitoring();
 
            Map map = new Map(“Map1”,
                new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage),
                new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage));
 
            map.MapUnit = GeographyUnit.DecimalDegree;
            map.CurrentExtent = new RectangleShape(-125, 72, 50, -46);
 
            NoaaWeatherStationFeatureLayer stationLayer = new NoaaWeatherStationFeatureLayer();
            NoaaWeatherStationStyle style = new NoaaWeatherStationStyle();
            stationLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(style);
            stationLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
 
            LayerOverlay overlay = new LayerOverlay(“NoaaWeatherStation”);
            overlay.IsBaseOverlay = false;
            overlay.Layers.Add(stationLayer);
 
            map.CustomOverlays.Add(new WorldMapKitWmsWebOverlay());
            map.CustomOverlays.Add(overlay);
            return View(map);
        }
 
View:
<div class=“twelve columns” id=“main”>
    <div id=“map”>
        @{Html.ThinkGeo().Map(Model).Render();}
    </div>
</div>
<script type=“text/javascript”>
    (function () {
        var overlay = Map1.getMarkerOverlay();
        setInterval(function () {
            Map1.redrawLayer(“NoaaWeatherStation”);
        }, 1000);
    })();
</script>

After running the project, it might be take some seconds to load all the weather data from the service and if the network is fine, we can get the results like:





Hope it helps.

Johnny

Hi Johnny, 
  
 Does work!!!  Ok now what about "NoaaRadarRasterLayer"?  how can I make this to work within my MVC app? 
  
 thanks. 
  
 jm

Everything work in decimal degree but when in spherical Mercator only stations are visible the radar does not have a projection??? 
  
 jm.

Hi Jm,



Both of stations and radar should support spherical Mercator and they work fine in our end.



But there is a few differences between applying the projection to stations and radar. When we apply projection to the StationFeatureLayer like NoaaWeatherStationFeatureLayer, which is actutully apply to the FeatureSource property in  StationLayer. However, there is not such FeatureSource property in NoaaRadarRasterLayer but ImageSource instead. the difference is just like this:



NoaaWeatherStationFeatureLayer stationLayer = new NoaaWeatherStationFeatureLayer();

stationLayer.FeatureSource.Projection = pro4;



NoaaRadarRasterLayer radarLayer = new NoaaRadarRasterLayer();

radarLayer.ImageSource.Projection = proj4;



(Tips: In MapSuite, if the layer named "xxxFeatureLayer", the layer is inherited from FeatureLayer and it owns a FeatureSource property. If the layer named "xxxRasterLayer", a ImageSource property should be corresponding.)



Regards,

Johnny

Is there anywhere I can find a complete working example of using NoaaRadarRasterLayer in WebEdition??

Hi Randy,

I think we don’t have a complete sample for this layer.

What’s the issue you met when you are using NoaaRadarRasterLayer?

Regards,

Don

I get the following error.

An unhandled exception of type ‘System.AccessViolationException’ occurred in MapSuiteCore.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Here is my code:

    private void CreateLayers()
    {
        map1.MapUnit = GeographyUnit.Meter;

        ManagedProj4Projection proj4 = new ManagedProj4Projection();
        proj4.InternalProjectionParametersString = Proj4Projection.GetLatLongParametersString(); //Geodetic (decimal degrees).  
        proj4.ExternalProjectionParametersString = Proj4Projection.GetBingMapParametersString(); // Google Map projection (Spherical Mercator)  
        proj4.Open();

        RectangleShape bingMapRectangleShape = proj4.ConvertToExternalProjection(new RectangleShape(-96.593065, 43.499319, -90.185400, 40.745182));


        AddBingOverlay(BingMapsStyle.Hybrid);

        //Add NoaaWeatherStationFeatureLayer to LayerOverlay.  
        LayerOverlay noaaWeatherStationOverlay = new LayerOverlay();
        map1.CustomOverlays.Add(noaaWeatherStationOverlay);

        NoaaRadarRasterLayer noaaRadarRasterLayer = new NoaaRadarRasterLayer();
        noaaRadarRasterLayer.Name = "noaaRadar";
        noaaRadarRasterLayer.Open();
        noaaRadarRasterLayer.ImageSource.Projection = proj4;
        NoaaRadarMonitor.RadarUpdated += (sender, args) => NoaaRadarMonitor.StopMonitoring();

        LayerOverlay radarOverlay = new LayerOverlay();
        radarOverlay.Layers.Add(noaaRadarRasterLayer);
        map1.CustomOverlays.Add(radarOverlay);

        map1.CurrentExtent = bingMapRectangleShape;
    }

    private void AddBingOverlay(BingMapsStyle bingStyle)
    {
        string applicationID = System.Configuration.ConfigurationManager.AppSettings["BingMapApplicationID"].ToString();
        BingMapsOverlay bingMapsOverlay = new BingMapsOverlay("BingMap - " + bingStyle.ToString(), applicationID, bingStyle);
        bingMapsOverlay.IsBaseOverlay = true;
        bingMapsOverlay.IsVisible = true;
        map1.CustomOverlays.Add(bingMapsOverlay);
    }

Hi Randy,

The “Attempted to read or write protected memory” should thrown because the unmanaged dlls hadn’t been updated to the latest.

Please download this package here: https://ap.thinkgeo.com:5001/sharing/MmW06Eail

And let me know whether that’s helpful.

Regards,

Don

After installing the unmanaged dependencies msi the protected memory problem went away. The map still does not display the radar overlay. The map itself looks fine and I am able to pan and zoom with no problem. Here is a shot of my map and one of a local weather radar page for the same time.


This is still not working.

Hi Randy,

The radar image get refreshed succeed, but the client side hadn’t get this refresh, pan, zoom or call via JavaScript can solved it.

Regards,

Don