簡體   English   中英

如何將經度和緯度轉換為點並使用繪制多邊形中的點

[英]How to convert Longitude and Latitude to points and using the points in drawing a polygon

我是GIS應用程序的新手,我有一點問題。 我正在嘗試使用地理坐標繪制多邊形,但我需要將這些坐標轉換為點,然后才能在繪制多邊形時使用它們。 我不知道如何將這些坐標轉換為用於多邊形的點。 我花了我所有的昨天發現如何做到這一點,但我仍然沒有得到它。 我嘗試在ms sql server 2008中使用geography數據類型但是在檢索多邊形或轉換后的坐標時找不到java api。 請幫我提供一些如何執行此操作的示例代碼。

非常感謝!!!

這是我的代碼。 '碼'

double earth=6371;
double focal=500;

double lat= 47.653 ;
double lon = -122.358  ;

double latitude = lat*Math.PI/180;
double longitude = lon*Math.PI/180;

double x = earth * Math.sin(latitude)*Math.cos(longitude);

double y = earth * Math.sin(latitude)*Math.sin(longitude);

double z = earth * Math.cos(latitude);

double projectedX = x*focal /(focal+z);

double projectedY = y * focal / (focal+z);

int magx = (int) Math.round(projectedX * 5); 
int magy = (int) Math.round(projectedY *5);

System.out.println ("MAG X : "+magx);
System.out.println ("MAG Y : "+magy);

我只是將d mag x和y插入我的多邊形但沒有出現。

這是從一組n個坐標創建和檢索SQL Server中的地理多邊形的語法:

DECLARE @Polygon geography;
SET @Polygon = geography::STPolyFromText('POLYGON((Lon1 Lat1, Lon2 Lat2, ... Lonn Latn, Lon1 Lat1))', 4326); 
SELECT @Polygon;

(這假設您使用的是相對於WGS84基准面的地理坐標。如果您不知道這意味着什么,它們可能就是。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM