Search code examples
openlayersopenstreetmap

OpenLayers: creating a minimal map


I'm sorry for this basic question. But I'm pretty new with OperLayers. As a first step, I want to show the OpenStreetMap which is already zoomed on Vienna. The code displays a map with an OpenStreetMap layer centered on Nottingham. Instead of Nottingham I want Vienna.

The code of Nottingham


Solution

  • Even if I (as @kryger) don't understand what the exact problem is (I hope you don't ask at SO others just for a pair of coordinates?), I will try an answer:

    You can have a look at the source of this example: http://openlayers.org/dev/examples/osm.html The only thing you have to modify are the startup coordinate pair:

    ...
    new OpenLayers.LonLat(16.3866, 48.1913).transform(...)
    ...
    

    You can find this coordinates, if you browse OSM and have a look at the URL http://www.openstreetmap.org/node/17328659#map=12/48.1913/16.3866


    Maybe it's just an misunderstanding and don't call me rude, but every support community expects minimal work by the questioner. A study of http://openlayers.org/dev/examples/ seems to be not to hard esp. for new users. Anyway have fun with Openlayers :)