1. Frequently Asked Questions about the OpenLayers project
  2. General
    1. How can I add a question to this FAQ?
    2. Where do I find more info?
  3. Project Organization
    1. How many developers are involved in the deployment of OpenLayers?
    2. How is the development of OpenLayers ensured in the future?
    3. What is MetaCarta's relationship to the OpenLayers project?
    4. Can I pay someone to help me with OpenLayers?
  4. TRAC
    1. How do I edit the wiki?
  5. github
    1. How do can I get commit access to the github repository?
    2. How do update my fork from master?
  6. Map
    1. How do I get a specific bounds to load just right into my Map Div?
    2. How do I get the LonLat from a pixel or from the current position of the …
    3. Why do I see repeated, chopped off layers in my map?
    4. Projections
    5. How can i trace path on openlayers map using latitude and longitude ?
  7. Popups
    1. Why don't borders show up on my popups?
  8. Controls
    1. How do I make an OpenLayers map without any controls?
  9. OverviewMap
    1. Why does the OverviewMap display on the top/left of the map and not in …
  10. Layers
    1. How do I configure Zoom Levels/Resolutions/Scales?
    2. Can I see ArcGIS layers in my OpenLayers Map?
    3. What is the maximum amount of layers I can have in my OpenLayers Map?
  11. WMS
    1. How can I see the URL string that OpenLayers is sending to a WMS server?
    2. My Tiles are all pink! What can I do?
    3. Where can I get some free WMS layers on the web to use with OpenLayers?
  12. WFS
    1. Why isn't WFS working on my local checkout of OpenLayers?
    2. I'm trying to use WFS, why won't my vector data show up?
  13. GeoRSS
    1. Why isn't GeoRSS working on my local checkout of OpenLayers?
    2. If I have multiple points at the same location, how do I make them all …
  14. Google
    1. How do I load tiles I have that I generated for Google Maps in …
    2. Is it possible to see Google's StreetView in an OpenLayers Map?
  15. VE
  16. Yahoo
  17. Multimap
  18. ProxyHost
    1. Why do I need a ProxyHost?
    2. How do I set up a ProxyHost?
  19. Markers
    1. Why is My Map Sluggish when I Add 500 Markers?
    2. Why don't my markers appear at certain zoom levels?
  20. Vector Related Questions
    1. Why do I get "Your browser doesn't support Vectors" when building my own …
    2. Why don't vectors change while I'm dragging?
    3. Why won't my vector layer work in IE before my page is done loading?
    4. Why don't vectors work in $browser?
    5. Why don't my vector features work over Google, Yahoo, Virtual Earth, etc.?
    6. What is the maximum number of Coordinates / Features I can draw with a …
  21. Misc
    1. How do I set up OpenLayers to run with TileCache?
    2. How Do I Build a Single-File Version of OpenLayers?
    3. How Do I display 2 Image layers?
    4. What is the relationship between EditingToolbar and …

Frequently Asked Questions about the OpenLayers project



General

How can I add a question to this FAQ?

Please feel free to add OpenLayers questions to this page--we'll try to answer them for you.

Where do I find more info?

Here on this wiki. Click on the TitleIndex to see a list of available pages.

Back to Top



Project Organization

How many developers are involved in the deployment of OpenLayers?

For a list of OpenLayers developers with commit access, see Committers.

Besides these developers, we currently (01/2007) have about a dozen signed Contributer Licence Agreements (See the "Upload Your Patch" section of HowToContribute). These are people who follow the development of the project and locate bugs and contribute patches via tickets and the email list.

How is the development of OpenLayers ensured in the future?

The OpenLayers project is overseen by a Project Steering Committee which attempts to reflect the varied interests of the OpenLayers community. By having a number of users with commit access to the project, the project is not limited to the whims of any particular corporate decisions, and any questions where consensus is not straightforward/obvious require a vote by the Steering Committee.

OpenLayers has graduated from the incubation process and is now a full fledged  Open Source Geospatial Foundation (OSGEO) project. Similar to the  Apache or  Mozilla Foundations, OSGeo seeks to offer a home for projects to ensure that the project is maintained now and into the future.

