You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Bar Rotstein (JIRA)" <ji...@apache.org> on 2019/02/20 19:18:00 UTC
[jira] [Commented] (SOLR-13263) Facet Heat Map should support
GeoJSON
[ https://issues.apache.org/jira/browse/SOLR-13263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16773300#comment-16773300 ]
Bar Rotstein commented on SOLR-13263:
-------------------------------------
My proposal:
Change SpatialUtils#parseGeomSolrException:33
from
{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.readShapeFromWkt(geomStr);
} catch (ParseException e) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Expecting WKT or '[minPoint TO maxPoint]': " + e, e);
}
}{code}
To
{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);
} catch (ParseException e) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Expecting WKT or '[minPoint TO maxPoint]': " + e, e);
}
}{code}
We might be able to get away with the explicit parsing of the rectangular object, though I must admit I must run some tests and report back with the results.
> 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
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org