Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:56:22+00:00 2026-06-10T17:56:22+00:00

I have a pretty basic setup of a map with openlayers, and just 3

  • 0

I have a pretty basic setup of a map with openlayers, and just 3 controls, built in an MVC project. For soem reason though, the navigation control and the panzoombar do not show (although the mouseposition one does). I see them for an instant while the map loads, but then they disappear. Below is my code that i use to make this happen. Can anyone tell me what i’m doing wrong?

        function initNormMap() {
        var map;
        OpenLayers.DOTS_PER_INCH = 72;
        map = new OpenLayers.Map('divmap', {
            controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.MousePosition()
            ], units: 'm',
            projection: new OpenLayers.Projection("EPSG:900913"),
            displayProjection: new OpenLayers.Projection("EPSG:4326")
        });
        //http://trac.osgeo.org/openlayers/wiki/AvailableWMSServices
        var ol_wms = new OpenLayers.Layer.WMS("OpenLayers WMS",
                    "http://labs.metacarta.com/wms/vmap0",
                      { layers: 'basic' });

        var osm_wms = new OpenLayers.Layer.OSM();
        map.addLayers([osm_wms]);
        var fromProjection = new OpenLayers.Projection("EPSG:4326");   // Transform from WGS 1984
        var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
        var position = new OpenLayers.LonLat(-98, 39).transform(fromProjection, toProjection);
        var zoom = 4;
        map.setCenter(position, zoom);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:56:24+00:00Added an answer on June 10, 2026 at 5:56 pm

    Problem turned out to be with MVC4 bundling, which doesn’t seem to work well with openlayers at all. I had in my BundleConfig.cs file:

    var openBun = new ScriptBundle("~/bundles/openlayerjs").Include("~/OpenLayers-2.10/OpenLayers.js");
            openBun.CdnPath = @"http://cdnjs.cloudflare.com/ajax/libs/openlayers/2.11/OpenLayers.js";
            bundles.Add(openBun);
    

    and in my actual .cshtml page:

    @Scripts.Render("~/bundles/openlayerjs")
    

    I even tried it without the CDNPath, and still got the same issue each time. changed to just straight

    <script type="text/javascript" src="@Url.Content("~/OpenLayers-2.10/OpenLayers.js")"></script>
    

    and it works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup some tabbed navigation on my ASP.NET Masterpage. It is pretty basic:
I have a pretty basic NHibernate setup. I am not using Castle Widnsor or
Ok so I have a very basic module setup. It's just a test module
I am somewhat new to PHP and MySQL, and have just setup a basic
I have a pretty basic tiles1 setup with header, menu, and content as so:
I might have pretty basic question about regex. I have the following regex, which
I have a pretty basic challenge-based iPhone game, and I wanted to know what
I have a pretty basic doubt on dirty read/writes to a value stored in
I have a pretty basic problem but I can't seem to figure it out...
Pretty basic programming question, I know PHP have a function for it, but does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.