If I have a point in latitude/longitude and I want to find out if it is a valid for use within a particular coordinate system, how can I do it?
如果我有纬度/经度点,我想知道它是否适用于特定坐标系,我该怎么办?
As an example. Say I am working in Swiss Grid (CH 1903, EPSG 21781) and have a point representing something in London in the UK, I want to know if that point is valid in the Swiss Grid coordinate system.
举个例子。假设我在瑞士电网(CH 1903,EPSG 21781)工作并在英国伦敦有一个代表点,我想知道这一点在瑞士网格坐标系中是否有效。
Typically the conversion will work, but it may be so far outside the area that Swiss grid is good for that it is not really valid.
通常情况下,转换会起作用,但它可能远远超出瑞士网格区域的范围,因为它不是真正有效的。
The context for this is that users will be importing points in latitude longitude into an application that works in a projected coordinate systme and they want to be warned when the points they are importing fall outside the projected coordinate system bounds.
这样做的背景是,用户将在经纬度被导入点进去,在投影坐标systme运行的应用程序,他们希望当他们点导入的投影坐标系边界之外秋天被警告。
But as far as I can tell, a projected coordinate system does not have any bounds.
但据我所知,投影坐标系没有任何界限。
5 个解决方案
#1
Although the answers listed are correct - there is no concept of "bounds" in a coordinate system, there are still approaches you can use.
尽管列出的答案是正确的 - 在坐标系中没有“边界”的概念,但仍然可以使用的方法。
The EPSG database provides a latitude/longitude bounding box for each coordinate system defined. This is listed in the "Area" table, and provides a (albeit rough) bounding box in which the coordinate system is reasonable. This alone might be enough to help you determine a reasonable extent.
EPSG数据库为定义的每个坐标系提供纬度/经度边界框。这在“区域”表中列出,并提供了一个(尽管是粗略的)边界框,其中坐标系是合理的。仅这一点就足以帮助您确定合理的范围。
By checking the coordinate of your point, and the four corners in the EPSG DB, you should be able to tell whether the coordinate is (potentially) reasonable for a given projection.
通过检查点的坐标以及EPSG DB中的四个角,您应该能够判断坐标对于给定投影是否(可能)合理。
#2
You're imposing an artificial bounds upon the coordinate system by stating that there is a limit to the system itself (i.e. a point is "outside" the bounds because it falls out of the area I care about).
你在坐标系上强加了一个人为界限,说明系统本身有一个限制(即一个点在“界外”,因为它落在我关心的区域之外)。
In that case, find the "corners" of the area you're interested in. If a point falls outside of those bounds, then you can flag the point as being outside your area of interest.
在这种情况下,找到您感兴趣的区域的“角落”。如果一个点落在这些边界之外,那么您可以将该点标记为在您感兴趣的区域之外。
#3
The bounds for a given coordinate system are specific to that coordinate system so there is no generic algorithm for determining if a coordinate is out of bounds.
给定坐标系的边界特定于该坐标系,因此没有用于确定坐标是否超出边界的通用算法。
Beyond that, being "out of bounds" is probably specific to your domain. For example, in the Swiss Grid, 400N 200E is not in Switzerland, and therefore out of bounds for the typical use of the Swiss Grid and yet still represents a real place. Is this out of bounds for your domain or not?
除此之外,“超出范围”可能是您的域特有的。例如,在瑞士电网中,400N 200E不在瑞士,因此不受瑞士电网典型使用的限制,但仍然是一个真实的地方。这是否超出您的域名范围?
#4
Sorry, but you are stuck implementing something on your own, because it really needs to be your rules. Projected coordinate systems typically don't have bounds, but they have error behavior. For a particular application, a given projected coordinate system is often only accurate enough within certain bounds.
对不起,但你自己实施了一些东西,因为它确实需要成为你的规则。投影坐标系通常没有边界,但它们具有错误行为。对于特定应用,给定的投影坐标系通常仅在某些范围内足够准确。
The short answer therefore is that it really needs to be up to your application to impose those restrictions. Every coordinate system is different, and your needs will drive a lot of it. For instance, perhaps you need 100 meter accuracy, in which case the Swiss Grid might be adequate for a fairly large area. If you need 10 meter accuracy, the errors the build up on the edge cases will become significant much faster, and therefore your bounds must be tighter.
因此,简短的答案是,确实需要由您的应用程序来强加这些限制。每个坐标系都是不同的,你的需求会带来很多。例如,您可能需要100米的精度,在这种情况下,瑞士网格可能适用于相当大的区域。如果您需要10米的精度,边缘情况下积累的误差将变得更快,因此您的界限必须更严格。
Using a "four-corners-bounding-box" approach will work the bulk of the time, but it's not universal. Some projections bounds are better expressed as "radius from the central point", and it wouldn't shock me if some where "distance from the prime meridian". It's all a matter of how the errors build up for a given projection.
使用“四角边框”方法将在大部分时间内工作,但它并不普遍。一些投影边界更好地表达为“从中心点开始的半径”,如果某些距离“本初子午线”的距离,它就不会让我感到震惊。这完全取决于错误如何为给定的投影而积累。
#5
The EPSG and custom projections are available at:
EPSG和自定义预测可在以下位置获得:
http://www.spatialreference.org/
Search the site for your EPSG code and you can see the coordinates listed.
在网站上搜索您的EPSG代码,您可以看到列出的坐标。
#1
Although the answers listed are correct - there is no concept of "bounds" in a coordinate system, there are still approaches you can use.
尽管列出的答案是正确的 - 在坐标系中没有“边界”的概念,但仍然可以使用的方法。
The EPSG database provides a latitude/longitude bounding box for each coordinate system defined. This is listed in the "Area" table, and provides a (albeit rough) bounding box in which the coordinate system is reasonable. This alone might be enough to help you determine a reasonable extent.
EPSG数据库为定义的每个坐标系提供纬度/经度边界框。这在“区域”表中列出,并提供了一个(尽管是粗略的)边界框,其中坐标系是合理的。仅这一点就足以帮助您确定合理的范围。
By checking the coordinate of your point, and the four corners in the EPSG DB, you should be able to tell whether the coordinate is (potentially) reasonable for a given projection.
通过检查点的坐标以及EPSG DB中的四个角,您应该能够判断坐标对于给定投影是否(可能)合理。
#2
You're imposing an artificial bounds upon the coordinate system by stating that there is a limit to the system itself (i.e. a point is "outside" the bounds because it falls out of the area I care about).
你在坐标系上强加了一个人为界限,说明系统本身有一个限制(即一个点在“界外”,因为它落在我关心的区域之外)。
In that case, find the "corners" of the area you're interested in. If a point falls outside of those bounds, then you can flag the point as being outside your area of interest.
在这种情况下,找到您感兴趣的区域的“角落”。如果一个点落在这些边界之外,那么您可以将该点标记为在您感兴趣的区域之外。
#3
The bounds for a given coordinate system are specific to that coordinate system so there is no generic algorithm for determining if a coordinate is out of bounds.
给定坐标系的边界特定于该坐标系,因此没有用于确定坐标是否超出边界的通用算法。
Beyond that, being "out of bounds" is probably specific to your domain. For example, in the Swiss Grid, 400N 200E is not in Switzerland, and therefore out of bounds for the typical use of the Swiss Grid and yet still represents a real place. Is this out of bounds for your domain or not?
除此之外,“超出范围”可能是您的域特有的。例如,在瑞士电网中,400N 200E不在瑞士,因此不受瑞士电网典型使用的限制,但仍然是一个真实的地方。这是否超出您的域名范围?
#4
Sorry, but you are stuck implementing something on your own, because it really needs to be your rules. Projected coordinate systems typically don't have bounds, but they have error behavior. For a particular application, a given projected coordinate system is often only accurate enough within certain bounds.
对不起,但你自己实施了一些东西,因为它确实需要成为你的规则。投影坐标系通常没有边界,但它们具有错误行为。对于特定应用,给定的投影坐标系通常仅在某些范围内足够准确。
The short answer therefore is that it really needs to be up to your application to impose those restrictions. Every coordinate system is different, and your needs will drive a lot of it. For instance, perhaps you need 100 meter accuracy, in which case the Swiss Grid might be adequate for a fairly large area. If you need 10 meter accuracy, the errors the build up on the edge cases will become significant much faster, and therefore your bounds must be tighter.
因此,简短的答案是,确实需要由您的应用程序来强加这些限制。每个坐标系都是不同的,你的需求会带来很多。例如,您可能需要100米的精度,在这种情况下,瑞士网格可能适用于相当大的区域。如果您需要10米的精度,边缘情况下积累的误差将变得更快,因此您的界限必须更严格。
Using a "four-corners-bounding-box" approach will work the bulk of the time, but it's not universal. Some projections bounds are better expressed as "radius from the central point", and it wouldn't shock me if some where "distance from the prime meridian". It's all a matter of how the errors build up for a given projection.
使用“四角边框”方法将在大部分时间内工作,但它并不普遍。一些投影边界更好地表达为“从中心点开始的半径”,如果某些距离“本初子午线”的距离,它就不会让我感到震惊。这完全取决于错误如何为给定的投影而积累。
#5
The EPSG and custom projections are available at:
EPSG和自定义预测可在以下位置获得:
http://www.spatialreference.org/
Search the site for your EPSG code and you can see the coordinates listed.
在网站上搜索您的EPSG代码,您可以看到列出的坐标。