Create a Find Nearest Point Layer


If you wish to perform a Find Nearest function on a Point Layer in My House or My Nearest to, for instance, find your nearest Schools, Doctors, TPOs etc., you will need to add a new Layer to your .MAP file and then configure the Find Nearest functionality.

If you are using GIAS / EduBase, NHS Choices, Modern.gov, Elgin (roadworks.org) or the Police API then please refer to the individual topics for these systems.

You can use the Map Editor to add your new Layer to the .MAP file.


First click on the My House or My Nearest node in the Explorer.

Then click on the Map Editor tab.

Identify where in the stack of layers you want to render the new layer. Point layers are generally at the bottom of the .map file. Polygon layers are nearer the top as they are rendered first.

In this example we've scrolled to the bottom of the list of Layers at the bottom of the Map Editor and clicked on the last entry, a layer called 'addresses'.

Now you want to add your new Layer after this entry.

Position the cursor after END for the previous LAYER and enter the details for your new layer.

In the code example opposite we are adding a Layer pointing to a .TAB file for Leisure Centres.

We have also picked a Symbol from the list of available symbols that come with iShare to style this layer.

You may wish to look at Configuring MapServer Cartography for more information on how to style your Layer in different ways.

If you want to see how to add a Layer pointing to a table in the Data Share database then look at the examples for Updating the .MAP file for NHS Choices.


Leisure Centre Layer
	LAYER
        NAME leisure_centres
        STATUS OFF
        TYPE POINT
        CONNECTIONTYPE OGR
		CONNECTION "./council/leisure.TAB"
        TOLERANCEUNITS METERS
        CLASS
			NAME "Leisure Centres"
            STYLE
                 SYMBOL "leisure"
            END
        END
	END

Don't forget to click the Save button to save your changes to the .MAP file.



Now that you have added the Layer to the .MAP file you need to configure it.

Right click on the Layer Group in My House or My Nearest and select Add new Layer.

Enter a Display Name for the Layer and then select the Layer Name that you have just added to the .MAP file from the drop down list.

Now you need to configure the Find Nearest details.

Click on the Find Nearest radio button and enter a Distance and number of Results.

Lastly you need to select the fields that you wish to be displayed. Here we have selected the Name field but this is going to be displayed as a Link using the link field as the URL.

You may wish to select No Result as the Result Display and provide some text that indicates there are no features found in the given radius.