问题描述
我是一位为智能手机开发基于JavaScript的网络应用程序的新手程序员。
应用程序获取经度&纬度使用navigator.geolocation API。
我需要一个基于JavaScript的函数将获取的位置转换为Easting&使用Polyconic Transformation进行北极化,需要我支持的Everest - India 1830基准。此外,还需要将Easting / Northing转换为Longitude / Latitude的相反功能。
在对互联网进行研究后,我发现。但是,我无法清楚地了解所需转换的程序。也没有找到足够的文档。
在此先感谢。
好的,使用Spatialreference.org的REST服务,你可以获得这个预测的定义(http://spatialreference.org/ref/sr-org/7345/proj4/),结果是
+ proj = poly + lat_0 = 33.625 + lon_0 = 77.375 + x_0 = 0 + y_0 = 0 + a = 6377301.243 + b = 6356100.228368102 + units = m + no_defs
为了使它与proj4一起工作,在defs /文件夹中创建一个名为<$ c的定义文件包含以下内容:
Proj4js.defs [SRORG7345] => $ c> SRORG7345.js
+ proj = poly + lat_0 = 33.625 + lon_0 = 77.375 + x_0 = 0 + y_0 = 0 + a = 6377301.243 + b = 6356100.228368102 + units = m + no_defs;
然后,将这个从EPSG:4236转换为您的新投影:
< html>
< Script src ='proj4js-compressed.js'>< / script>
< script src ='defs / EPSG4236.js'>< / script>
< script src ='defs / SRORG7345.js'>< / script>
< script>
//创建源和目标Proj4js对象
//一旦初始化,这些可以根据需要重复使用
var source = new Proj4js.Proj('EPSG:4236'); //源坐标将位于经度/纬度
var dest = new Proj4js.Proj('SRORG7345'); // IndiaPolyConic
var p = new Proj4js.Point(-76.0,45.0); //只要有'x'和'y'属性,任何对象都会执行
Proj4js.transform(source,dest,p); //做转换。 x和y被修改
console.log(p);
< / script>
< / html>
我会注意到,根据proj4js项目页面,多重转换还没有被验证任何测试点,所以你可能需要做一些检查这些结果。
I am a novice programmer working on a JavaScript based web application for smartphones.
The application obtains the longitude & latitude using navigator.geolocation API.
I need a JavaScript based function to convert the obtained location into Easting & Northing using Polyconic Transformation with the "Everest - India 1830" datum, which I need to support. Also an inverse function of the same would be required to convert Easting/Northing to Longitude/Latitude.
After doing research on the internet I came across proj4js. However, I could not get a very clear understanding of the procedure for the required conversion & also did not find adequate documentation.
Thanks in advance.
OK, using Spatialreference.org's REST service you can obtain the definition of this projection (http://spatialreference.org/ref/sr-org/7345/proj4/) which turns out to be
+proj=poly +lat_0=33.625 +lon_0=77.375 +x_0=0 +y_0=0 +a=6377301.243 +b=6356100.228368102 +units=m +no_defs
To get this to work with proj4, create a definition file in the defs/ folder called SRORG7345.js
containing the following:
Proj4js.defs["SRORG7345"] = "+proj=poly +lat_0=33.625 +lon_0=77.375 +x_0=0 +y_0=0 +a=6377301.243 +b=6356100.228368102 +units=m +no_defs";
Then do this to transform from EPSG:4236 to your new projection:
<html>
<Script src='proj4js-compressed.js'></script>
<script src='defs/EPSG4236.js'></script>
<script src='defs/SRORG7345.js'></script>
<script>
// creating source and destination Proj4js objects
// once initialized, these may be re-used as often as needed
var source = new Proj4js.Proj('EPSG:4236'); //source coordinates will be in Longitude/Latitude
var dest = new Proj4js.Proj('SRORG7345'); //IndiaPolyConic
var p = new Proj4js.Point(-76.0,45.0); //any object will do as long as it has 'x' and 'y' properties
Proj4js.transform(source, dest, p); //do the transformation. x and y are modified in place
console.log(p);
</script>
</html>
I'd note that according to the proj4js project page, the polyconic conversions "have not been validated against any test points yet" so you'll probably need to doing some checking of these results.
这篇关于经度纬度(WGS84)到Polyconic转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!