Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Support for GetFeatureInfo #4

Open
gourlaysama opened this issue Aug 13, 2012 · 2 comments
Open

Support for GetFeatureInfo #4

gourlaysama opened this issue Aug 13, 2012 · 2 comments

Comments

@gourlaysama
Copy link
Contributor

Add support for GetFeatureInfo with some interesting result type, like geoJson or at least a simple HTML view.

/cc @tonyMartin

@gourlaysama
Copy link
Contributor Author

There is a method on the MapTransform to do this:

public Point2D toMapPoint(int i, int j);

This looks like what we want (pixel to map units).

The problem is that the MapTransform is not supposed to be used that way (just to convert a value from pixel to map units), it is supposed to be used for rendering (which we do not care about here...)

So we'll have to go around this until this is properly refactored outside of the MapTransform:

// create a MapTransform
MapTransform m = new MapTransform();
// set a dummy image (of the right size)
m.setImage(new BufferedImage(x, y, ...));

// tell it to adjust the extend (take CRS into account)
m.setAdjustExtent(true);
// set the input extend of the map
m.setExtent(theEnvelope);
// the above will recalculate the AffineTransform that we need

// then use it
Point2D pt = m.toMapPoint(x,y);
// now we have a point to query with.

// convert the point into a degenerated envelope
Envelope ev = ... // from pt

// query the index
int[] rows = dsf.getIndexManager().queryIndex("thelayer", 
new DefaultSpatialndexQuery("the_geom", ev));

// get the DataSource
DataSource ds = dsf.getDataSource("thelayer");
ds.open();
// access the rows
ds.close();

// repeat the above for each layer

@tonyMartin: don't take this at face value, but it looks like the way to go.

@agueganno
Copy link
Contributor

Started the work. The answer is currently quite simple (plain text) but it's a beginning.

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

No branches or pull requests

2 participants