3
from pyproj import CRS
import geopandas as gpd
import matplotlib.pyplot as plt
import matplotlib

import json
import pandas as pd

gdf = geopandas.read_file("Frog_Census_Records.geojson")

The error displayed is :

CRSError: Invalid projection: epsg:4326: (Internal Proj Error: proj_create: no database context specified)

Could someone kindly help me ?

ponmani
  • 67
  • 6
  • How did you install pyproj? What is the output of `python -m pyproj -v`? – snowman2 Dec 05 '21 at 19:00
  • Welcome to stack overflow! When displaying errors, please always include the [full traceback](//realpython.com/python-traceback) - they're critical to understanding the full source of the error. Thanks! And yes, this is likely an installation/environment setup issue, so more info about how you set up your python environment and how you installed geopandas, proj, and fiona would be helpful. – Michael Delgado Dec 05 '21 at 20:29

2 Answers2

0
import geopandas as gpd
import requests
import plotly.express as px

# gdf = gpd.read_file("Frog_Census_Records.geojson")
gdf = gpd.GeoDataFrame.from_features(requests.get("https://data-melbournewater.opendata.arcgis.com/datasets/07e011c3e36f4b0aa8023d096d5a50a8_0.geojson?outSR=%7B%22latestWkid%22%3A28355%2C%22wkid%22%3A28355%7D").json())

# px.scatter_mapbox(gdf, lat="Latitude", lon="Longitude", color="Common_name").update_layout(mapbox={"style":"carto-positron"})
gdf.plot(column="Common_name")
Rob Raymond
  • 29,118
  • 3
  • 14
  • 30
0

In my case the error was because geopandas was installed by conda but other packages like pyproj was installed by pip.

I installed everything with pip and it solved the problem.

pip install geopandas

Reference: https://github.com/geopandas/geopandas/issues/1887