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

Support GeoJSON response format

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 6.1, 7.0
    • Response Writers
    • 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

        1. SOLR-8814-add-GeoJSONResponseWriter.patch
          15 kB
          Ryan McKinley
        2. SOLR-8814-add-GeoJSONResponseWriter.patch
          17 kB
          Ryan McKinley
        3. SOLR-8814-add-GeoJSONResponseWriter.patch
          66 kB
          Ryan McKinley

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: