Once Cartaro is installed you will find yourself in a basically empty Drupal instance. Of course if you've chosen to install sample data these will now be present, too. The first steps are probably setting up users, roles, content types and custom theme to suit your case.
Setting up content types
Content types are describing the fields and the structure of a specific kind of content (e.g. the content type Capital contains the fields name and location to generate content elements for the respective capitals displayed on the map). To create a new content type, just follow the steps below.
Log in with your administrative user (as created during Cartaro's installation), then navigate to Structure → Content types and click Add content type.
Choose a name and description for your content type and proceed clicking Save and add fields.
Add a new field for your content type by entering a descriptive name. We want to create a geospatial field with the name Geometry. Select Geospatial data as field type and OpenLayers Map as widget. Click Save to proceed to the field's settings.
Choose your field settings in the new window: Select the geometry type that describes the kind of geospatial information you want to store. Choose Polygon to follow our example. Now click Save field settings to go on.
The next screen asks for more settings of the newly created field. You can now choose the map configuration and editor to use and select the permitted amount of objects to draw on the map. The defaults should be fine but check that OpenLayers Editor is set as OpenLayers Behavior because that provides a nice editor for spatial data. Proceed again with Save settings to finish the field creation.
Drupal directs you back to the list of attributes (manage fields screen) but no other fields are necessary for the example. You have now defined a content type with spatial data.
Under the tab Manage fields you could create further non-geospatial fields. We don’t need to create a new one for our example.
Choose Structure → GeoServer from the menu bar to visit the GeoServer configuration page.
Creating a new layer in GeoServer
Use GeoServer layers to publish your geospatial data.
Choose Structure → GeoServer from the menu bar to visit the GeoServer configuration page again. Select Layers and click Add to add your new layer.
Type a suitable layer title.
Select the layer type. We choose PostGIS Field for advanced geospatial operations and geodata storage.
As source select your created content type which will be associated with your new layer.
Make the checkmark Provide an OpenLayers WFS layer within the OpenLayers section.
Finish configuration by click on Save.
You can now also access the geospatial fields of your content type via WFS or WMS with other applications (e.g. with QGis).
Congratulations! Your new GeoServer layer was added to GeoServer.
Configuring OpenLayers to activate your GeoServer layer in a map
OpenLayers is used to display your new layer on a map. You will now associate your GeoServer layer with your OpenLayers map.
Choose Structure → OpenLayers from the menu bar to visit the OpenLayers maps configuration page.
Look for frontmap - a pre-generated, default map - and select Edit on the right side.
frontmap’s configuration page appears as shown on the screenshot below.
Select Layers & Styles in the left sidebar to add our newly created layer to the frontmap.
Look for your created GeoServer layer (‘lakes’ in our example).
Make checkmarks for Enabled, Activated and In Switcher to activate your new layer lakes in your map. Finish configuration by clicking on Save at the bottom.
Adding geospatial content
After creating your content type and configuring GeoServer and OpenLayers you can now add as many content elements of this type as you want.
Choose Content from the menu bar to see all existing content elements within your Cartaro installation.
Select Add content to add more content and choose your new content type in the appearing window (not shown). In the configuration page of your new content element (called node in Drupal language) make the following settings:
- Type a name
- You can draw the geometry for your content element. Choose the draw symbol on the upper right corner of the map. Note that tool tips are shown when you hover the toolbar icons. Click on the map to create a new geometry. Finish the drawing with double click.
- Save your geometry.
Only one geometry per content element can be drawn in our example configuration. Create additional content elements to add more polygons.
You should now see your new content element.
To view your new content element on the front map, click on the house icon in the upper left corner.
Congratulations, you have just finished the quickstart tutorial. Your first content element is now ready. To add more content elements simply perform the steps of this section again.
Things to try
- Use the Layer Assistant to include external layers (see Structure → Open Layers → Layers → Add using assistant).
- Change the default map behaviours and build your own map.
- Try different geometry types and build more complex content types.
What Next ?
The quickstart has given a first impression about the possibilities of Cartaro to you. But there is a lot more to discover.
« Back to Documentation index