title: Geodjango: how to load .shp file and convert to geojson with the right CRS?
body: <p>I have multiple shapefiles (.shp) with their auxiliary files that I want to display on a Leaflet map. The shapefiles use different coordinate reference systems (CRS) and I struggle to grasp the most straightforward and reliable way to show things on the map. In the <a href="https://docs.djangoproject.com/en/3.0/ref/contrib/gis/tutorial/" rel="nofollow noreferrer">geodjango tutorial</a>, DataSource is used to load a shapefile and then manipulate it. However, in their examples, they only retrieve the geometry of individual features, not of the entire shapefile. I have used <a href="https://pypi.org/project/pyshp/#reading-shapefiles" rel="nofollow noreferrer">PyShp</a> and I am able to show a map using something like:</p>
  <pre><code>    sf = shapefile.Reader(filename)
      shapes = sf.shapes()
      geojson = shapes.__geo_interface__
      geojson = json.dumps(geojson)
  </code></pre>
  <p>However, this fails when the CRS is not WGS84 things don't work, and I don't see how to convert it.</p>
  <p>Reading a bit more, <a href="http://fromthepantothefire.com/2014/04/07/ma-crs/" rel="nofollow noreferrer">this post</a> complains about CRS support and pyshp, and suggests using ogr2ogr.</p>
  <p>So after trying to understand the options, I see using Datasource, pyshp, and ogr2ogr as possible options, but I don't know which option really makes the most sense.</p>
  <p><strong>All I want is convert a .shp file using Django into a geojson string that uses WGS84 so that I can include it on an HTML page that uses Leaflet.</strong></p>
  <p>Can anyone with more experience suggest a particular route?</p>