开发者

How to display lines created in android in web google maps?

开发者 https://www.devze.com 2023-01-05 13:50 出处:网络
Does anyone know how to display points, lines etc. (basically every overlay) created in android in standard google maps on website? The android db is synchronized with remote db. I\'m getting the poin

Does anyone know how to display points, lines etc. (basically every overlay) created in android in standard google maps on website? The android db is synchronized with remote db. I'm getting the points from the database, creating kml file from them and uploading in to the map. The problem is that the areas开发者_StackOverflow社区 I've created are not appearing where they should. They're somewhere on the ocean. I thought that's because I'm running this code in android:

Double lat = location.getLatitude()*1E6;
Double lng = location.getLongitude()*1E6;

So basically I'm doing microdegrees here. I thought that dividing lat and long from db by 1E6 would do the trick but it didn't. Can someone please help me on that one? Thanks in advance.


I don't know which format is expected by the map. If it is normal coordinates, then I guess you would need to do:

float lat = ((float)location.getLatitude()) / 1E6;

Otherwise, if it is expecting it in int format, you don't need to do anything

P.S. Assuming getLatitude() returns an int, the cast to float is important. Otherwise 4539845 will become 45 and not 45.39845


I agree with ltsik, the E6 format is basically the regular latitude multitplied by 1E6 (or 1,000,000 whichever one you prefer) so it makes perfect sense that the variables lat and lng are obtained by dividing and not multiplying

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号