Search inside circle markers - google-maps

I need to do a search for markers that are within a circle using as parameters the radius and position of the center of the circle. Someone can help me on how serious this search.

Concept:
make an array of the markers you want to search
iterate through the array of markers calculating the distance between each marker and the center point using the geometry library computeDistanceBetween()
function
compare that distance to the radius of the circle, if it is less than the radius, the marker is inside the circle, otherwise it is outside the circle.
example (with center point from geocoded address)

Related

Order of GIS coordinates in Polygon

I have a sample polygon:
POLYGON ((-3.7573242 56.909002300000004, -3.881555000000001 56.552116000000005, -4.4824219 56.6803738, -4.428197900000001 56.3194963, -3.2958984 56.340901200000005, -2.9522632000000004 56.783630800000005, -3.7573242 56.909002300000004))"
I've been asked for the NE,NW,SE,SW coordinates ?
Is there a standard order ?
You are asking for the bounding box of the polygon, the imaginary box that contains your polygon. The corners of this box need not be any of the actual points in the polygon.
So to calculate the SW corner you need to find the minimum of the X and Y coordinates, and for the NE corner you need the maximums.

List and count markers

I need to count and list the markers that are within a figure either a sirculo or a rectangle.
The operation would be that when you insert a figure on the map I list and count how many markers inside it.
The Circle and Rectangle classes have a getBounds() function, which returns a LatLngBounds object. Add your circle/rectangle and get its bounds. Loop over your markers, calling the contains() function on each marker to see if it is contained in that latlng bounds.
You may need to be slightly cleverer with the circle, as its bounds will be for the bounding box that surrounds it, so you might have markers that fall outside the circle but still within that box. In which case you'd need to work something out based on the radius of the circle.

google maps draw circle from

I need to draw a circle in google Maps V3 but I have 2 coordinates, the center and the outter position. Problem is the API expects center and "radius".
For example:
var myCirclePath = [];
myCirclePath.push(new google.maps.LatLng(18.111111,66.111111));
myCirclePath.push(new google.maps.LatLng(18.223344,66.222222));
var myCircle = new google.maps.Circle({
center: myCirclePath[0],
radius: // what do I put here????
map: map
});
I searched around the web and find a lot of stuff about radians, degrees, sin, atan, and what not... however, I'm not good at math and I'm totally lost.
So, the questions are:
a) What should I put in the "radius:" option?
b) How can I center the zoom around the circle? "Bounds.Extend" will not do it
So, the questions are:
a) What should I put in the "radius:" option?
Use the geometry library computeDistanceBetween() to find the radius (passing in your two points)
b) How can I center the zoom around the circle? "Bounds.Extend" will not do it
Once you have created the circle, you can call the getBounds() method on it to get its bounds
Correct me if I am wrong but isn't the radius the distance between center point and outer point of a circle? I would go with this.

How do i define a postgis polygon based on a great circle line

I wish to use PostGIS to select all the points within a polygon, but this question is about defining the actual polygon.
I'm looking to define a polygon that is based on a great circle, specified by two points on the earths surface defined by latitude and longitude coordinates. The polygon that I'm after should be defined by a width left and right of the the center line (the center line being the line made by the great circle)
The resulting shape would be a long curved rectangular shape.
The purpose being to select all the points within x distance of the great circle line.
I think you are confused about the kind of data you are dealing with, if you use a equidistant projection you could use something as simple as this:
ST_DWithIn(ST_MakeLine(point1, point2),distanceInSRIDunits)
There is an old discussion in the postgis mail list that will be useful to you.

Google Maps: Put Marker on Top Left of The Map

just like the title say, I know how to add marker on specific lat,lon. Now I want to add marker and put it on top left or top right of the map. How to accomplish this using javascript api v3 ?
http://code.google.com/apis/maps/documentation/javascript/reference.html#MapCanvasProjection
fromDivPixelToLatLng(pixel:Point)
Computes the geographical coordinates from pixel coordinates in the
div that holds the draggable map.