I believe there are a few Leaflet JS API changes that affect the GeoJSON functionality.

  1. The GeoJSON object does not have an addGeoJSON() method. It appears this is the addData() method now. I have attached a patch for this below.
  2. I'm not sure the "featureparse" event is triggered anymore. I would recommend looking into the onEachFeature option. I have added a separate patch below that may work for that. The second patch also fixes the first issue by passing it in the object constructor.

Comments

dasjo’s picture

the first patch (replacing addGeoJSON with addData) worked for me, thanks!

rballou’s picture

Status: Active » Needs review

Going to go ahead and change this to needs review.

dasjo’s picture

Status: Needs review » Reviewed & tested by the community

for the at least the first patch is rbtc

7wonders’s picture

I am finding that anything and everything in geojson except for a single point, results in a grey screen. Related?

dasjo’s picture

7wonders, yes - this should be fixed by the above patch. if not, open a separate issue and include the error log messages within your browser

7wonders’s picture

My bad, linestrings do work but not with my admin acct for some reason (admin menu clash or something else I suspect). Will check out all the others and report back.

7wonders’s picture

The point, linestring and polygon from the geojson-sample.js file all worked but the multipoly didnt. However, this one did.

{
        "type": "MultiPolygon",
        "coordinates": [
            [
                [
                    [-105.00432014465332, 39.74732195489861],
                    [-105.00715255737305, 39.74620006835170],
                    [-105.00921249389647, 39.74468219277038],
                    [-105.01067161560059, 39.74362625960105],
                    [-105.01195907592773, 39.74290029616054],
                    [-105.00989913940431, 39.74078835902781],
                    [-105.00758171081543, 39.74059036160317],
                    [-105.00346183776855, 39.74059036160317],
                    [-105.00097274780272, 39.74059036160317],
                    [-105.00062942504881, 39.74072235994946],
                    [-105.00020027160645, 39.74191033368865],
                    [-105.00071525573731, 39.74276830198601],
                    [-105.00097274780272, 39.74369225589818],
                    [-105.00097274780272, 39.74461619742136],
                    [-105.00123023986816, 39.74534214278395],
                    [-105.00183105468751, 39.74613407445653],
                    [-105.00432014465332, 39.74732195489861]
                ],[
                    [-105.00361204147337, 39.74354376414072],
                    [-105.00301122665405, 39.74278480127163],
                    [-105.00221729278564, 39.74316428375108],
                    [-105.00283956527711, 39.74390674342741],
                    [-105.00361204147337, 39.74354376414072]
                ]
            ],[
                [
                    [-105.00942707061768, 39.73989736613708],
                    [-105.00942707061768, 39.73910536278566],
                    [-105.00685214996338, 39.73923736397631],
                    [-105.00384807586671, 39.73910536278566],
                    [-105.00174522399902, 39.73903936209552],
                    [-105.00041484832764, 39.73910536278566],
                    [-105.00041484832764, 39.73979836621592],
                    [-105.00535011291504, 39.73986436617916],
                    [-105.00942707061768, 39.73989736613708]
                ]
            ]
        ]
    }
levelos’s picture

Priority: Normal » Major
pvhee’s picture

As a temporary fix, I've commited the first patch in #0.

However, as rballou correctly states, we need to pass in an onEachFeature function (from the docs: http://leafletjs.com/examples/geojson.html).

So, setting this issue back to "needs review" as in #2.

pvhee’s picture

Status: Reviewed & tested by the community » Needs review
7wonders’s picture

So is it the onEachFeature function that would allow for something such as displaying a linestring and a bunch of separate points with different markers along the linestring or is that already possible and im just missing something??

rballou’s picture

As far as I remember, the features are collections of other geometries. The files I was working with bundled their information as features with various geometries. So if you GeoJSON uses features, you may not be able to get that to work with the Leaflet module without the second patch. That said I haven't done much with this in the last few months so I'm not sure if we need to re-roll or anything else to make this to work.

7wonders’s picture

StatusFileSize
new1.86 KB

Here is rballou's oneachfeaturechange patch for latest dev.

rballou’s picture

Component: Documentation » Code
StatusFileSize
new1.86 KB

I just noticed there's a typo in this patch (the original patch), so I'm fixing that based on 7wonders patch in #13.

As a quick reminder, GeoJSON features do not work without this patch as the "featureparse" event does not exist anymore.

gcb’s picture

Issue summary: View changes
Status: Needs review » Fixed

Thanks for this work! Rolled into dev and will be in a point release very soon.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.