Skip to content
Snippets Groups Projects

Resolve #3319283 "Update readme v2"

Merged ressa requested to merge issue/views_geojson-3319283:3319283-update-readme-v2 into 8.x-1.x
2 files
+ 103
104
Compare changes
  • Side-by-side
  • Inline
Files
2
README.md 0 → 100644
+ 103
0
# Views GeoJSON
## Table of contents
- Summary
- Requirements
- Installation
- Usage
- Bounding Box Support
- To Do
- Credits
- Current Maintainers
## Summary
Views GeoJSON is a style plugin for Views to deliver location-specific data in GeoJSON format, see [RFC 7946: The GeoJSON Format](view-source:https://www.rfc-editor.org/rfc/rfc7946).
Each row is output as a GeoJSON "Features" including geospatial data and optional metadata. All features are wrapped in a "Feature Collection" object.
## Requirements
Drupal core modules
- Views
- RESTful Web Services
- Serialization
External projects
- [itamair/geophp](https://packagist.org/packages/itamair/geophp)
Optional Drupal modules
- [Geofield](https://www.drupal.org/project/geofield)
- [Geolocation](https://www.drupal.org/project/geolocation)
## Installation
Install as you would normally install a contributed Drupal module.
Visit https://www.drupal.org/node/1897420 for further information.
## Usage
1. Create a View with content containing geospatial data
1. Add a "GeoJSON export" display
1. Add fields to output a Geofield, Geolocation, longitude & latitude or WKT
1. Optionally add fields for name and description
1. Set Format for the display to "GeoJSON"
1. In the "Settings" for this format:
- Choose Map Data Source (Other: Lat/Lon Point, Geofield, etc.)
- Assign the field(s) that represent Latitude and Longitude
- Optionally choose fields representing Title and Description for each point
- Optionally set a JSONP prefix, (see https://en.wikipedia.org/wiki/JSONP)
1. If using with the OpenLayers module, your new GeoJSON layer will be
available as an Overlay layer on the "Layers & Styles" tab when editing your map
### Bounding Box Filtering
GeoJSON views can accept a bounding box as an argument to return only the points
within that box.
It has been tested with OpenLayers' Bounding Box Strategy but should work with
any mapping tool that requests bounding box coordinates as
"?bbox=left,bottom,right,top" in the query string. Argument ID "bbox" is
default for OpenLayers but can be changed.
1. Create a GeoJSON view as above in USAGE
1. Add a layer to OpenLayers of type GeoJSON, at
`/admin/structure/openlayers/layers/add/openlayers_layer_type_geojson`,
specifying the URL to your GeoJSON feed and checking the box for "Use Bounding
Box Strategy"
1. In your GeoJSON View configuration, add a Contextual Filter of type:
"Custom: Bounding box"
1. In the Contextual Filter settings, under "When the filter value is NOT in
the URL as a normal Drupal argument", choose: "Provide default value"
1. In the "Type" dropdown, choose: "Bounding box from query string"
1. For OpenLayers, leave "Query argument ID" as "bbox" and click Apply
## To Do
- Support addditional GeoJSON feature types like LineString
- Support an optional altitude coordinate for Point positions
- Support additional coordinate systems
## Credits
This module was originally born from a patch by tmcw to the
[OpenLayers module](https://drupal.org/node/889190#comment-3376628) and adapted
to model the
[Views Datasource module](https://drupal.org/project/views_datasource).
Much of the code is drawn directly from these sources.
## Current Maintainers
- Jeff Schuler (jeffschuler) - <https://www.drupal.org/u/jeffschuler>
Loading