Author Archive: GMD

Upload Shapefiles to SQL Server Spatial in QGIS

To import Shapefiles into SQL Server without the use of scripts such as Ogr2ogr, we can easily use QGIS instead. Make sure you have SQL Server and SQL Server Management studio installed.

Open QGIS and in the Browser panel add a new connection by right clicking on MSSQL.

Enter a connection name and enter the server name used in SQL Server. Click ‘List Databases’ to see the tables.

Once the SQL server connection has been established, you can drag shapefiles and other GIS formats directly into the SQL server connection.

Change the Levels of Features in the same Layer in QGIS

We will move a feature above/below another feature in the same layer in QGIS. In this example we want to move the green hatched polygon above the pink hatched polygon.

Open the properties for the layer and go to the Advanced drop down.

Change the level number of the features you want to move above a higher number than the features you want to move below.

In this example, Layer 0 column refers to the hatching pattern, and the Layer1 column refers to the outline of the polygon. Click apply and the features order will rearrange.

Draw lines specifying length and angle

This function in QGIS allows for CAD-like drafting.

Go to View menu>Panels and show “Advanced Digitizing Panel”

advanced draw

Click the “Add feature” icon and click the start point on the map.

type the “d” key on your keyboard and enter the distance. press enter. This will set the distance.

type the “a” key on your keyboard and enter the angle. press enter. This will set the angle of the line.

How to make your text labels standout on an aerial photo map

text color black

When creating a map with an aerial photo as it’s base, it is important to make the text labels stand out as plain text can get easily drowned out by the background colors.

text color Yellow

Yellow is often an appropriate color when the aerial photo is mainly made up of darker colors.

text color buffer

However yellow may not be very visible on light colors like white. A text buffer can overcome this issue. In the example above, I have used yellow text with a black buffer but black text with light buffer is just as effective.

text color curved

When labeling curvy features such as rivers and roads it is better to curve the text so that it sits neatly along the feature. This function in QGIS is found in the placement option in the layer properties as shown below.

text placement qgis

 

These are some tips to make your aerial photography maps easier to read and interpret. If you have any comments please let me know below.

How to add a legend to a map in QGIS

Open composer and click on the “add legend” button as shown below.

add legend button crop

Once the legend has been added to the map, you can add and remove map layers from the legend as shown below.

add items to legend

You can also add a frame around the legend box and change the background color to improve the visibility of the legend items if necessary.

frame and background color small

Make text standout in QGIS

To make text standout from other map features we can either add a rectangle background or a buffer behind the text.

plain text

To change the properties of the text labels, double click on the layer containing the text > Labels > Background>Draw Background as shown below.

background on text

background on text 2

Alternatively you can add a buffer around the text. This option reduces the amount of map features being covered by the text background.

Double click on the layer containing the text > Labels > Buffer>Draw Text Buffer as shown below.

buffer on  text

buffer on  text 2

These text backgrounds and buffers can be any color. It is ideal to choose a color which contrasts well with text color.

How to Add a Scalebar to a Map in QGIS

Open composer and the actual scale of the map can be set by selecting the map area and setting the scale in ‘Item Properties’ shown below.

set scale

Click on the “Add new scalebar” button on the left side bar.

add scalebar

Once the scalebar has been added, you can modify the number of segments and height. The units can also be modified in the item properties.

modify scalebar

To add a numeric scale click on the “Add new scalebar” button again and place under the first scalebar. Another scalebar will appear. Go to the Item Properties menu again and under main properties change the ‘Style’ to Numeric and uncheck the ‘Background’ box to make the box transparent as shown below.

numeric scale

Search for an attribute in a table in QGIS

In this example we will be searching for a city in a cities layer. Open the table by clicking the ‘Open Attribute table’ icon shown below.

open table clip

Below the table click on ‘column filter’ > select the column you want to search through. In this case it is the column called ‘name’

column filter

Type in the name of the city you want to find and click apply. Your search can be case sensitive if desired.

search sydney clipped

In this case our search query came up with 2 results as shown below

search result clipped