Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve the invalid projection error in CRS?

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 ?

like image 825
ponmani Avatar asked Sep 02 '25 06:09

ponmani


1 Answers

  • assuming that your data set is this: https://data.gov.au/dataset/ds-vic-d328facd-7545-4d30-aa4e-a5c617b748c0/details?q=
  • it is in EPSG:4326 so does not need to be projected. Both plotly express and geopandas plotting works without projections
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")
like image 160
Rob Raymond Avatar answered Sep 05 '25 00:09

Rob Raymond