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.

Support number type for "Feature.Id" property

See original GitHub issue

As per the RFC:

3.2.  Feature Object
   o  If a Feature has a commonly used identifier, that identifier
      SHOULD be included as a member of the Feature object with the name
      "id", and the value of this member is either a JSON string or
      number.

Would it possible for GeoJSON.Net to support a number value for Feature.Id, in addition to a string value?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
xfischercommented, Feb 15, 2018

Hi @dalbani and @matt-lethargic !

Could it be possible to say that

  • Id is an object property or whatever IEquatable thing
  • The writeJson could handle if it is convertible to a numeric type and then serialize it as a numeric type ?

The problem here is that now Id MUST be a string, even if it represents a number. It could be changed to object, and we tell NewtonSoft.Json to serialize it the way it should.

0reactions
xfischercommented, Feb 19, 2018

@matt-lethargic’s PR is neat and works. OK with @dalbani for the downside of getting back a string.

I wish I had more time to test the Issue100 branch, but I don’t ! I don’t know enough pure GeoJSON.Net lib (I’m more in the spatial contribs) but for sure it’s a breaking change. (Imagine someone uses string manipulation on the Id property in its code (like Id.Length), changing Id to object would surely destroy (at least) the planet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[2.1] Feature ID datatype · Issue #94 · mapbox/vector-tile- ...
We recently received a request to Support text ids for Feature IDs on our MVT server. Looking at the spec, it appears there...
Read more >
Using UUID as feature ID for MVT tiles (PostGIS)
The first column matching name and valid type (smallint, integer, bigint) will be used as Feature ID, and any subsequent column will be...
Read more >
TypeScript + OpenLayers 7: Set and get feature id fails
I assign the id in the Polygon class; I read the id in the RemovePolygonButton class. import Map from 'ol/Map' import OSM from...
Read more >
Sources | Style Specification | Mapbox GL JS
A map or layer source states which data the map should display. Specify the type of source with the "type" property, which must...
Read more >
Replace auto-generated OBJECTID with my own ID fie...
ArcGIS auto-generates a `OBJECTID` attribute, and I'm hoping I can replace this value with an `id` feature property in my payload.
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