Answers for "plot coordinates on map python"

1

python create map with coordinates

import pandas as pd
import plotly.express as px

fig = px.scatter_mapbox(
    df,  # Our DataFrame
    lat = "latitude_col_name",
    lon = "longitude_col_name",
    center = {"lat": 19.43, "lon": -99.13},  # where map will be centered
    width = 600,  # Width of map
    height = 600,  # Height of map
    hover_data = ["customer_name"],  # what to display when hovering mouse over coordinate
)

fig.update_layout(mapbox_style="open-street-map") # adding beautiful street layout to map

fig.show()
Posted by: Guest on February-15-2022
0

how to map longitude and latitude in python

from shapely.geometry import Point
import geopandas as gpd
from geopandas import GeoDataFrame

df = pd.read_csv("Long_Lats.csv", delimiter=',', skiprows=0, low_memory=False)

geometry = [Point(xy) for xy in zip(df['Longitude'], df['Latitude'])]
gdf = GeoDataFrame(df, geometry=geometry)   

#this is a simple map that goes with geopandas
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
gdf.plot(ax=world.plot(figsize=(10, 6)), marker='o', color='red', markersize=15);
Posted by: Guest on August-31-2020
0

how to map longitude and latitude in python

import matplotlib.pyplot as plt
plt.scatter(x=df['Longitude'], y=df['Latitude'])
plt.show()
Posted by: Guest on August-31-2020

Python Answers by Framework

Browse Popular Code Answers by Language