question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reading/writing foreign members from/to GeoJSON

See original GitHub issue

The GeoJSON format allows to store additional properties in objects (RFC 7946, section 6.1), but OpenLayers does not read and write them.

Expected behavior:

import GeoJSON from 'ol/format/GeoJSON';

const parser = new GeoJSON();

const geometry = parser.readGeometry({
  type: 'Point',
  coordinates: [0, 0],
  kind: 'bakery'
});

console.log(geometry.getProperties()); // currently: {}, expected: {kind: 'bakery'}
console.log(geometry.getKeys()); // currently: [], expected: ['kind']

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
icholycommented, May 20, 2020

Your preferred way of doing it is incorrect.

0reactions
stale[bot]commented, Jul 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Converting between GeoJSON and sf
As per GeoJSON (RFC 7946 specification), foreign members are ignored, and nested objects and arrays inside the properties object are converted ...
Read more >
What does it mean to extend GeoJSON without using a foreign ...
Implementations MUST NOT extend the fixed set of GeoJSON types. They're referring to the type, which is stored in type , for example...
Read more >
geojson - Rust - Docs.rs
This crate helps you read and write GeoJSON — a format for encoding geographic ... if you only need geometry and properties (and...
Read more >
GeoJSON
GeoJSON is a format for encoding a variety of geographic data structures. ... GeoJSON supports the following geometry types: Point , LineString ,...
Read more >
GeoJSON — GDAL documentation
This driver implements read/write support for access to features encoded in GeoJSON format. GeoJSON is a dialect based on the JavaScript Object Notation ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found