kartena / Proj4Leaflet

Smooth Proj4js integration with Leaflet.
http://kartena.github.io/Proj4Leaflet/
BSD 2-Clause "Simplified" License
590 stars 173 forks source link

Update proj4 to support custom GeoJSON layers #106

Closed MuellerMatthew closed 7 years ago

MuellerMatthew commented 8 years ago

I created a new function to the L.Proj.GeoJSON prototype called addCRS which contains all of the code to initialize custom CRS in a GeoJSON layer to allow custom GeoJSON layers with custom initializations and custom functions to incorporate the Proj.GeoJSON functionality inside the custom GeoJSON layer without reference the original GeoJSON prototype initialization.

example:

customGeoJSON = L.GeoJSON.extend({
    initialize: function(geojson, options) {
        L.Proj.GeoJSON.prototype.addCRS.call(this, geojson, options);
        //Continue with custom initialization for layer

    }
})
pthorin commented 7 years ago

Not sure if this is still needed in 1.0?

perliedman commented 7 years ago

Closing this as it's just too old to handle now. Also, I had a bit of a hard time understanding the use case for this, but feel free to enlighten me if you think this is an important addition to Proj4Leaflet.

Finally, from the looks of it, this will not handle the case where you do not supply GeoJSON to the constructor, something a lot of people had trouble with before and was fixed in #77.