Label

Books (1) CARTO (3) Fun (21) GBDX (1) geoserver (1) GIS (57) greed (4) memo (4) movie (1) music (2) python (4) R (12) statistics (10) study (20) swim (5) tools (19) Ubuntu (7)

2020/05/08

【CARTOframes】Google Colabで使ってみる


  1. Create Google Account
  2. Login to Colab (https://colab.research.google.com/)
  3. Start new notebook
  4. Install CARTOframes ( and other libraries)
    • ! pip install cartoframes geopandas numpy pandas
  5. Mount your Google Drive
    • #connect to Google Drive
    • from google.colab import drive
    • drive.mount('/content/gdrive')
  6. Save your credential JSON in your Google Drive
  7. Set your credential
    • from cartoframes.auth import set default_credentials
    • set_default_credentials('credential.json')

2019/12/26

【CARTOframes】read csv file from website and visualize

自治体オープンデータで公開されているデータのうち、緯度経度列があってCSV形式のものを選んで地図化してみる。

1.データのURLをゲット

消防水利施設(公設消火栓)一覧(2019(H31 ).4.1現在)というデータを発見
  URLは以下のとおり
https://ckan.open-governmentdata.org/dataset/1ce73d8b-ea8f-4a3e-9c8e-8f38632e0981/resource/4bf745d7-efbf-48c2-9e0f-26c25dcce86b/download/401005_fire_hydrant_syoukasen_20190401.csv

2.CARTOframesの環境でjupyter notebookを起動

こちらを参照

3.pandasのdfとして読み込んでからcartoのdfとする


from pandas import read_csv

from cartoframes import CartoDataFrame

#ここでさっきの消防施設のCSVへのパスを設定

remote_file_path = 'https://ckan.open-governmentdata.org/dataset/1ce73d8b-ea8f-4a3e-9c8e-8f38632e0981/resource/4bf745d7-efbf-48c2-9e0f-26c25dcce86b/download/401005_fire_hydrant_syoukasen_20190401.csv'

#pandasのdfとして読み込み

df = read_csv(remote_file_path,encoding="shift_jis")

#cartoのdfとして読み込み

cdf = CartoDataFrame(df)

#緯度経度列を使ってジオメトリを作成

cdf.set_geometry_from_xy('経度', '緯度', inplace=True)

#一覧表示

cdf.head()

4.地図表示

cdf.viz()


出来上がり!




【CARTOframes】Installing CARTOframes

Python 3.6 + CARTOframes 1.0b7 on Windows10


1.  Install Python

     https://www.python.org/downloads/windows/
     python-3.6.8-amd64-webinstall.exe

2. Create venv

    ・Start cmd.exe
    ・cd to your working directory
cd C:\yourworkingdirectory
    ・Create environment called "cartoframes"
python -m venv cartoframes

3. Activate

C:\yourwirkingdirectory\cartoframes\Scripts\activate

4. Install libraries

   GDAL

   ・Download whl file from here
   ・Find "GDAL‑3.0.2‑cp36‑cp36m‑win_amd64.whl"(for 64 bit)
   ・Save it to your working directory
pip install GDAL-3.0.2-cp36-cp36m-win_amd64.whl

   Fiona

   ・Download whl file from here
   ・Find "Fiona‑1.8.13‑cp36‑cp36m‑win_amd64.whl"(for 64 bit)
   ・Save it to your working directory
pip installFiona‑1.8.13‑cp36‑cp36m‑win_amd64.whl

   Shapely

   ・Download whl file from here
   ・Find "Shapely‑1.6.4.post2‑cp36‑cp36m‑win_amd64.whl"(for 64 bit)
   ・Save it to your working directory
pip installShapely‑1.6.4.post2‑cp36‑cp36m‑win_amd64.whl

   Geopandas

pip install geopandas

   cartoframes

pip install cartoframes==1.0b7

   jupyter notebook

pip install jupyter notebook

5. Check 

   ・Open jupyter notebook
jupyter notebook
   ・And try to run this example




  

2018/05/30

GBDXをローカルにインストール

ローカルというかJupyter notebookから使えるようにするときのメモ

ソース:https://geobigdata.github.io/gbdx-training/gbdxtools_module/

1.Anaconda promptから
conda update conda

2.gbdxtools_env.ymlをDLしてローカルに保存

3.condaの環境を準備(2を保存した場所へのパス)
conda env create -f C:\workspace\gbdx_environment.yml

4.環境をアクティベート
conda activate gbdxtools

5.インストールの確認
python -c "import rasterio; import fiona; import shapely; import gbdxtools"

6.ANACONDA NAVIGATORのChannelsでgbdxoolsを選択

7.Jupyter notebookを起動
gbdxtools-test.ipynb をDL → 開く

2015/12/18

【geoserver】setting up geoserver

Ubuntu Server の環境を用意して、Tera Term等のターミナルから接続。

Apache2とTomcat7の上でGeoServer2.8.1を動かします。

# Apache2のインストール
sudo apt-get install apache2

# OpenJDK7のインストール
sudo apt-get install openjdk-7-jre-headless

# Tomcat7のインストール
sudo apt-get install tomcat7 tomcat7-admin

# Tomcatユーザーにmanager-guiを追加
sudo vi /var/lib/tomcat7/conf/tomcat-users.xml

i
# で編集モードに入って、以下を追加

<tomcat-users>
  <role rolename="manager-gui"/>
  <role rolename="admin"/>
  <user username="tomcat" password="tomcat" roles="admin,manager-gui"/>
</tomcat-users>


Esc
# でコマンドモードに戻って

:w
# で保存して
:q
# で閉じる

# GeoServerのインストール
# tomcat7のサービスを一旦とめる
sudo service tomcat7 stop

# ジオサーバの最新版をゲット
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.8.1/geoserver-2.8.1-war.zip
sudo unzip -d /var/lib/tomcat7/webapps/ geoserver-2.8.1-war.zip

# 再起動
sudo service tomcat7 restart
sudo service apache2 restart