仅将国家/地区转换为坐标 [英] Convert long and lat to Coordinates on country only

查看:216
本文介绍了仅将国家/地区转换为坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


日本的地图上的指针...

the map of japan with pointer on it...

问题是将转换长度的公式,以获得与日本地图的正确坐标。

The problem is what will be the formula to to convert the lat ang long to get the right coordinates with the map of japan only..

我使用php gd与图像的地图和指针。

i use php gd with both image the map and the pointer..

我已经设法绘制正确的坐标在全世界使用这个代码--->

i already manage to plot the right coordinate in whole world using with this code --->

function getlocationcoords($lat, $lon, $width, $height)
{
   $x = (($lon + 180) * ($width / 360));
   $y = ((($lat * -1) + 90) * ($height / 180));
   return array("x"=>round($x),"y"=>round($y));
}

任何帮助都赞赏..

谢谢...

推荐答案

这不是那么简单。您需要计算两个轴的映射边界和增量,即e.e。一个因素这不是很准确,但您可以使用代码和一些尝试和错误。例如,如果您对两个轴使用相同的因子,它看起来很奇怪,根本不符合地图。

It's not so simple. You need to compute the map bounds and the delta of both axis, I.e. a factor. It's not very accurate but you can use the code and a bit of trial and error. For example if you use the same factor for both axis it looks weird and simply doesn't fit the map.

这篇关于仅将国家/地区转换为坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