import React, { Fragment } from 'react'; import axios from 'axios'; import ReactDOM from 'react-dom'; const GEOCODE_ENDPOINT = 'https://maps.googleapis.com/maps/api/geocode/json'; class Importer extends React.Component { constructor(props) { super(props); this.state = { place: '通天閣', // ここに好きな場所を指定。 }; } handleGetLatAndLng() { // Google Maps APIが指定した必須パラメータ(この場合はaddress)をparamsに渡す。 axios .POST("/_api/admin/settings/importerEsa", { params: { address: this.state.place } }) .then((results) => { // 以下のGoogle API のレスポンスの例を元に欲しいデータを取得 const data = results.data; const result = data.results[0]; const location = result.geometry.location; this.setState({ address: result.formatted_address, lat: location.lat, lng: location.lng, }); }) .catch(() => { console.log('通信に失敗しました。'); }); } render() { return (

緯度軽度検索

土地名: {this.state.place}

経度: {this.state.lat}

経度: {this.state.lng}

{ return this.handleGetLatAndLng() }} />
{/* {{ t('importer_management.import_from', 'esa.io') }} */}を表示する
esa.io GROWI
{/* {{ t('Article') }} */} を表示する {/* {{ t('Page') }} */} を表示する
{/* {{ t('Category') }} */} を表示する {/* {{ t('Page Path') }} */} を表示する
{/* {{ t('User') }} */} を表示する (TBD)
  • {/* {{ t("importer_management.page_skip") }} */} を表示する
); } } export default Importer; { /*

緯度軽度検索

土地名: {this.state.place}

経度: {this.state.lat}

経度: {this.state.lng}

{ return this.handleGetLatAndLng() }} />
*/ }