All latitude and longitude within 1 mile circle area - google-maps-api-3

I am trying to generate pins over the map of my database coordinates by using fusion table and I want to generate only within 1 mile area circle around the specific location. To get 1 mile area's coordinates similar to my db coordinates I've to put condition of < and > to fusion table but I don't know how to get all the coordinates within 1 mile area circle or what should be the value for condition in query. Can any one please help me to figure out, it'll really appreciable.

You haven't provided any code, so I'm not exactly sure what you want to do. But the Fusion Table ST_INTERSECTS operator should do what you want. Look for <spatial_condition>.
var where = "ST_INTERSECTS('location_col',CIRCLE(LATLNG(31.954109,-115.441528), radius_in_meters) ) )";
var qryOpts = {
query: {
select: location_col,
from: table_id,
where: where
}
};
ft_layer.setOptions(qryOpts);

I have no idea if that is possible within the Fusion Tables API but, if I were doing it, I would first calculate which points in my database were within the radius and insert only those. You can ignore the earth's curvature and just use the Pythagorean theorem with a little adjusting for your latitude.
See here: http://www.movable-type.co.uk/scripts/latlong.html

Related

Set current location in a route based on a arbitrary distance

I'm just playing around with Here and this is my escenario for an idea.
Get a routing between 2 points, I know this is doable
Set the start and finish marker, I know this is doable
Get the distance between the 2 points, I know this is doable
Now, if the distance from point 1 and 2 is 3000 meters I want to set a marker ( You are here ) based on a arbitrary distance value, let say I want to add a marker at the 1750 meters point, the market should appears in the half route way.
Is this posible with the actual API?
Thanks in advance!
Yes it is possible to do with HERE javascript API.
Once you get routing response and create H.geo.LineString out of it, you can calculate distance between each two geo points from that line string using H.geo.Point#distance method. This will help to determine between which two points (lat, lng) is your desired arbitrary distance.
After that you need to calculate angle between these two geo points and use it in method H.geo.Point#walk in order to get exact position of the geo point you need.
Here you can find jsfiddle example which places marker on the simple LineString based on desired arbitrary distance.

Find all lat/long under certain radius

I have set of lat/long which are stored in database and I have to find all the lat/long from the database which are lies between the given lat/long(e.glatitude = 37.4224764,and longitude=-122.0842499) and given radius(say 5miles).For this I need to do some addition and subtraction like:
37.4224764 + 5mile
37.4224764 - 5mile
and
-122.0842499+5mile
-122.0842499-5mile
But I don't know how the conversion works here.
You're a little vague in your requirements, do you just want to find out the coordinates of a point a certain distance from your current location in a given direction? Or get a circle of a radius of a particular distance around your coordinates? Or draw a line of a certain length from your coordinates to another point a particular distance away?
I assume you'd probabaly want to use the Geometry spherical library, e.g.
var latLng = new google.maps.LatLng(geometry.location.lat, geometry.location.lng);
var newLatLng = google.maps.geometry.spherical.computeOffset(
latLng,
1000,
0
);
see also https://developers.google.com/maps/documentation/javascript/geometry#Distance
PS: you need to add the geometry library parameter when loading the map:
<script src="https://maps.googleapis.com/maps/api/js?v=3&libraries=geometry"></script>

Aligning a point cloud on a grid

