Hi,

I am not sure if this is the right mailing list, but I have a problem with the 
indexing of the GeoJSON. It is not exactly the configuration problem, but more 
question about the implementation.

I try to index this GeoJSON document:
{
   "type":"FeatureCollection",
   "features":[
      {
         "type":"Feature",
         "properties":{

         },
         "geometry":{
            "coordinates":[
               [
                  [
                     12.979074171786522,
                     51.35455355187656
                  ],
                  [
                     12.742678165549023,
                     51.30187234125975
                  ],
                  [
                     12.614561448882142,
                     51.23774698707524
                  ],
                  [
                     12.610428651570203,
                     51.195810322507896
                  ],
                  [
                     12.946838352754384,
                     51.19322038765756
                  ],
                  [
                     13.019575585442539,
                     51.24136935014246
                  ],
                  [
                     13.07247539103443,
                     51.26361475158893
                  ],
                  [
                     13.193979632002566,
                     51.26154586591673
                  ],
                  [
                     13.190673394153208,
                     51.30445616429853
                  ],
                  [
                     12.980727290711684,
                     51.31840629529299
                  ],
                  [
                     12.979074171786522,
                     51.35455355187656
                  ]
               ]
            ],
            "type":"Polygon"
         }
      }
   ]
}

My field is defined as follow:
<fieldType name="geojson" class="solr.SpatialRecursivePrefixTreeFieldType" 
spatialContextFactory="Geo3D" geo="true" planetModel="WGS84" format="GeoJSON" />

The error which I am getting:
Apache Solr threw exception: "Solr HTTP error: Bad Request (400)
{
  "responseHeader":{
    "status":400,
    "QTime":2305},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","java.text.ParseException"],
    "msg":"ERROR: [doc=20452uuid-6613d542-b888-44b3-8496-91283a8267e2] Error 
adding field 
'geom'='{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"coordinates\":[[[12.979074171786522,51.35455355187656],[12.742678165549023,51.30187234125975],[12.614561448882142,51.23774698707524],[12.610428651570203,51.195810322507896],[12.946838352754384,51.19322038765756],[13.019575585442539,51.24136935014246],[13.07247539103443,51.26361475158893],[13.193979632002566,51.26154586591673],[13.190673394153208,51.30445616429853],[12.980727290711684,51.31840629529299],[12.979074171786522,51.35455355187656]]],\"type\":\"Polygon\"}}'
 msg=Unable to parse shape given formats \"lat,lon\", \"x y\" or as GeoJSON 
because java.text.ParseException: Unable to make shape type: Feature input: 
{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"coordinates\":[[[12.979074171786522,51.35455355187656],[12.742678165549023,51.30187234125975],[12.614561448882142,51.23774698707524],[12.610428651570203,51.195810322507896],[12.946838352754384,51.19322038765756],[13.019575585442539,51.24136935014246],[13.07247539103443,51.26361475158893],[13.193979632002566,51.26154586591673],[13.190673394153208,51.30445616429853],[12.980727290711684,51.31840629529299],[12.979074171786522,51.35455355187656]]],\"type\":\"Polygon\"}}",
    "code":400}}

Basically after some tests I was able to confirm that problem is caused by the 
ordering of type elements in JSON. If the type "Polygon" is placed as first 
then the document is indexed correctly. But the ordering of the elements should 
not be important here, as the GeoJSON validator accepts the order of the fields 
from the above presented JSON. The documents are generated automatically by the 
software to generate GeoJSON.

I would like to ask if maybe this problem was already addressed in some of the 
newer SOLR version. If not, are there are some plans to adjust it? Or maybe is 
there some other class which accepts GeoJSON in the form we want to provide it.

I would be very grateful for any help on this topic.

Best regards,
Beatrycze Volk
--
Beatrycze Volk
Softwareentwicklerin

Sächsische Landesbibliothek -
Staats- und Universitätsbibliothek Dresden (SLUB)
01054 Dresden
Abt. Informationstechnologie (IT)
Referat Digitale Präsentation (2.1)
Besucheradresse: Zellescher Weg 18, 01069 Dresden
Tel.: +49 351/4677319
E-Mail: beatrycze.v...@slub-dresden.de<mailto:beatrycze.v...@slub-dresden.de>
https://www.slub-dresden.de<https://www.slub-dresden.de/>

Reply via email to