As part of that process, we are striving to create a project which is both useful and long-lived. We hope to create a self-maintaining project with a wide variety of disparate contributors, so that the community is not tied to any specific corporate interests. [ We have put a lot of time into making a project anyone can contribute to. Our commit process is designed to lower the bar as much as possible, and in general, we seek to create an environment where all users are free to assist in the project. By doing so, we hope to achieve utility and longevity into the forseeable future.

What is MetaCarta's relationship to the OpenLayers project?

OpenLayers is an independent project sponsored by  MetaCarta. MetaCarta uses the OpenLayers library in some of its products.

Can I pay someone to help me with OpenLayers?

Of course! Generally speaking, the core OpenLayers dev team is tied up with other projects and only has the smallest amount of time to spend on OpenLayers development. So unless you have a big project to propose, it's better to get in touch with some other contractors. A good place to find them is via the  OSGEO website

Back to Top


TRAC

How do I edit the wiki?

You will need a wiki account. To get a wiki account, simply go to  https://www.osgeo.org/cgi-bin/ldap_create_user.py and create an OSGeo User account ,which you will be able to use to login to Trac/Wiki.

To create a new page on the wiki:

  1. Choose a name for your new page (e.g. PageName).
  2. Log in and edit an existing page.
  3. Place a link to your new page where appropriate (e.g. [wiki:PageName Page Title]).
  4. Enter a comment about your change and save the modified page.
  5. Follow the link to your page and click the "create new page" button.

Remember to enter comments about the changes you make. And clear your edits with someone on the Project Steering Committee.

For more info on making tickets, see FilingTickets.


Back to Top



github

How do can I get commit access to the github repository?

You are invited to fork us on github, and create pull requests. This will normally provide you with enough freedom to tell OpenLayers developers about bugs in the source code, or features you want to add.

HowToContribute has more information on contributing to the OpenLayers trunk or becoming an OpenLayers Committer.

How do update my fork from master?

Make sure you add a remote:

git remote add ol git@github.com:openlayers/openlayers.git

and then just pull from the upstream master e.g. by:

git pull ol master

Back to Top


Map

How do I get a specific bounds to load just right into my Map Div?

You have to specify a maxExtent and set the maxResolution to "auto":

         layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                                            "http://labs.metacarta.com/wms/vmap0?", 
                                            {'layers': 'basic'},
                                            {'maxExtent': new OpenLayers.Bounds(-180,-90,180,90), 
                                             'maxResolution': "auto"});
         map.addLayer(layer);
         map.zoomToMaxExtent();

Related Links: SettingZoomLevels

How do I get the LonLat from a pixel or from the current position of the mouse?

Use the getLonLatFromPixel() function of the map object to translate from an xy pixel value into longitude and latitude.

Ex:

  var pixel = new OpenLayers.Pixel(110,24);
  var lonlat = map.getLonLatFromPixel(pixel);
  alert("Lat: " + lonlat.lat + " (Pixel.x:" + pixel.x + ")" + "\n" + "Lon: " + lonlat.lon + " (Pixel.y:" + pixel.y + ")" );

For a live html example of getting the lon/lat of the current mouse position, see:
 http://www.openlayers.org/dev/examples/lonlatfrompx.html

To add a tool that automatically displays the current mouse position's lonlat on the map, see Control/MousePosition

Why do I see repeated, chopped off layers in my map?

This is a known behaviour in MapServer when serving tiled images. You can work around on this by adding "PARTIALS FALSE" to your MapServer Label definition.

Projections

OpenLayers supports any projection. A projection is a way of converting geographic coordinates -- latitude and longitude -- into a plane. There are three parameters in OpenLayers which are important to set if you wish to change projections:

  • maxExtent
  • maxResolution
  • projection

These parameters are set, respectively, by default to:

  • -180,-90,180,90
  • 1.40625
  • EPSG:4326

maxExtent is the maximum bounds, in the units of your map, of the plane in which you want to display information. maxResolution is the number of mapunits per pixel at the highest zoom level, and the projection is used when issuing WMS or WFS requests to inform the server of the projection desired.

You should also change the 'units' property on your map: this property is what allows OpenLayers to know what scale things are being rendered at, which is important for scale-based methods of zooming and the Scale display control.

A map constructor which uses a different projection might look like:

new OpenLayers.Map("map", {maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34), maxResolution: 156543, units: 'meters', projection: "EPSG:41001"});

How can i trace path on openlayers map using latitude and longitude ?


Back to Top



Popups

Why don't borders show up on my popups?

