zoukankan      html  css  js  c++  java
  • Working With OpenLayers(Section 1: Creating a Basic Map)

    Working With OpenLayers

    This module walks through the basics of creating web maps with OpenLayers. The reader will learn how to create an OpenLayers map from scratch, overlay data from various sources, and work with vector feature editing and styling.

    In this module you will:

    • Learn how to create a map from scratch with OpenLayers.
    • ·       Learn how to overlay various types of data on different base layers.
    • ·       Learn how to edit and style vector data client-side.

    Before you start:

    • ·       Ensure that Module 4: Creating a Base Map has been completed.
    • ·       It is recommended (but not required) to use Firefox and install Firebug.

    Links to have on hand:

    Section 1: Creating a Basic Map

    1. Navigate to the following directory:

      C:Program FilesGeoServer 1.6.5data_dirwww

    2. Create a new file called ol-basics.html.
      1. Open ol-basics.html in the text editor of your choice and enter in the following text:

    <html>

      <head>

        <title>Basic Map</title>

        <style type="text/css">

          #map_container {

            512px;

            height: 256px;

            border: 1px solid gray;

          }

        </style>

        <script src="openlayers/OpenLayers.js">

        </script>

      </head>

      <body>

        <h2>Basic Map</h2>

        <div id="map_container"></div>

        <script>

          // your application code here

        </script>

      </body>

    </html>

      1. Save changes to ol‑basics.html.
      2. 1. Visit the following url in the web browser:

        http://localhost:8910/geoserver/www/ol-basics.html

        2. Open ol-basics.html.

        1. Locate the line “// your application code here” and replace it with the following:

        var map = new OpenLayers.Map("map_container");

        var wms = new OpenLayers.Layer.WMS(

          "OpenLayers WMS",

          "http://labs.metacarta.com/wms/vmap0",

          {layers: "basic"}

        );

        map.addLayer(wms);

        map.zoomToMaxExtent();

        4. Save changes to ol-basics.html.

        5. Return to the web browser and refresh the page. (F5)

  • 相关阅读:
    相机中白平衡的算法模拟实现
    双边滤波算法的简易实现bilateralFilter
    图像处理卷积算法实现
    最快的3x3中值模糊
    黑米手机抢购软件通杀破解补丁
    分享一款12306购票软件
    快速堆栈模糊算法
    大数据(1)---大数据及HDFS简述
    springboot自动装配(3)---条件注解@Conditional
    随机瓜分百万红包
  • 原文地址:https://www.cnblogs.com/xuanfengling/p/3412998.html
Copyright © 2011-2022 走看看