私は今数日間苦労したのであなたに尋ねています; インターネットとstackoverflowを検索しましたが、何も見つかりませんでした。
マーカー/円/何でも正確に地図上に配置する必要があります。ただ、自分の居場所によって精度が決まるグリッドにしか描けないようです。したがって、それらの位置は十分に正確ではありません。
Wt(C ++)を使用していますが、問題の一部ではないようです。座標が等間隔に配置された20*20の円の配列を描画するコードを作成しました。パリにいてもニューヨークにいても、同じ結果は得られません。
パリで:(私の最初の質問なので、画像を投稿できません) http://img818.imageshack.us/img818/7841/parism.png
ニューヨークの場合:http: //img193.imageshack.us/img193/9822/newyorkq.png
パリでは、経度は正確ですが、緯度は正確ではありません。ニューヨークでは、緯度でも経度でも精度がわかりません。
これが私が使用したコードです:
/*Choose between both*/
double centerLat = 40.714468; double centerLng = -74.005966;//New-York
//double centerLat = 48.854607; double centerLng = 2.347126;//Paris
/*Other parameters*/
double lngMargin = 0.000400;
double latMargin = 0.000400;
int granularity = 20;
int i,j;
WVBoxLayout* layout = new WVBoxLayout();
WColor::WColor myBlue = WColor::WColor(0,0,255,255);
WColor::WColor myRed = WColor::WColor(255,0,0,255);
WColor::WColor myTransparent = WColor::WColor(0,0,0,0);
WGoogleMap::Coordinate coordArray[granularity][granularity];
/* Creating and configuring the map */
WGoogleMap *map = new WGoogleMap(WGoogleMap::Version3);
WGoogleMap::Coordinate centerCoord = WGoogleMap::Coordinate(centerLat,centerLng);
setLayout(layout);
resize(height,width);
map->setCenter(centerCoord,19);
map->setMapTypeControl(WGoogleMap::DefaultControl);
map->enableScrollWheelZoom();
map->addCircle(centerCoord,2,myBlue,2,myTransparent);
/* Here is the loop that draws the circles */
for(i=0 ; i<=granularity-1 ; i++){
for(j=0 ; j<=granularity-1 ; j++){
coordArray[i][j] = WGoogleMap::Coordinate(centerLat + beforeOrAfterTheCenter_Lat * (latMargin/granularity) * i,
centerLng + beforeOrAfterTheCenter_Lng * (lngMargin/granularity) * j);
map->addCircle(coordArray[i][j],1,myRed,2,myTransparent);
}
}
コードは正常に機能するはずです。より正確にするために私が何ができるかについて何か手がかりがありますか?よく知られている問題ですか?
あなたが提供できるどんな助けにも感謝します、
L。