If you are using the OpenLayers.Popup.AnchoredBubble class, you will notice that no matter what you set for borders, they will not show up. This is because of the use of the RICO Corners, which do not allow Borders (as far as we know). If you want to have border's, for now you will have to use the OpenLayers.Popup.Anchored class.


Back to Top



Controls

How do I make an OpenLayers map without any controls?

Pass an empty array as the 'controls' property when initializing the map.

            map = new OpenLayers.Map( $('map'), {controls: [] } );

Related Links: DefaultControls

Back to Top



OverviewMap

Why does the OverviewMap display on the top/left of the map and not in the default position?

The position of the Overview Map is controlled by CSS, loaded to the page automatically when the map is created. This CSS is stored in the 'theme' directory: if you do not have a theme directory alongside the 'img' directory that OpenLayers is using, this CSS can not be loaded, and the map will be displayed in the upper left, instead of the properly CSS positioned lower right.

Related Links: Control/OverviewMap

Back to Top



Layers

How do I configure Zoom Levels/Resolutions/Scales?

See SettingZoomLevels

Can I see ArcGIS layers in my OpenLayers Map?

Yes you can, search the examples page for the keyword ArcGIS.

What is the maximum amount of layers I can have in my OpenLayers Map?

The limit is about 75. After that, layers can appear above popups. This has to do with the z-index in CSS (determines what is 'above' what). Layers (overlay) start at a z-index of 325. Popups start at 750. Controls start at 1000.

Every layer 'takes up' about 5 indexes, so it will reach it's limit at around 75 layers. You cannot have more than 250 popups for the same reason.

If you need more than 75 layers, consider destroying the ones you don't show instead of hiding them and recreate them when needed.

Back to Top



WMS

How can I see the URL string that OpenLayers is sending to a WMS server?

