[ 
https://issues.apache.org/jira/browse/SOLR-13263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16774924#comment-16774924
 ] 

Bar Rotstein commented on SOLR-13263:
-------------------------------------

Uploaded a no-commit patch, showcasing the non deprecated parsing function.
SpatialUtils#parseGeomSolrException:45
{code:java}  /**
   * Parses a 'geom' parameter (might also be used to parse shapes for 
indexing). {@code geomStr} can either be WKT or
   * a rectangle-range syntax (see {@link #parseRectangle(String, 
org.locationtech.spatial4j.context.SpatialContext)}.
   */
  public static Shape parseGeomSolrException(String geomStr, SpatialContext 
ctx) {
    if (geomStr.length() == 0) {
      throw new IllegalArgumentException("0-length geometry string");
    }
    char c = geomStr.charAt(0);
    if (c == '[' || c == '{') {
      return parseRectangeSolrException(geomStr, ctx);
    }
    //TODO parse a raw point?
    try {
      return ctx.getFormats().read(geomStr);
      // return ctx.readShapeFromWkt(geomStr);
    } catch (InvalidShapeException e) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
          "Could not parse string into a shape': " + e, e);
    }

  }{code}
Ran all non bad apple Solr tests, which all passed successfully.
One minor gripe is that Spatial4J does not support parsing GeoJSON polygons, 
and throws an exception, asking to use JTS instead.
I'll try and set up a new test suite for this.
This makes me wonder though, how does Solr currently deal with error caused 
since Spatial4J is not as feature rich as JTS?

> Facet Heat Map should support GeoJSON
> -------------------------------------
>
>                 Key: SOLR-13263
>                 URL: https://issues.apache.org/jira/browse/SOLR-13263
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 8.0, 8.x, master (9.0)
>            Reporter: Bar Rotstein
>            Priority: Major
>         Attachments: SOLR-13263-nocommit.patch
>
>
> Currently Facet Heatmap(Geographical facets) do not support any other 
> subjects other than WKT or '[ ]'. This seems to be caused since 
> FacetHeatmap.Parser#parse uses SpatialUtils#parseGeomSolrException, which in 
> turn uses a deprecated JTS method (SpatialContext#readShapeFromWkt) to parse 
> the string input.
> The newer method of parsing a String to a Shape object should be used, makes 
> the code a lot cleaner and should support more formats (including GeoJSON).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to