小编Jef*_*iks的帖子

React-Native(iOS)中的Google地图

我的目标是在React Native中显示Google Map.我见过将Google Maps SDK与UIMapView或MapBox地图一起使用的示例,但这不是我要找的.

我目前没有错误.这是我的代码:

index.ios.js

'use strict';
import React, {
    AppRegistry,
    Component,
    StyleSheet,
    Text,
    View
} from 'react-native';
import GoogleMaps from './ios/GoogleMaps.js';

class RCTGoogleMaps extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <View style={styles.container}>
                <GoogleMaps style={styles.map}/>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF'
    },
    map: {
        height: 500,
        width: 300,
        marginLeft: 50
    }
});

AppRegistry.registerComponent('RCTGoogleMaps', () => RCTGoogleMaps);
Run Code Online (Sandbox Code Playgroud)

IOS/GoogleMaps.js

var {requireNativeComponent} = require('react-native');
module.exports …
Run Code Online (Sandbox Code Playgroud)

google-maps google-maps-api-3 ios react-native

11
推荐指数
1
解决办法
6671
查看次数

CesiumJS - 两点之间的距离

我的目标是计算两个Cesium实体之间的距离,以千米为单位.作为奖励,我最终希望能够以像素为单位测量它们的距离.

我有一堆KML格式的地标,如下所示:

<Placemark>
  <name>Place</name>
  <Point><coordinates>48.655,-31.175</coordinates></Point>
  <styleUrl>#style</styleUrl>
  <ExtendedData>
     ...
  </ExtendedData>
</Placemark>
Run Code Online (Sandbox Code Playgroud)

我将它们导入到Cesium中,如下所示:

viewer.dataSources.add(Cesium.KmlDataSource.load('./data.kml', options)).then(function(dataSource) {
  var entities = dataSource.entities._entities._array;
Run Code Online (Sandbox Code Playgroud)

我试图创建我关心的实体的新Cartesian3对象,但是我从实体对象获得的x,y和z值是数十万.我的KML的纬度和经度无法在实体对象中找到.

如果我创建Cartesian3对象并计算距离,如下所示:

var distance = Cesium.Cartesian3.distance(firstPoint, secondPoint);
Run Code Online (Sandbox Code Playgroud)

它返回数百万的数字.我已经用这种方式评估了多个点之间的距离,当我将这些返回的值与在线计算器的结果进行比较时,它返回以千米为单位的实际值,距离的差异不是线性的(Cesium返回的一些距离是900乘以实际距离,有些是实际距离的700倍).

我希望这足以获得帮助.我不知道从哪里开始解决这个问题.任何帮助,将不胜感激.谢谢.

javascript distance kml cesium

4
推荐指数
1
解决办法
3799
查看次数