Thanks to Mike Q for summarizing the responses to this one

  • Yves J recommended using the Firefox extension Firebug ( http://www.getfirebug.com/). It does a fantastic job of obtaining the URL strings, and many other useful debug tasks.
  • Tim L recommended checking the Apache access_log files. This works great for natively hosted WMS. Very easy to check.
  • Jon B suggested using the getURL function, as in the following:
    alert(my_wms.getURL(new OpenLayers.Bounds(...)));
    
  • Christopher S mentioned that
    • Grid layers have a grid property that contains an array of an array of tiles, with each tile having a URL object.
    • One can simply right click on an image tile to obtain the URL property information.

My Tiles are all pink! What can I do?

See [TroubleshootingTips]

Where can I get some free WMS layers on the web to use with OpenLayers?

See Available WMS Services

Back to Top



WFS

Why isn't WFS working on my local checkout of OpenLayers?

This is probably because you do not have a proxy host set up. See FrequentlyAskedQuestions#ProxyHost

I'm trying to use WFS, why won't my vector data show up?

Try not setting the featureClass property when declaring your WFS layer.

Back to Top



GeoRSS

Why isn't GeoRSS working on my local checkout of OpenLayers?

This is probably because you do not have a proxy host set up. See FrequentlyAskedQuestions#ProxyHost

If I have multiple points at the same location, how do I make them all visible on click?

Back to Top



Google

How do I load tiles I have that I generated for Google Maps in OpenLayers?

See this wiki page for more information: UsingCustomTiles.

Is it possible to see Google's StreetView in an OpenLayers Map?

Believe it or not, yes... somebody has actually done it! The  Tutorial popped up on the  Fuzzy Tolerance Blog. You can see it live and working in the  GeoSpatial Portal for Mecklenberg County GIS (Click the bottom + sign on the left). Not quite the same level of UI as the folks at Google give it, but still... an interesting mashup.

Back to Top



VE

Back to Top



Yahoo

Back to Top



Multimap

Back to Top



ProxyHost

Why do I need a ProxyHost?

Due to security restrictions in Javascript, it is not possible to retrieve information from remote domains via an XMLHttpRequest.

Classes like WFS and GeoRSS use XMLHTTPRequest to get their data. If they are querying a remote server (anything other than the machine hosting your page), you must install a proxy script somewhere web accessible on that machine. See below for how to set up your own ProxyHost.

If the OpenLayers.ProxyHost variable is not set to a valid proxy host, requests are sent directly to the remote servers. In most cases, the result will be a security exception, although this exception often occurs silently.

How do I set up a ProxyHost?

An example proxy host script is available here: trunk/openlayers/examples/proxy.cgi

For the standard Apache configuration, you would place proxy.cgi into your /usr/lib/cgi-bin/ directory.

Once a proxy host script has been installed, you must then edit the OpenLayers.ProxyHost variable to match that URL.

Given the above standard Apache configuration:

    OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

If you have done something like this, you should be able to visit:

 http://YourDomain.example.com/cgi-bin/proxy.cgi

The resulting content at that page should be the openlayers.org website.

If you get a 404 error instead, either the proxy script is not in the right location, or your webserver is not configured correctly.

Back to Top


Markers

Why is My Map Sluggish when I Add 500 Markers?

Browsers can't handle moving around a DOM with more than a few hundred elements at once. I highly recommend figuring out a way to limit yourself to under 500 markers (Firefox) or 50 markers (IE6).

Why don't my markers appear at certain zoom levels?

The problem is that your markers layer is considered 'out of range' for some reason. The source of the problem is probably to do with the "resolutions" setting on the base layer. One fix is to override the calculateInRange function to always return true, eg:

//Original
Markers = new OpenLayers.Layer.Markers("Markers");

//override the calculateInRange function to always return true
Markers = new OpenLayers.Layer.Markers("Markers", {'calculateInRange': function() { return true; }});

Also see  this mailing list thread, particularly  this post

Back to Top


Vector Related Questions

Why do I get "Your browser doesn't support Vectors" when building my own copy of OpenLayers?

You must build with ./build.py full -- the default OpenLayers build does not include Vector Support.

Why don't vectors change while I'm dragging?

As a performance enhancement, vectors do not update their visual representation while the map is being dragged. Instead, they update when the mouseup event fires. For this reason, while dragging, you may occasionally see 'cut off' vector features.

Why won't my vector layer work in IE before my page is done loading?

http://openlayers.org/pipermail/dev/2007-March/000445.html and the rest of the thread.

Adding the following statement before the call to create the vector layer can potentially solve the issue:

    document.namespaces;

Why don't vectors work in $browser?

The Vector Layer and its subclasses currently support a set of renderers which do not cover all browsers. The renderers which are currently implemented are:

  • SVG: Supported by Opera, Firefox. W3C Standard. (SVG Will Not Work with plugins: support for  Compound Document Format is required.)
  • VML: Supported by Internet Explorer 6 and 7.

This means that currently, Safari and Konquerer are not supported. The latest Safari Beta, available from Apple's website, does support SVG.

If you are interested in changing this, the solution is to write additional renderers for other libraries. The Renderer() main class defines an API stub that you can use to implement your own renderer for other rendering tools.

Why don't my vector features work over Google, Yahoo, Virtual Earth, etc.?

The vector layers assume a square pixel size. The Commercial APIs, by default, use a non-square geographic pixel size -- one that changes as the map moves north and south. The only way to use vector layers over commercial basemaps is to use the SphericalMercator support in 2.5. This causes the map to be projected to mercator, and once the map is projected, pixels are geographically square, which means you can use a vector layer over them.

What is the maximum number of Coordinates / Features I can draw with a Vector layer?

Technically speaking, there are no limits. Performance-wise, however, you will want to keep things reasonable. Our observations so far* have shown the following as rough upper bounds on what is reasonable to expect a browser to be able to handle:

  • ~2500 Coordinates
  • ~100-200 Features (Since each geometry is rendered as a separate DOM object, dragging and the like get seriously slowed down the more features you have on the map.)

* If you have different or more complete (browser-specific, precise figures, etc.) data, please insert it here!

Back to Top


Misc

How do I set up OpenLayers to run with TileCache?

The TileCache distribution includes an HTML example, index.html, which shows how to use it with OpenLayers. Assuming that your bbox and resolutions array are the defaults, it should be really simple -- when they're not anymore, things get a bit more difficult.

How Do I Build a Single-File Version of OpenLayers?

See Profiles

How Do I display 2 Image layers?


What is the relationship between EditingToolbar and DrawFeature/ModifyFeature controls?

You would think that they MUST be able to work together but I could not get any info on that anywhere. A "realistic" entry in the Development Examples page of using EditingToolbar + DrawFeature + ModifyFeature would be greatly appreciated. Thanks in advance, A.R.