In Geocouch, how can I get all objects by lon/lat coordinates? - couchdb

I.e. all objects that contain this coordinates (for polygons) or cross them (for lines)?

You can collapse the bounding box you query with to a point.

Related

Rectangular connected component extraction in python

There are multiple rectangular areas in the 2d-numpy array. All the rectangular areas have value 1, other areas are zero. I want to extract a minimum number of rectangular connected components from the numpy array. These connected components can touch each other in any direction.
I tried extracting connected components using label function from scipy.ndimage.measurements but it assigns the same label to rectangles which touch each other.
I also tried, morphological opening but I do not want to lose the original shape of the rectangle.
The image shows the expected output for a better understanding of the problem.
Is there a better way to extract a minimum number of perfectly rectangular regions?

Bounding box for multiple SVG paths

I have some SVG paths which represent equations. There will be multiple on the canvas. I would like to pass all of these paths and get back grouped paths where each group represents a single equation.
Assumptions there is no overlap between the equations bounding boxes
After processing I should then be able to apply a bounding box to check the success the end result should be;
I already know how to apply a bounding box to a set of points. I am specifically struggling with how to determine which set of points or paths should go into a single group.
For example I would not want it to give me a bounding box for the "y", "=", "m" e.t.c separately that would be of little use.

Arbitrarily oriented minimum area bounding "box" of a polygon on a sphere

I would like to calculate an arbitrarily oriented minimum (area) bounding box of a polygon on a sphere (as a simplification of Earth).
For an axis-aligned version I found the great example from Jason Davies.
The idea is to have as input a list of lon/lat coordinates for the points of the polygon and as output the coordinates of the 4 points (lon/lat) of the bounding box.
Bonus: consider the (very likely) cases where the polygon crosses the antimeridian, contains one pole and/or spans more than one hemisphere.

Converting a lat/lon values to a small map

I have a list of coordinates of lat/lon values consisting of cities around the world. I have put together a SVG map of the US which I would like to display the major cities of the world as pins on top of the SVG map. So far I've figured out that the map projection that I am displaying is a Mercator projection of the US so the next step is how can I get the X/Y coordinates for that map of the map for each city? Once I get the mercator projection from the lat/lon then how is that converted to X/Y values and then to relative X/Y values based on the size of my map?
The Wikipedia article on the Mercator projection provides the equations you need to implement. The Mercator projection transforms lat/long to x/y, that's what map projections do. All you have to do once you have the x/y values is translate them into (in your case) pixels or whatever measure you use.

Finding a point clicked in a grid

Given this grid ( http://i.stack.imgur.com/Nz39I.jpg is a trapezium/trapezoid, not a square), how do you find the point clicked by the user? I.e. When the user clicks a point in the grid, it should return the coordinates like A1 or D5.
I am trying to write pseudo code for this and I am stuck. Can anyone help me? Thanks!
EDIT: I am still stuck... Does anyone know of any way to find the height of the grid?
If it is a true perspective projection, you can run the click-point through the inverse projection to find it's X,Z coordinates in the 3D world. That grid has regular spacing and you can use simple math to get the A1,D5,etc.
If it's just something you drew, then you'll have to compare the Y coordinates to the positions of the horizontal lines to figure out which row. Then you'll need to check its position (left/right) relative to the angled lines to get the column - for that, you'll need either coordinates of the end-points, or equations for the lines.
Yet another option is to store an identical image where each "square" is flood-filled with a different color. You then check the color of the pixel where the user clicked but in this alternate image. This method assumes that it's a fixed image and is the least flexible.
If you have the coordinates of end points of the grid lines then
Try using the inside-outside test for each grid line and find the position
Since this grid is just a 3D view of a 2D grid plane, there is a projective transform that transforms the coordinates on the grid into coordinates on the 2D plane. To find this transform, it is sufficient to mark 4 different points on the plane (say, the edges), assign them coordinates on the 2D plane and solve the resulting linear equation system.

Resources