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 9275037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:29:41+00:00 2026-06-18T16:29:41+00:00

As i red from the readme file, openlayers.js has multiple choices for including files

  • 0

As i red from the readme file, openlayers.js has multiple choices for including files and themes.

What i would like is to use the lightest solution of openlayers.js files.

I included the openlayers.light.js in my app, and it creates maps but do not show them, check this:

enter image description here

do i forgot to include some other file?

my structure structure is this:

/vendor
   /js
     openlayers.light.js
     /img
     /theme

how to show maps layers?

Also does the openlayers.light.js will work on mobile devices (once fixed this problem 😛 )? or i’ll need to include openlayers.mobile.js too?

This is the code not working with openlayers.light.js but working with openlayers.js (740kb) :

var _element = "#map";
 var map = new OpenLayers.Map (_element, {
    controls: [
    new OpenLayers.Control.Navigation({
      dragPanOptions: {
        enableKinetic: true
      }
    }),
    new OpenLayers.Control.Zoom()
    ],
    projection: new OpenLayers.Projection("EPSG:900913"),
    displayProjection: new OpenLayers.Projection("EPSG:4326")
  });

  var lonLat = new OpenLayers.LonLat(_lon, _lat).transform (
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
// map.getProjectionObject() doesn't work for unknown reason
);
  var markers = new OpenLayers.Layer.Markers( "Markers" );
  map.addLayer(markers);

  var size = new OpenLayers.Size(21,25);
  var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
  var icon = new OpenLayers.Icon(_img_map_marker, size, offset);
  markers.addMarker(new OpenLayers.Marker(lonLat, icon.clone()));

  var mapnik = new OpenLayers.Layer.OSM("Test");
  map.addLayer(mapnik);

  map.setCenter (lonLat,3);

PS: my openlayers map js init method is ok, it works using the huge openlayers.js (740KB), but not working with openlayers.light.js as i showed above

html

<div id="map"></div>

css

img{max-width:none;}
#map{
width:300px;
height:300px;
}
  • 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-18T16:29:42+00:00Added an answer on June 18, 2026 at 4:29 pm

    if you want to use mobile properties with openlayers as panning or zooming with hand you have to use openlayers.mobile.js.

    you can use openlayers.light.js with mobile devices but not mobile functions.

    i think your structure should be :

    myProject
       /js
          openlayers.light.js
       /img
       /theme
    

    and i have tried openlayers.light.js in http://jsfiddle.net/aragon/ZecJj/ and there is no problem with it.

    My code:

    var map = new OpenLayers.Map({
        div: "map",
        minResolution: "auto",
        maxResolution: "auto",
    });
    
    var osm = new OpenLayers.Layer.OSM();
    var toMercator = OpenLayers.Projection.transforms['EPSG:4326']['EPSG:3857'];
    var center = toMercator({x:-0.05,y:51.5});
    map.addLayers([osm]);
    
    
    map.setCenter(new OpenLayers.LonLat(center.x,center.y), 13);
    

    and try to read Deploying (Shipping OpenLayers in your Application).

    OpenLayers comes with pre-configured examples out of the box: simply
    download a release of OpenLayers, and you get a full set of easy to
    use examples. However, these examples are designed to be used for
    development. When you’re ready to deploy your application, you want a
    highly optimized OpenLayers distribution, to limit bandwidth and
    loading time.

    you can change src file with this link and can see it still works.

     <script type="text/javascript" src="http://openlayers.org/dev/OpenLayers.light.debug.js"></script>
    

    to

    <script type="text/javascript" src="https://view.softwareborsen.dk/Softwareborsen/Vis%20Stedet/trunk/lib/OpenLayers/2.12/OpenLayers.light.js?content-type=text%2Fplain"></script>
    

    i hope it helps you…

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

Sidebar

Related Questions

Is there a way to change MKAnnotationView style (like from red label with number
I would change the color from red to green of an annotation when the
Has anyone taken JBoss Application Administration course or any other courses from Red Hat?
anyone know how can i use VSM chang a textblock text color from Red
Sometimes when I set a breakpoint and start debugging its color changes from red
i have the following code, taken partly from a Red Black Tree Java implementation.
The textbook I'm learning from (Lafore) presents Red-Black Trees first, and does not include
I need to create a 'red' image from a grayscale image. I am using
How do I create a string of each 3rd li, resulting in black,red,blue from
I would like to show the user some help on specific operations in my

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.