ThinkGeo.com    |     Documentation    |     Premium Support

Issue

Hi


I get this king of error when I start my application:



Why is the map control not using the full url   ?????  Please look at the get header :


 



        

  1.     Request URL:
        geoweb.usac.mmm.com/china/helper_GeoResource.axd
        

  2.     

  3.     Request Method:
        GET
        

  4.     

  5.     Status Code:
        
        404 Not Found
        

  6.     
  7. Request Headersview source
        

              

    1.         Accept:
              */*
              

    2.         

    3.         Accept-Charset:
              ISO-8859-1,utf-8;q=0.7,*;q=0.3
              

    4.         

    5.         Accept-Encoding:
              gzip,deflate,sdch
              

    6.         

    7.         Accept-Language:
              en-US,en;q=0.8
              

    8.         

    9.         Connection:
              keep-alive
              

    10.         

    11.         Cookie:
              ASP.NET_SessionId=iibahyr154c32w0qhjt3kjn5
              

    12.         

    13.         Host:
              geoweb.usac.mmm.com
              

    14.         

    15.         Referer:
              geoweb.usac.mmm.com/china/demoa
              

    16.         

    17.         User-Agent:
              Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17
              

    18.     

        

  8.     
  9. Response Headersview source
        

              

    1.         Cache-Control:
              public, max-age=31536000
              

    2.         

    3.         Content-Length:
              1245
              

    4.         

    5.         Content-Type:
              text/html
              

    6.         

    7.         Date:
              Wed, 23 Jan 2013 22:14:28 GMT
              

    8.         

    9.         Server:
              Microsoft-IIS/7.5
              

    10.         

    11.         X-Powered-By:
              ASP.NET
              

    12.     

        


thanks.


jm.



The View where I have the issue with http get not using the right / full url path. 
  
  
 
@using System.Configuration;
@using System.Web.Optimization;
@using ThinkGeo.MapSuite.Core
@using ThinkGeo.MapSuite.MvcEdition
@using GeoMVCT01.HtmlHelpers
@{
    Layout = null;
}
<!DOCTYPE html>
<html @*manifest=“demoa/offline_index.appcache”*@>
<head id=“Head1”>
    @Styles.Render("~/BundleCSS")
    @Scripts.Render("~/BundleGeoSCRIPTS")
    <title>3M China Geo-Experimental</title>
    @if (Html.IsReleaseBuild())
    {
        <base href=“geoweb.usac.mmm.com/china/demoa/”>
    }
    <meta content=“text/html; charset=utf-8” http-equiv=“Content-Type”>
    <meta content=“en-us” http-equiv=“Content-Language”>
    <meta name=“viewport” content=“width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no”>
    <meta name=“apple-touch-fullscreen” content=“yes” />
    <meta name=“apple-mobile-web-app-capable” content=“yes”>
    <meta name=“apple-mobile-web-app-status-bar-style” content=“black”>
    @if (Html.IsReleaseBuild())
    {
        <meta http-equiv=“Cache-Control” content=“no-cache” />
        <meta http-equiv=“Pragma” content=“no-cache” />
        <meta http-equiv=“Expires” content=“0” />
    }
    <link rel=“icon” type=“img/png” href="@Url.Content("~/App_Themes/img/MetroIcons/Maps-3M.png")" />
    <link rel=“shortcut icon” type=“img/png” href="~/img/MetroIcons/Maps-3M.png" />
    <link rel=“apple-touch-icon” type=“img/png” href="~/img/MetroIcons/Maps-3M.png" />
    <link rel=“apple-touch-icon-precomposed” type=“img/png” href="@Url.Content("~/App_Themes/img/MetroIcons/Maps-3M.png")"/>
    <link rel=“apple-touch-startup-image” type=“img/png” href="@Url.Content("~/App_Themes/img/MetroIcons/Maps-3M.png")" media="(max-device-width:480px)" />
    <link rel=“apple-touch-startup-image” type=“img/png” href="@Url.Content("~/App_Themes/img/MetroIcons/Maps-3M.png")" media=“screen (min-device-width:481px) and (max-device-width:1024px) and (orientation:portrait)” />
    <link rel=“apple-touch-startup-image” type=“img/png” href="@Url.Content("~/App_Themes/img/MetroIcons/Maps-3M.png")" media=“screen (min-device-width:481px) and (max-device-width:1024px) and (orientation:landscape)” />
</head>
<body>
    <div class=“header”>
        <div id=“loadingData”>
            <img id=“loadingDataImg” alt=“loading…” src="~/App_Themes/img/loading.gif" />
        </div>
    </div>
    <div class=“content”>
        <div id=“innercontainer” class=“innercontainer”>
            <div id=“Map1” class=“MapX”>
                @{
                    Html.ThinkGeo().Map(“Map1”, System.Web.UI.WebControls.Unit.Percentage(100), System.Web.UI.WebControls.Unit.Percentage(100))
                    .MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.StandardColors.White)))
                    .CurrentExtent(-14148507.181077, 6271924.7354557, -5114687.7715466, 3097880.0780531)
                    .MapUnit(GeographyUnit.Meter)
                    .MapTools(mapTools =>
                    {
                        mapTools.MouseCoordinateMapTool().Enabled(false);
                        mapTools.PanZoomBarMapTool().Enabled(false);
                        mapTools.LoadingImageMapTool().Enabled(false);
                        mapTools.TouchMapTool().Enabled(true);
                        mapTools.MouseMapTool().Enabled(true);
                        mapTools.KeyboardMapTool().Enabled(false);
                        mapTools.ScaleLineMapTool().Enabled(false);
                        mapTools.PanZoomMapTool().IsGlobeButtonEnabled(false).Enabled(false);
                    })
                .CustomOverlays(overlays =>
                {
                    //overlays.WorldMapKitWmsWebOverlay(“WorldMapKitOverlay”).Projection(WorldMapKitProjection.SphericalMercator).Name(“ThinkGeo World Map”).TileType(TileType.SingleTile);

                    overlays.WmsOverlay(“WMS Overlay”)
                       .Parameters(paras =>
                       {
                           paras.Add(“LAYERS”, “WorldMapKitRL_SPHMCT”);
                           paras.Add(“STYLES”, “DEFAULT”);
                           paras.Add(“SRS”, “EPSG:4326”);
                       })
                    .ServerUris(uris =>
                    {
                        for (int x = 0; x <= 16; x++)
                        {
                            uris.Add(new Uri(“GEOWMS.USAC.MMM.COM:80/WmsHandler.axd”));
                        }
                    })
                    .TileType(TileType.SingleTile).TileHeight(368).TileWidth(368).TransitionEffect(TransitionEffect.Stretching)
                    .WebImageFormat(WebImageFormat.Jpeg)
                    .IsBaseOverlay(true);

                    InMemoryFeatureLayer GPSLayer = new InMemoryFeatureLayer();
                    GPSLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap;
                    GPSLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(HttpContext.Current.Request.MapPath("~/App_Themes/img/target.png"));
                    GPSLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                    overlays
                        .LayerOverlay(“GPSOverlay”).Name(“GPSOverlay”)
                        .Layer(“GPSLayer”, GPSLayer).Name(“GPSLayer”).IsVisible(true).IsBaseOverlay(false)
                        .TileType(TileType.SingleTile).TileHeight(368).TileWidth(368).TransitionEffect(TransitionEffect.Stretching);

                })
                .Render();
                }
            </div>
            <div class=“Data”>
                <div id=“Data” class=“Data-innercontainer”>
                    <table id=“customer-table”>
                        <thead>
                            <tr>
                                <th class=“thc1”>Customer</th>
                                <th class=“thc2”>Name</th>
                                <th class=“thc3”>Ship To</th>
                                <th class=“thc4”>Ship To Address</th>
                                <th class=“thc5”>Sales</th>
                            </tr>
                        </thead>
                        <tbody data-bind=‘foreach: customers’>
                            <tr>
                                <td class=“tdc1”>
                                    <span data-bind=“text: customerId, event: { click: $parent.logClick }”></span>
                                </td>
                                <td class=“tdc2”>
                                    <span data-bind=“text: name, event: { click: $parent.logClick }”></span>
                                </td>
                                <td class=“tdc3”>
                                    <span data-bind=“text: shipToname, event: { click: $parent.logClick }”></span>
                                </td>
                                <td class=“tdc4”>
                                    <span data-bind=“text: shipToaddress, event: { click: $parent.logClick }”></span>
                                </td>
                                <td class=“tdc5”>
                                    <span data-bind=“text: sales, event: { click: $parent.logClick }”></span>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id=“Map2” class=“MapY”>
                @{
                    Html.ThinkGeo().Map(“Map2”, System.Web.UI.WebControls.Unit.Percentage(100), System.Web.UI.WebControls.Unit.Percentage(100))
                    .MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.StandardColors.White)))
                    .CurrentExtent(-14148507.181077, 6271924.7354557, -5114687.7715466, 3097880.0780531)
                    .MapUnit(GeographyUnit.Meter)
                    .MapTools(mapTools =>
                    {
                        mapTools.MouseCoordinateMapTool().Enabled(false);
                        mapTools.PanZoomBarMapTool().Enabled(false);
                        mapTools.LoadingImageMapTool().Enabled(false);
                        mapTools.TouchMapTool().Enabled(true);
                        mapTools.MouseMapTool().Enabled(true);
                        mapTools.KeyboardMapTool().Enabled(false);
                        mapTools.ScaleLineMapTool().Enabled(false);
                        mapTools.PanZoomMapTool().IsGlobeButtonEnabled(false).Enabled(false);
                    })
                .CustomOverlays(overlays =>
                {
                    overlays
                        .WmsOverlay(“WMS Overlay”)
                        .WebImageFormat(WebImageFormat.Jpeg)
                        .Parameters(paras =>
                        {
                            paras.Add(“LAYERS”, “WorldMapKitRL_SPHMCT”);
                            paras.Add(“STYLES”, “DEFAULT”);
                            paras.Add(“SRS”, “EPSG:4326”);
                        })
                            .ServerUris(uris =>
                            {
                                for (int x = 0; x <= 16; x++)
                                {
                                    uris.Add(new Uri(“GEOWMS.USAC.MMM.COM:80/WmsHandler.axd”));
                                }
                            })
                            .TileType(TileType.SingleTile).TileHeight(368).TileWidth(368).TransitionEffect(TransitionEffect.Stretching)
                            .IsBaseOverlay(true);

                    ClientCache _cca = new ClientCache();
                    _cca.CacheId = “heatmapdemoAChina”;
                    _cca.Duration = new TimeSpan(0, 0, 15, 0, 0);

                    overlays
                     .LayerOverlay(“HeatOverlay”)
                     .Name(“HeatOverlay”)
                     .IsBaseOverlay(false)
                     .ClientCache(_cca)
                     .TileType(TileType.SingleTile);
                })
                .Render();
                }
            </div>
            <div id=“Map3” class=“MapZ”>
                @{
                    Html.ThinkGeo().Map(“Map3”, System.Web.UI.WebControls.Unit.Percentage(100), System.Web.UI.WebControls.Unit.Percentage(100))
                    .MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.StandardColors.White)))
                    .CurrentExtent(-14148507.181077, 6271924.7354557, -5114687.7715466, 3097880.0780531)
                    .MapUnit(GeographyUnit.Meter)
                    .MapTools(mapTools =>
                {
                    mapTools.MouseCoordinateMapTool().Enabled(false);
                    mapTools.PanZoomBarMapTool().Enabled(false);
                    mapTools.LoadingImageMapTool().Enabled(false);
                    mapTools.TouchMapTool().Enabled(true);
                    mapTools.MouseMapTool().Enabled(true);
                    mapTools.KeyboardMapTool().Enabled(false);
                    mapTools.ScaleLineMapTool().Enabled(false);
                    mapTools.PanZoomMapTool().IsGlobeButtonEnabled(false).Enabled(true);
                })
                .DynamicOverlay(overlay =>
                {
                })
                .StaticOverlay(overlay =>
                {
                })
                .HighlightOverlay(overlay =>
                {
                })
                .CustomOverlays(overlays =>
                {
                    //overlays.GoogleOverlay(“Google Map”).GoogleMapType(GoogleMapType.Physical);
                    //overlays.OpenStreetMapOverlay(“Open Street Map”);

                    overlays.WmsOverlay(“WMS Overlay”)
                                     .WebImageFormat(WebImageFormat.Jpeg)
                                     .Parameters(paras =>
                                     {
                                         paras.Add(“LAYERS”, “WorldMapKitRL_SPHMCT”);
                                         paras.Add(“STYLES”, “DEFAULT”);
                                         paras.Add(“SRS”, “EPSG:4326”);
                                     })
                                  .ServerUris(uris =>
                                  {
                                      for (int x = 0; x <= 16; x++)
                                      {
                                          uris.Add(new Uri(“GEOWMS.USAC.MMM.COM:80/WmsHandler.axd”));
                                      }
                                  })
                                  .IsBaseOverlay(true)
                                  .TileType(TileType.SingleTile).TileHeight(368).TileWidth(368).TransitionEffect(TransitionEffect.Stretching);

                })
                .MarkerOverlay(markerOverlay =>
                {
                    markerOverlay.Name(“MarkerLayer1”)
                        .IsBaseOverlay(false)
                        .ZoomLevelSet(zoomlevelSet =>
                        {
                            HtmlString _html1 = new HtmlString("<div class=‘small’> <h2>[#name#]</h2></div>");
                            HtmlString _html2 = new HtmlString("<div class=‘medium’> <h2>[#name#]</h2> <h3>Ship to Name: [#shipToname#]</h3></div>");
                            HtmlString _html3 = new HtmlString("<div><h2>Name:[#name#]</h2> <h3>Ship to Name:[#shipToname#]</h3> <h3>Ship to Address:[#shipToaddress#]</h3> <h4>Sales :[#sales#]$</h4> <h6>Customer:[#customerId#]</h6> </div>");

                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageVirtualPath = @"/App_Themes/img/Places/High Detail/24x24/Places - High Detail Commercial Store 1.png";
                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = _html1.ToHtmlString();
                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.AutoSize = false;
                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.IsVisible = true;
                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.HasCloseButton = false;
                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Width = 100;
                            zoomlevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Height = 15;
                            zoomlevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level12;

                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.WebImage.ImageVirtualPath = @"/App_Themes/img/Places/High Detail/48x48/Places - High Detail Commercial Store 1.png";
                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.Popup.ContentHtml = _html2.ToHtmlString();
                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.Popup.AutoSize = false;
                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.Popup.IsVisible = true;
                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.Popup.HasCloseButton = false;
                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.Popup.Width = 200;
                            zoomlevelSet.ZoomLevel13.DefaultMarkerStyle.Popup.Height = 20;
                            zoomlevelSet.ZoomLevel13.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level15;

                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.WebImage.ImageVirtualPath = @"/App_Themes/img/Places/High Detail/128x128/Places - High Detail Commercial Store 1.png";
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.ContentHtml = _html3.ToHtmlString();
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.AutoSize = false;
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.IsVisible = true;
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.HasCloseButton = false;
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.Width = 450;
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.Height = 100;
                            zoomlevelSet.ZoomLevel16.DefaultMarkerStyle.Popup.OffsetXInPixels = -50;
                            zoomlevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                        });
                })
                .Render();
                }
            </div>
        </div>
    </div>
    <div class=“footer”></div>
</body>
<script type=“text/javascript”>
    var _controllerId = ‘@ViewContext.RouteData.Values[“Controller”].ToString()’
</script>
@Scripts.Render("~/BundleScripts")
</html>


 


I found that there is some code that could be inserted by MapSuite MVC before the base ref html tag that is used to give the path to the application folder on the web server....  is this something expected???

 



Hi Jean-marie, 
  
 Our web handler use the opposite path, it looks some code don’t work well with base href tag. 
  
 Sorry it’s not easy to change it, we need some more thinking about it. 
  
 For now, maybe you can try to set IsDefaultJavascriptLibraryDisabled on map and add them by full linke manually. 
  
 These JS library include: 
  1, opl_GeoResource.axd 
  2, extension_GeoResource.axd 
  3, helper_GeoResource.axd 
  4, parser_GeoResource.axd 
  5, func_GeoResource.axd 
  6, cm_GeoResource.axd 
  
 If possible, could you put your code in a simple single project so that we can go on working for it? 
  
 Regards, 
  
 Don

Hi Don 
  
 The code works fine when using dev studio however when deployed on the production web server then the issue is visible.  Our production web server is structured like this root->china->demoA and the application is setup inside the demoA folder.  the url to this folder looks like geoweb.usac.mmm.com/china/demoA.   looks like that when the MVC application is not at the root off the web server then mapsuite is having trouble to find is way. 
  
 thanks 
  
 jm.

Hi, 
  
 I was able to extract the scripts.  Now my application work without any issue at all!!!  I would like to know if you could provide the scripts in a native format that could be used right away with the script flag library set to false?  Doing so is giving to you customer the possibility to chose and also to optimize the script load process using bundling and minification if needed.  The most difficult was to find the right sequence order for the scripts. 
 Why do you use .axd and not .js for your scripts? I shall upload my demo application on the forum for you to see it. 
  
 thanks. 
 jm.

 Hello Jean-marie,


 
Thanks for your further information, glad to hear that your problem has been solved. Here are six important JS files which you can find at client side :
• opl_GeoResource.axd?v=6.0.0.0 (OpenLayers.js)
• extension_GeoResource.axd?v=6.0.0.0 (OpenLayersExtension.js)
• helper_GeoResource.axd?v=6.0.0.0 (MapHelper.js)
• parser_GeoResource.axd?v=6.0.0.0 (MapParser.js)
• func_GeoResource.axd?v=6.0.0.0 (GeoFunction.js)
• cm_GeoResource.axd?v=6.0.0.0 (ContextMenu.js)
 
the JS file wrapping in parentheses is the original file on the disk. And the loading sequence is also like the above.
 
As for why the extension .axd not .js? the .axd file is a Http handler file which is embedded by the server controls. More information please check out here.
 
If you have any queries, please feel free to let us know.
 
Regards,
 
Gary