源事件奇怪的纬度经度 [英] Source event strange latitude & longitude

查看:90
本文介绍了源事件奇怪的纬度经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我叫Cyrille,我正在开发一个代号为1的地图应用程序。目标是制作一个可以在用户周围搜索公司的应用程序(带有搜索栏),并将他们想要的公司添加到列表中。然后,列表出现在主窗口中,然后单击它们在地图上显示它。

My name is Cyrille and i'm working on a map app on codename one. The goal is to make an app that can search around the user for companies (with a search bar) and add companies they want to a list. Then the list appear in the main window and clicking on them show it on the map.

我对代号为1的事件部分有疑问。这是我的代码的一部分:

I've got a problem with the event part on codename one. Here's a part of my code :

PointLayer point = new PointLayer(new Coord(lat.doubleValue(), lng.doubleValue()),
                            companyName, null);
                    pl.addPoint(point);
                    pl.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            PointLayer p = (PointLayer) evt.getSource();
                            System.out.println("pressed " + p);
                            Dialog.show("Details", "" + p.getName() + "\nLatitude: " + p.getLatitude() + "\nLongitude: " + p.getLongitude(), "Ok", null);
                        }
                    });

是的,我使用了基本地图模板^^'
我的问题是:当我问我得到的点的坐标:

Yes I took the basic map template ^^' My problem is : When i ask for the coordonates of point I get :


{'经度':2.3485853,'纬度':48.8769309}

{'longitude':2.3485853, 'latitude':48.8769309}

,但是当我要求evt.getSource的同伙时,我得到:

but when I ask for the coordonates of evt.getSource i get :


{'longitude':261443.31964417442,'latitude':6254004.882818963}

{'longitude':261443.31964417442,'latitude':6254004.882818963}

这有点令人不安...

which is kind of perturbing ...

自昨天以来,我一直在互联网上浏览,但是没有找到任何东西,也许我没有在正确的位置进行搜索。

I looked over the internet since yesterday but i didn't find any thing, maybe i'm not searching at the right place. Any clue of what's happening ?

编辑:
多亏了答复者,我才发现了问题。密码被用于另一系统,代号为:Popular Visualization CRS Mercator。为了使用它,您必须将其转换为:com.codename1.maps.Mercator.inverseMercator(latitude,经度);
或者您可以使用Google标记而不是代号人的[这就是我所做的]

EDIT : Thanks to the replyers i found the issue. The coordonates was given in an other system use by codename one : Popular Visualisation CRS Mercator. In order to use it you have to convert it with : com.codename1.maps.Mercator.inverseMercator(latitude, longitude); Or you can use google marker instead of codename one's [That's what i did]

推荐答案

我认为您的坐标事件发生在流行可视化CRS墨卡托(EPSG:900913或EPSG:3785)坐标系中,这是地图控件使用的坐标系。在纬度/经度中添加的点在添加到地图时会自动转换为该系统。 纬度和经度略有误导; x和 y是投影坐标的标准术语。

I think the coordinates you get in the event are in the Popular Visualisation CRS Mercator (EPSG:900913 or EPSG:3785) coordinate system, which is what the map control uses. The points you add in lat/lon are automatically transformed to this system when added to the map. "latitude" and "longitude" are slightly misleading; "x" and "y" are the standard terms for projected coordinates.

这篇关于源事件奇怪的纬度经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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