您好,api里有量算类,可以参考范例距离量算
http://iclient.supermap.io/libs/iclient8c/apidoc/files/SuperMap/Map-js.html
移动端实时获取经纬度是什么方法我也不太清楚,您可以去移动GIS部分提问一下,得到的经纬度进行量算就用量算类就可以,这个并不是说必须画几何图形才能算距离,这个东西的本质其实就是传geometry(线),然后计算线的长度,而构成geometry(线)的其实就是两个geometry(点),所以能够满足您的需求,如果不想要线显示在地图上的话只要最后不把线add到vectorLayer上就可以了。
很久之前写过一个demo你可以参考下
<script type="text/javascript"> var map,layer, vectorlayer,pointFeature, url = "http://localhost:8090/iserver/services/map-world/rest/maps/World"; function init() { map = new SuperMap.Map("map",{controls:[ new SuperMap.Control.Zoom() , new SuperMap.Control.Navigation() , new SuperMap.Control.LayerSwitcher() ]}); layer= new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null,{maxResolution:"auto"}); layer.events.on({"layerInitialized":addLayer}); vectorlayer= new SuperMap.Layer.Vector("vectorLayer"); map.events.on({"click":addData}); } function addLayer() { map.addLayers([layer,vectorlayer]); map.setCenter(new SuperMap.LonLat(0, 0), 0); } var tempArray = []; function addData(a) { var lonlat = map.getLonLatFromPixel(new SuperMap.Pixel(a.xy.x,a.xy.y)); var point= new SuperMap.Geometry.Point(lonlat.lon,lonlat.lat); pointFeature = new SuperMap.Feature.Vector(point); pointFeature.style={ fillColor:"red", strokeColor:"yellow", pointRadius:7 }; vectorlayer.addFeatures(pointFeature); tempArray.push(point); } function lineMeasure() { var p1 = tempArray[tempArray.length-2]; var p2 = tempArray[tempArray.length-1]; var points=[p1,p2]; var line = new SuperMap.Geometry.LineString(points); measureParam = new SuperMap.REST.MeasureParameters(line), myMeasuerService = new SuperMap.REST.MeasureService(url); myMeasuerService.events.on({ "processCompleted": measureCompleted }); myMeasuerService.measureMode = SuperMap.REST.MeasureMode.DISTANCE; myMeasuerService.processAsync(measureParam); } function measureCompleted(measureEventArgs) { var distance = measureEventArgs.result.distance; var unit = measureEventArgs.result.unit; alert("量算结果:"+distance + "米"); } </script>