OpenLayers Proximity Map Display
Last updated on
30 April 2025
This tutorial demonstrates how to display the results of an OpenLayers Proximity filter on a map. It uses the same node type and data used in the OpenLayers Proximity Tutorial. It helps if you already have some experience with OpenLayers map displays. The first thing you need to do is create a view that we will use for both the Openlayers overlay data and the map display.
Create the View
- Create a new view of type Node.
- Create a new display of type OpenLayers Data.
- Change the display style to 'OpenLayers Data'. Ignore error messages.
- Add a field to the display. For this example we are going to use the Location field that we created in the OpenLayers Proximity Tutorial.
- Click Add field=>Groups=>Content, choose the Location field and click 'Add'.
- Change the field label to 'None'.
- Choose 'WKT value' for format.
- Click the settings button for Style:
- Change 'Map Data Sources' to 'OpenLayers WKT'.
- Add the Proximity:Great-Circle filter. See the OpenLayers Proximity Tutorial for details.
- Save the view.
Create a New OpenLayers Preset
- Navigate to Site Building=>Openlayers=> Presets, create a clone of the default map and give it an appropriate name.
- Click on Layers and Styles.
- Under Overlay layer, enable and activate the layer that you just created with the OpenLayers Data view.
- Click Behaviors. Enable 'Zoom To Layer' and choose the layer you just created. Set 'Point Zoom Level' to 10.
- Save your new preset.
Create the Map Display
- Go back to the same view you used to create the OpenLayers Data display and create a new Page display. Give it a path and menu item.
- Click on Style and choose Openlayers Map. Important! Do not update the default display. Click the 'Override' button, then click Update.
- Update the style settings: change 'Map Preset' to the preset you just created.
- Save the view and you're done.
You can now navigate to the page you just created. You will see a map displaying points for all the test data you created, along with an exposed filter. Type in the starting point and radius and apply the filter. The map will now display only those points that fall within the area you specified.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion