Adding a line layer

You're probably familiar with seeing lines on map applications indicating a route or path. A line layer is quite similar to a point layer. They are both defined by their coordinates. The difference is that a line layer requires two sets of coordinates [(x1 y1), (x2 y2)], whereas a point has only an (x y) coordinate.

  1. Create a new dataset with the following T-SQL command, and name it ds_Mapline:
    SELECT CAST('LINESTRING(
      -122.164644615406 47.7869921906598,
      16.0414569096018 49.6523079296896,
      -122.164644615406 47.7869921906598,
      2.32573072365188 48.8385347036971,
      -122.164644615406 47.7869921906598,
      6.93164071591788 51.5966635525063,
      -122.164644615406 47.7869921906598,
      20.0414569096018 49.6523079296896
    )' AS GEOGRAPHY) as Line

    Tip

    Or just find the script named SpatialLine.sql included in this chapter, and copy the T-SQL command.

    You may be wondering what these coordinates (spatial data) are; these are randomly selected from the Person.Address table in the AdventureWorks2012 database.

  2. In the Map Layers pane, add Line Layer. Access the layer data property from the contextual menu of LineLayer1 (of course the name of the layer would be different if you changed it), and select Layer Data.
  3. In the General tab, select Spatial field in a dataset. Select ds_Mapline from the Dataset name drop-down textbox.
  4. We only have one column on this dataset, Line, so select that for the Spatial field name.
    Adding a line layer
  5. Click on OK when done.
  6. Change the line width to 1.25pt and the color to gradient red in the Line Properties window.
  7. Click on OK when done.

Let's preview our map with the added line layer:

Adding a line layer
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.220.22