Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find all polygons containing the point #782

Closed
yashhema opened this issue Dec 14, 2022 · 1 comment
Closed

Find all polygons containing the point #782

yashhema opened this issue Dec 14, 2022 · 1 comment

Comments

@yashhema
Copy link

Hello,
I indexed MultiPolygon using this
IDictionary<string, string> margs = new Dictionary<string, string>
{
["SpatialContextFactory"] = typeof(NtsSpatialContextFactory).FullName
};

        var ctx = SpatialContextFactory.MakeSpatialContext(margs, GetType().Assembly);
          SpatialPrefixTree trie = new QuadPrefixTree(ctx, 12);
        _locationfindstrategy = new TermQueryPrefixTreeStrategy(trie, "geo");

then indexed each polygon via
IShape area = ctx.ReadShapeFromWkt(v.wktstr);
Document doc = new Document();
doc.Add(new TextField("id", v.stname, Field.Store.YES));
Field[] fields = _locationfindstrategy.CreateIndexableFields(area, 0.025);
foreach (Field field in fields)
{
doc.Add(field);
}

Now I am trying to search documents containing a point (For example , say i want to find the city from lat/long, and I have stored polygon shapes of city )

IPoint upperleft = ctx.MakePoint(92.515830993652514, 10.8976411819458);
Query query = _locationfindstrategy.MakeQuery(new SpatialArgs(SpatialOperation.Contains, upperleft));

        TopDocs search = searcher.Search(query, 10);

I am getting error - Opeation Not supported

Is there any other mechanism which i can use

@NightOwl888
Copy link
Contributor

I am closing this because it is not a bug that needs addressing in Lucene.NET. Please direct usability questions to StackOverflow or the Lucene.NET user mailing list. You will be much more likely to get an answer to your question on StackOverflow when specifying both lucene.net and lucene tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants