Getting started with OpenLayers | switch2osm

OpenStreetMap data is rich and detailed, containing huge amounts of data which is relevant to people on the ground - the people who collected it. OpenStreetMap is updated every minute of every hour of every day, and these updates are available to you in real-time. Our fantastic community is making OpenStreetMap better right now. If there are features you need - you can add them and see them live within minutes. With OpenStreetMap data you can create your own map, showing the features that you want to show, the features which are important to your users. OpenStreetMap data covers the whole world, making it easy to support users in any country, or every country. With OpenStreetMap data, your only obligations are to attribute and share-alike, as explained in our license. OpenLayers has long been the standard choice for embedding a browsable OpenStreetMap view into a webpage. A mature and comprehensive library (over 400k of minimised JavaScript), it has a moderate learning curve but is capable of many applications beyond a simple “slippy map”: its features include full projection support, vector drawing, overview maps, and much more. On this page we explain how to create a very simple embedded map, but there are many more examples on OpenLayers.org showing the full capabilities of the software. This example shows how to initialise a map object which will appear within a div on your HTML page. A LonLat object is created to represent the centre point of the map. Try playing with the latitude, longitude values. A call to ‘transform’ sorts out the projections, and we use this same location to place a marker. The above example also shows how, with a script tag, you can reference the OpenLayers javascript hosted remotely at openlayers.org . There are advantages and disadvantages to this approach. The alternative is to download OpenLayers and host it yourself alongside your HTML. You can download a zip file from openlayers.org which contains many files, only some of which are needed. In fact you might use only OpenLayers.js a single file of compacted javascript. The ‘theme’ and ‘image’ directories are also needed if you wish to self-host all of the required resources. You can configure visual aspects of OpenLayers using those files. The ‘lib’ directory has the source javascript before it was compacted into a single file, but you can actually run OpenLayers in ‘multi-file’ mode from these. That can be a good idea as you develop with the OpenLayers API, since browser error reports will take you to line numbers showing something more meaningful. However you chose to work with OpenLayers, the library is fully open-source (under a modified BSD license) and can be used for free in your projects and commercial products. Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified:
Fatal error: Call to undefined function mdv_last_modified() in /home1/wacedu0abjm6/public_html/wp-content/themes/CherryFramework/footer.php on line 121