You are here

README.txt in Views GeoJSON 8

Same filename and directory in other branches
  1. 6 README.txt
  2. 7 README.txt
CONTENTS OF THIS FILE
---------------------

* 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 GeoJSON spec: http://geojson.org/geojson-spec.html).

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 modules:
* Views
* Serialization
* Rest

Optional Drupal modules:
* Geofield 8.x-1.0-alpha2 or greater

INSTALLATION
------------

Install the module as usual.
See https://www.drupal.org/node/1897420 for help installing Drupal 8 modules.


USAGE
-----

1. Create a View with a Feed display on content with geospatial data.
2. Add fields to output a Geofield, longitude & latitude or WKT.
3. Optionally add fields for name and description.
4. Set Format for the display to "GeoJSON Feed".
5. In the "Style options" for this format:
  * Choose Map Data Source (Other: Lat/Lon Point, Geofield, etc.)
  * Assign the fields that represent Latitude and Longitude.
  * Optionally choose fields representing name and description for each point.
  * Optionally set a JSONP prefix, (see http://en.wikipedia.org/wiki/JSONP).
  * Set the Content-type header to be sent. The default is "application/json",
    the standard MIME type for JSON, per http://www.ietf.org/rfc/rfc4627.txt.
6. 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.

OpenLayers 7.x-2.x-dev is currently required for OpenLayers BBOX integration.
See OpenLayers issue http://drupal.org/node/1493344, "Support BBOX strategy in
the GeoJSON layer type".

1. Create a GeoJSON view as above in USAGE.
2. 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".
3. In your GeoJSON View configuration, add a Contextual Filter of type:
   "Custom: Bounding box".
4. In the Contextual Filter settings, under "When the filter value is NOT in
   the URL as a normal Drupal argument", choose: "Provide default value".
5. In the "Type" dropdown, choose: "Bounding box from query string".
6. 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
(http://drupal.org/node/889190#comment-3376628) and adapted to model the Views
Datasource module (http://drupal.org/project/views_datasource).

Much of the code is drawn directly from these sources.


CURRENT MAINTAINERS
-------------------

* jeffschuler - http://drupal.org/user/239714

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Summary
  4. * Requirements
  5. * Installation
  6. * Usage
  7. * Bounding Box Support
  8. * To Do
  9. * Credits
  10. * Current Maintainers
  11. SUMMARY
  12. -------
  13. Views GeoJSON is a style plugin for Views to deliver location-specific data in GeoJSON format, (see GeoJSON spec: http://geojson.org/geojson-spec.html).
  14. Each row is output as a GeoJSON "Features" including geospatial data and optional metadata. All features are wrapped in a "Feature Collection" object.
  15. REQUIREMENTS
  16. ------------
  17. Drupal modules:
  18. * Views
  19. * Serialization
  20. * Rest
  21. Optional Drupal modules:
  22. * Geofield 8.x-1.0-alpha2 or greater
  23. INSTALLATION
  24. ------------
  25. Install the module as usual.
  26. See https://www.drupal.org/node/1897420 for help installing Drupal 8 modules.
  27. USAGE
  28. -----
  29. 1. Create a View with a Feed display on content with geospatial data.
  30. 2. Add fields to output a Geofield, longitude & latitude or WKT.
  31. 3. Optionally add fields for name and description.
  32. 4. Set Format for the display to "GeoJSON Feed".
  33. 5. In the "Style options" for this format:
  34. * Choose Map Data Source (Other: Lat/Lon Point, Geofield, etc.)
  35. * Assign the fields that represent Latitude and Longitude.
  36. * Optionally choose fields representing name and description for each point.
  37. * Optionally set a JSONP prefix, (see http://en.wikipedia.org/wiki/JSONP).
  38. * Set the Content-type header to be sent. The default is "application/json",
  39. the standard MIME type for JSON, per http://www.ietf.org/rfc/rfc4627.txt.
  40. 6. If using with the OpenLayers module, your new GeoJSON layer will be available
  41. as an Overlay layer on the "Layers & Styles" tab when editing your map.
  42. Bounding Box Filtering
  43. --------------------
  44. GeoJSON views can accept a bounding box as an argument to return only the
  45. points within that box.
  46. It has been tested with OpenLayers' Bounding Box Strategy but should work
  47. with any mapping tool that requests bounding box coordinates as
  48. "?bbox=left,bottom,right,top" in the query string. Argument ID "bbox" is
  49. default for OpenLayers but can be changed.
  50. OpenLayers 7.x-2.x-dev is currently required for OpenLayers BBOX integration.
  51. See OpenLayers issue http://drupal.org/node/1493344, "Support BBOX strategy in
  52. the GeoJSON layer type".
  53. 1. Create a GeoJSON view as above in USAGE.
  54. 2. Add a layer to OpenLayers of type GeoJSON, at
  55. admin/structure/openlayers/layers/add/openlayers_layer_type_geojson,
  56. specifying the URL to your GeoJSON feed and checking the box for "Use
  57. Bounding Box Strategy".
  58. 3. In your GeoJSON View configuration, add a Contextual Filter of type:
  59. "Custom: Bounding box".
  60. 4. In the Contextual Filter settings, under "When the filter value is NOT in
  61. the URL as a normal Drupal argument", choose: "Provide default value".
  62. 5. In the "Type" dropdown, choose: "Bounding box from query string".
  63. 6. For OpenLayers, leave "Query argument ID" as "bbox" and click Apply.
  64. TO DO
  65. -----
  66. * Support addditional GeoJSON feature types like LineString.
  67. * Support an optional altitude coordinate for Point positions.
  68. * Support additional coordinate systems.
  69. CREDITS
  70. -------
  71. This module was originally born from a patch by tmcw to the OpenLayers module
  72. (http://drupal.org/node/889190#comment-3376628) and adapted to model the Views
  73. Datasource module (http://drupal.org/project/views_datasource).
  74. Much of the code is drawn directly from these sources.
  75. CURRENT MAINTAINERS
  76. -------------------
  77. * jeffschuler - http://drupal.org/user/239714