dongyuduan1890 2016-01-19 17:59
浏览 55

纬度和经度问题超出边界值

I have a strange issue. I'm parsing the feed into the SOLR index and one of the fields is the latlon (location) field type. Everything works fine, but I've stumbled upon a strange latitude and the longitude data within the feed, so my import into SOLR failed with error:

Bad X value -245.0791883469 is not in boundary Rect(minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)

The input was (lat,lon) : -8.1832432059,-245.0791883469

I know that the latitude must be within -180 and 180, and I've made a latitude & longitude validation for those fields which I've skipped. BUT, when I used this service http://www.latlong.net/Show-Latitude-Longitude.html to check this weird latitude and longitude data, I was surprised that they actually converts the wrong latitude input to the correct one (which basically matches the location in my feed, except that I have the wrong longitude). Or I really miss something out... Screenshot:

enter image description here

So I'm wondering if there is some kind of formula to do that? To convert latitude/longitude values out of regular boundaries?

Thanks

EDIT:

Solved. If any of you stumble across this problem, the really simple solution is to add/subtract the 360 from a longitude. Some feeds have a full 360 degrees longitude radius, and to convert those to 2D points - longitude value less than -180 will have 360 added to it, and a longitude value greater than 180 will have 360 subtracted from it. This works of course if the longitude and latitude as a pair is not obsolete.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)