|| | |||Browse by category|
http://www.kbpublisher.com - http://www.kbpublisher.com
[b]text[/b] - Bold text.
[u]text[/u] - Underline text.
[i]text[/i] - Italic text.
[color=green]text[/color] - Colored text.
[url]kbpublisher.com[/url] - kbpublisher.com
[url=kbpublisher.com]text[/url] - text
[email]email@example.com[/email] - firstname.lastname@example.org
[h1]text[/h1] - Caption text.
- item 1
- item 2
- item 1
- item 2
How to draw a 'circle' in a map?
First of all, it must be said that "drawing a circle in a map" is probably nonsense. Instead, the objective of such a statement is usually how to draw the representation of positions equidistant to a point on the surface of the earth. This approach is used, for example, to display the range of an antenna, an area of influence, and so on.
In a projected map, the points equidistant to a given center on the surface of the earth do not necessarily result in a circle. The locations of this collection of equidistant points depend on the type of projection. Here is the difficulty: there is no general procedure for computing distances on any projection.
The key to finding the coordinates of points equidistant to a center point on the surface of the earth is the Azimuthal Equidistant projection, whose most significant property is the fact that distances to its center are true. "True" means here that each unit of distance in a map using this projection represents a unit of distance on the surface of the earth. For example, 1 unit (centimeter or pixel) on this kind of map represents 1 meter on the surface of the earth. It is important to remember that this property of the Azimuthal Equidistant projection is valid only for distances measured from the center of the projection. The JViews class for this projection is the
In an Azimuthal Equidistant projected space, it is possible to find the equidistant points from the center in the same way as in a common Cartesian space; hence, a circle around the center of the projection will represent equidistant positions from that center on the surface of the earth.
Once these positions in the Azimuthal Equidistant projected space are found, their latitude and longitude coordinates can be obtained by doing the inverse transformation of the projection. Finally, these latitudes and longitudes can be projected normally on the final map using its projection -Mercator, UTM, Cassini, or any other.
The following image shows an area of radius 6000 kilometers centered at 0 degrees North and 0 degrees East. The projection used is an Azimuthal Equidistant projection. Hence, the area appears as a perfect circle.
Now, if another kind of projection is used, the "circular" area is transformed into another kind of shape. The nature of this shape depends on the type of projection and its location on the surface of the earth. For the area described above (centered at 0DN and 0DE, 6000 kilometer radius), the result looks like this:
The attached sample perfoms the operations described above to render an area of variable radius (can be changed with the slider at the bottom from 0 meters to 6000 kilometers), centered at the position on the earth chosen by the user by clicking in the map. The result can be displayed on the different projections available in the JViews Maps library.
The pseudocode of the computation to get the points of the area on the map is the following:
- Let 'p' be the center of the area, expressed as latitude and longitude.
- Let 'radius' be the radius of the area, in meters.
- Let 'projection' be the projection used in the map.
The actions are the following:
- Build an Azimuthal Equidistant projection centered at 'p', with 0 false northing and 0 false easting.
- You are going to find 360 points 'radius' meters distant from that center. For each value between 1 and 360:
x = cos(value) * radius y = sin(value) * radius
- The list of 360 points describes a circle around the center. Now transform those points to latitude and longitude coordinates using the inverse operation of the Azimuthal Equidistant projection.
- Now, the points are a list of 360 latitude and longitude coordinates that can be projected on to the final map using the projection chosen by the user. That is the desired area.
Note: this last action is simplified in the sample code by doing a direct transformation from the Azimuthal Equidistant projected space into the user's projected space. Refer to the documentation about the
IlvCoordinateTransformation.CreateTransformation() method, in the JViews Maps User's Manual for further details.
Note: In order to run this sample in JViews 8.7 or newer you must call the ilog.views.util.IlvProductUtil.DeploymentLicenceRequired method with the appropriate argument.