This article mainly describes the "actual distance on the ArcGIS for Android map and the corresponding screen pixel value calculation", mainly related to the ArcGIS for
The actual distance on the Android map and the corresponding screen pixel value calculations for the ArcGIS for
The actual distance on the Android map and the corresponding screen pixel value calculation of interested students can refer to.
/**
* Convert actual geographic distance to screen pixel value
*
* @param distance
* Actual distance, unit of meter
* @param Currscale
* Current map size
* @param context
* @return
*/
public static double Metretoscreenpixel (double distance, double Currscale,
Context context) {
float dpi = context.getresources (). Getdisplaymetrics (). densitydpi;
1 pixels in the current map extent represents the actual distance of the map units
Double Resolution = (25.39999918/DPI)
* CURRSCALE/1000;
return distance/resolution;
}
/**
* Convert the corresponding pixel distance on the screen to the geographic distance on the current display map (m)
*
* @param pxlength
* @param Currscale
* @param context
* @return
*/
public static double Screenpixeltometre (double pxlength, double Currscale,
Context context) {
float dpi = context.getresources (). Getdisplaymetrics (). densitydpi;
Double Resolution = (25.39999918/DPI)
* CURRSCALE/1000;
return pxlength * Resolution;
}
Actual distance on ArcGIS for Android map and corresponding screen pixel value calculation