Ticket #1145 (closed bug: fixed)
Format/GeoJSON does not parse features with null geometries
| Reported by: | bartvde | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 2.7 Release |
| Component: | Format.GeoJSON | Version: | 2.5 |
| Keywords: | Cc: | ||
| State: | Complete |
Description (last modified by euzuro) (diff)
When there is no geometry, Geoserver outputs "geometry": null in the GeoJSON output. However OpenLayers cannot parse this and will end up with 0 features.
An easy way to fix this is to add a null check for obj.geometry in parseFeature:
if (obj.geometry) {
try {
geometry = this.parseGeometry(obj.geometry);
} catch(err) {
// deal with bad geometries
throw err;
}
}
But there can be more code which assumes that a geometry object exists (like the bounds code probably), so this needs to be discussed more.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

