Order of GIS coordinates in Polygon - gis

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.

Related

Move outer marker on change distance parameter

I have created circle based on Pin Pivot Center & Outer Circle parameter and i have find total distance between this two points using java script.
Now what i want is when i change distance parameter my outer circle parameter should be moved with distance parameter.
So if i have change distance parameter from 200m to 300m then my outer circle pin should be moved 300m from starting point
I have attach Snap here
Any help should be appreciated.
Thanks
You can find outer circle coordinates from this:
var dest = new google.maps.geometry.spherical.computeOffset(start_point_latlng, distance, heading);
Here, heading expressed in degrees clockwise from north.(Here, you can add 180 or 90.)
You will get new coordinates of outer circle from variable p1.
For more information, see this link:
https://developers.google.com/maps/documentation/javascript/reference?csw=1#spherical

how do i create a circle Geometry with a radius and co-ordinates of center, using MySQL Spatial Extensions?

I am trying to create a Circle Geometry in MySQL using the co-ordinates of the center and a radius. I searched everywhere...all i could find in the MySQL doc on the site were for polygons. May be i am looking in the wrong place. can anybody help me with an appropriate SQL that can help me create a table that stores this Circle geometry as one of the columns in the table?
Also, i am not even sure if there is a way to do so in MySQL?..The version i am using is MySQL 5.6.
Thanks in advance.
As of MySQL v5.6.1, you can use Buffer(g, d):
Returns a geometry that represents all points whose distance from the geometry value g is less than or equal to a distance of d.
Obviously, in your case g should be the point at the centre of the circle and d should be its radius.
There are two Parts:
A.For given tested points you have to check their relation with given circle.
B.You want to generate points on circumference of given circle.
A.Yes, First of all take the distance between your given point(test Point) and the centre of circle point. Both of these points are defined in Latitude and longitude. Distance formula between two points(x1,y1) and (x2,y2) is distance d= sqrt[ (x2-x1)^2 + (y2-y1)^2 ].
Now,
If this distance is less than radius of circle then your tested point is inside your circle.
If this distance is Greater than radius then tested point is outside the circle.
If this calculated distance is equal to radius of circle then this tested point is on your circle i.e. on the circumference of your circle.
B. In a circle the total angle theta is 360 degree or 2*Pi in radians.
For given Circle whose centre is (x1, y1) and radius is r.
x = x1 + r * cos(theta)
y = y1 + r * sin(theta)
where, theta is running from Zero to 2*Pi and Pi is 3.1415.
Depending upon how you do it. Example: if you wants 10 points on circle, then increment=(2*Pi-Zero)/10.
fist theta is zero, then theta is Zero+increment, then theta is Zero +increment+increment i.e. 2* increment and then zero + 3*increment and then so on. unless you get theta equal to 2*Pi.
For all above thetas calculate x and y. These all x and y coordinate points are on the circumference of the circle.

Search inside circle markers

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)

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.

How do I draw the points in an ESRI Polyline, given the bounding box as lat/long and the "points" as radians?

I'm using OpenMap and I'm reading a ShapeFile using com.bbn.openmap.layer.shape.ShapeFile. The bounding box is read in as lat/long points, for example 39.583642,-104.895486. The bounding box is a lower-left point and an upper-right point which represents where the points are contained. The "points," which are named "radians" in OpenMap, are in a different format, which looks like this: [0.69086486, -1.8307719, 0.6908546, -1.8307716, 0.6908518, -1.8307717, 0.69085056, -1.8307722, 0.69084936, -1.8307728, 0.6908477, -1.8307738, 0.69084626, -1.8307749, 0.69084185, -1.8307792].
How do I convert the points like "0.69086486, -1.8307719" into x,y coordinates that are usable in normal graphics?
I believe all that's needed here is some kind of conversion, because bringing the points into Excel and graphing them creates a line whose curve matches the curve of the road at the given location (lat/long). However, the axises need to be adjusted manually and I have no reference as how to adjust the axises, since the given bounding box appears to be in a different format than the given points.
The ESRI Shapefile technical description doesn't seem to mention this (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf).
0.69086486, -1.8307719 is a latitude and a longitude in radians.
First, convert to degrees (multiply by (180/pi)), then you will have common units between your bounding box and your coordinates.
Then you can plot all of it in a local frame with the following :
x = (longitude-longitude0)*(6378137*pi/180)*cos(latitude0*pi/180)
y = (latitude-latitude0)*(6378137*pi/180)
(latitude0, longitude0) are the coordinates of a reference point (e.g. the lower-left corner of the bounding box)
units are degrees for angles and meters for distances
Edit -- explanation :
This is an orthographic projection of the Earth considered as a sphere whose radius is 6378137.0 m (semi-major axis of the WGS84 ellipsoid), centered on the point (lat0, lon0)
In OpenMap, there are a number of ways to convert from radians to decimal degrees:
Length.DECIMAL_DEGREE.fromRadians(radVal);
Math.toDegrees(radVal) // Standard java library
For an array, you can use ProjMath.arrayDegToRad(double[] radvals);
Be careful with that last one, it does the conversion in place. So if you grab a lat/lon array from an OMPoly, make a copy of it first before converting it. Otherwise, you'll mess up the internal coordinates of the OMPoly, which it expects to be in radians.