Created a darts trip with python (news)

Introduction

Hello everyone! Last year, I and four of my friends were planning a trip to rent a camper and travel darts ... I forgot the darts and the map on the day of the trip. Even though it's the key to this trip ... My friend and I were really depressed. Our property is a camper, a wallet, a change of clothes, a PC ... that! PC Anjan! !! If you don't have one, you can create it by programming (python)! !! I created it, so I think I'll write an article.

For this article

・ Those who were trying to travel darts but forgot the important darts and have a computer at hand ・ Those who have a personal computer and do not have darts and a map of Japan

How to make a map of Japan?

I thought that I had to have a map to travel darts, so I investigated how to output a map of Japan with python. Then I could use a library called folium, so I tried it.

nihon.py


import numpy as np
import pandas as pd

import folium
from folium import plugins

#Hakodate
LAT = 41.773709
LNG = 140.726413

map = folium.Map(location=[LAT,LNG])

#Make a pin
folium.Marker(
    location=[LAT,LNG],
    popup="This is Simple Marker"
).add_to(map)
#Run
map

The output looks like this! image.png

Since I entered the latitude and longitude of Hakodate City, the output is solid!

Try darts

If you randomize the longitude and latitude here and randomize the latitude and longitude of Japan, it will be completed! The code is here.

nihon.py


import numpy as np
import pandas as pd
import random

import folium
from folium import plugins

#Numbers are randomly assigned within the range of Japan.
LAT = random.uniform(20,46)
LNG = random.uniform(112,154)

map = folium.Map(location=[LAT,LNG])

#Make a pin
folium.Marker(
    location=[LAT,LNG],
    popup="This is Simple Marker"
).add_to(map)

#Run
map

Where should we go! python! You decide! image.png e? ... image.png Eh ... image.png

Do you all have sea bread?

This time, I used a library called folium to visualize the map and created a simple darts trip with the random function. I want to make it so that it will not fall into the sea, but I would like to rewrite it again when I have time. Then everyone ... are you ready for sea bread?

Recommended Posts

Created a darts trip with python (news)
A simple to-do list created with Python + Django
Sample data created with python
I made a net news notification app with Python
Make a fortune with Python
Create a directory with python
Try running python in a Django environment created with pipenv
[Python] What is a with statement?
Solve ABC163 A ~ C with Python
Operate a receipt printer with python
A python graphing manual with Matplotlib.
Let's make a GUI with python.
Solve ABC166 A ~ D with Python
Building a virtual environment with Python 3
Solve ABC168 A ~ C with Python
Make a recommender system with python
[Python] Generate a password with Slackbot
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python
Let's make a graph with python! !!
[Python] Inherit a class with class variables
I made a daemon with Python
Write a batch script with Python3.5 ~
How to batch start a python program created with Jupyter notebook
[Python] A memo to operate ROM created by GBDK with PyBoy
[Pyenv] Building a python environment with ubuntu 16.04
Spiral book in Python! Python with a spiral book! (Chapter 14 ~)
Create a Python function decorator with Class
Creating a simple PowerPoint file with Python
[Python] A program that creates stairs with #
Building a Python3 environment with Amazon Linux2
Let's make a shiritori game with Python
Build a blockchain with Python ① Create a class
Add a Python data source with Redash
Create a dummy image with Python + PIL.
I tried scraping Yahoo News with Python
I made a character counter with Python
[Python] Drawing a swirl pattern with turtle
I drew a heatmap with seaborn [Python]
[Python] Create a virtual environment with Anaconda
Let's create a free group with Python
A memo with Python2.7 and Python3 on CentOS
Building a Python 3.6 environment with Windows + PowerShell
Search the maze with the python A * algorithm
Daemonize a Python web app with Supervisor
Let's make a voice slowly with Python
I tried a functional language with Python
[Python] A quick web application with Bottle!
[AtCoder] Solve ABC1 ~ 100 A problem with Python
Write a TCP client with Python Twisted
What I did with a Python array
Solve AtCoder ABC168 with python (A ~ D)
Create a word frequency counter with Python 3.4
Try HTML scraping with a Python library
I made a Hex map with Python
A typed world that begins with Python
[Automation] Read a Word document with Python
Run a Python web application with Docker
Build a python virtual environment with pyenv
Let's make a web framework with Python! (1)