Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8814

Support GeoJSON response format

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.1, 7.0
    • Component/s: Response Writers
    • Labels:
      None

      Description

      With minor changes, we can modify the existing JSON writer to produce a GeoJSON `FeatureCollection` for ever SolrDocumentList. We can then pick a field to use as the geometry type, and use that for the Feature#geometry

      "response":{"type":"FeatureCollection","numFound":1,"start":0,"features":[
            {"type":"Feature",
              "geometry":{"type":"Point","coordinates":[1,2]},
              "properties":{
                ... the normal solr doc fields here ...}}]
        }}
      

      This will allow adding solr results directly to various mapping clients like Leaflet


      This patch will work with Documents that have a spatial field the either:
      1. Extends AbstractSpatialFieldType
      2. has a stored value with geojson
      2. has a stored value that can be parsed by spatial4j (WKT, etc)

      The spatial field is identified with the parameter `geojson.field`

        Attachments

          Activity

            People

            • Assignee:
              ryantxu Ryan McKinley
              Reporter:
              ryantxu Ryan McKinley
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: