Giter Site home page Giter Site logo

Comments (1)

torfsen avatar torfsen commented on July 29, 2024

OK, so I think I have figured this out. It's complicated, so for future reference I'll document what I have found.

OGC:CRS84 (or, more precisely, urn:ogc:def:crs:OGC:1.3:CRS84) is the identifier of a coordinate reference system (CRS). According to the current GeoJSON standard (RFC 7946), OGC:CRS84 is the CRS used by GeoJSON. However, earlier versions of the GeoJSON standard (in particular the widely used 2008 standard) allow GeoJSON files to specify a custom CRS. That's what my GeoJSON file which caused the problem does:

 "crs": {
        "properties": {
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
        },
        "type": "name"
},

So basically, my GeoJSON file simply explicitly states "Just use the default CRS". However, proj4leaflet sees the custom CRS declaration and passes it own to proj4js which doesn't have that CRS built-in. That's where the exception happens.

Fortunately, the solution is rather easy: proj4js does come with the EPSG:4326 CRS built-in, which differs from OGC:CRS84 only in the order of the coordinates (lon, lat vs. lat, lon). Since proj4js assumes lon, lat order anyways, we can just add OGC:CRS84 as an alias for EPSG:4326:

proj4.defs['OGC:CRS84'] = proj4.defs['EPSG:4326'];

This fixes the problem for me. Since the proj4leaflet team doesn't want to include that alias in proj4leaflet I think it would be nice to include in ckanext-geoview instead. I'll prepare a PR for that.

from ckanext-geoview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.