I have to measure the Z-distances for corresponding points of two clouds.
I intend to iterate through one cloud and calculate the distance bezween Z coordinates using the same X and Y of the other cloud.
Unfortunatelly it doesn't work, as there are never a point at these X-Y coordinates in the second cloud. My current workaround is to search for a closest point in the second cloud for X-Y of the first cloud. It works, but it is very slow.
Is there a way to align points of X and Y coordinates on a defined grid using PCL? This way I hope the X-Y coortinates will match better.
EDIT
Ok, here are some images and more explanation.
Top view
Side view
There is a scan of a saddle and a horse back. Both are made independently but aligned in Z-axis - Z-Axis of both are parralel.
I want to create a model of a layer, which fits exactly under the saddle (Not just a rechtangular pad).
So given a thickness of the layer I want to iterate through the saddle points and find the Z-distance to corresponding point on the horse-back. As the Y coordinates are floats, there are nearly never a point on the horse with the same XY as on the saddle.
I think. If I could align all points to a grid with a given density, there would be a corresponding XY-point on tthe horse for each XY saddle point above it.
I am not really sure if that is what you mean, but maybe the "grid" you are talking about could just be the image plane? So instead of using the 3D point cloud you could take the depth maps/depth images and just compare the values of two depth maps at the same image coordinates. This would assume that the recordings are already aligned.
If you only have the point cloud data you'd have to perform a projection on the plane (for this you's have to know the intrinsics of the camera).
Another option might be aligning the clouds using a registration method (e.g. ICP). Then you could also get the (sum of) distance(s) for corresponding points of the clouds.
I've implemented a proof of concept and want to share it. However, I'd appreciate a "proper" solution - a PCL API function probably.
bool alignToGrid( pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloud, QMap<QString, float > & grid, int density )
{
pcl::PointXYZRGBNormal p1;
p1.r=0;
p1.g=0;
p1.b=255;
QMap<QString, QList<float> > tmpGridMap;
for( std::vector<pcl::PointXYZRGBNormal, Eigen::aligned_allocator<pcl::PointXYZRGBNormal> >::iterator it1 = cloud->points.begin();
it1 != cloud->points.end(); it1++ )
{
p1.x = it1->x;
p1.y = it1->y;
p1.z = it1->z;
int gridx = p1.x*density;
int gridy = p1.y*density;
QString pos = QString("%1x%2").arg(gridx).arg(gridy);
tmpGridMap[pos].append(p1.z);
}
for (QMap<QString, QList<float> >::iterator it = tmpGridMap.begin(); it!=tmpGridMap.end(); ++it)
{
float meanZ=0;
foreach( float f, it.value() )
{
meanZ+=f;
}
meanZ /= it.value().size();
grid[it.key()] = meanZ;
}
return true;
}
The Idea is to iterate through a cloud and leave/create only points, which XY coordinates are on the defined grid. Density 1000 for Kinect clouds results in ca. 1mm-grid.
All points around the grid point are used for building the Z-average.
The cloud remains unmodified. The output is a map of xy-position to Z. XY Position is stored in string (weird, I know) as x. Using this map it is easy to find corresponding XY-points in other grid-aligned clouds.
Now I was able to map my clouds using any density. In the images e.g. 1mm and 1cm.

Point In Polygon using T-Sql

I am creating a mapping application which users can interactively draw a polygon on a Google Map.
I need to send this polygon data back to a Sql Server and determine which records to return based on their LatLng positions in the database being within the polygon.
Does anyone know how to do this or a routine that is available.
Thanks in advance
If you have a geography column associated with your records, you can use that to query for items within a polygon. Link to get you started. Here's an example:
--What Items are within the Bermuda Triangle?
---Note that Well-Known Text representation of a polygon is composed of points defined by Longitude then Latitude.
---Note that the points are defined in a counter-clockwise order so that the polygon is the interior of the triangle.
DECLARE #BermudaTriangle geography = geography::STPolyFromText
('POLYGON((
-80.190262 25.774252,
-66.118292 18.466465,
-64.75737 32.321384,
-80.190262 25.774252
))', 4326)
SELECT ItemID, ReportedGPSPoint.Lat, ReportedGPSPoint.Long
FROM Items
WHERE ReportedGPSPoint.STIntersects(#BermudaTriangle) = 1

Fusion table layer filtering based on polygon

I've a fusion table map example with 5 layers given in this link : http://jsfiddle.net/ju2Re/
I want to filter the layers such that,
first I select a layer using dropdown : Office hierarchy > Zone > Bagalkot
Now I want to select the 220 KV stations only inside that polygon using the select box.
Please anyone help. Thank you in advance.
I don't believe you can do this natively with fusion tables (at least
not right now). The only query that can be used for "point in
polygon" analysis is:
ST_INTERSECTS(,
)
.
That takes a geometry as one argument, but the only values of are:
-
-
So if you have one point, you can use it to define a small circle and
use ST_INTERSECTS with a polygon, but that won't work for multiple
points.
With the current size of your tables you can use GViz to retrieve the
data from FusionTables and analyze it in the browser.
Proof of Concept (only works for "Geographical Heirarchy"/"District")
The code adds a "Contains" method to google.maps.Polygon, then iterates through the markers, displaying them if they are contained in the "activePolygon".
Proof of Concept should handle all the cases that have data

Resources