Comments (6)
I have PR to add support for BSON. Please have a look #123
from orb.
Weird that it works for insert but not find.
I would guess the FeatureCollection type needs to implement MarshalBSON and UnmarshalBSON. I'm surprised the driver doesn't fallback to MarshalJSON is those aren't available.
from orb.
Yeah it's really weird... It does fallback to MarshalJSON
. But if I wrap MarshalJSON
in a function like follows
func (fc FeatureCollection) MarshalBSON() ([]byte, error) {
return fc.MarshalJSON()
}
I get runtime error: invalid memory address or nil pointer dereference
And if I implement UnmarshalBSON
like follows:
func (fc FeatureCollection) UnmarshalBSON(data []byte) error {
return fc.UnmarshalJSON(data)
}
I get error decoding key routes.0.legs: invalid character 'î' looking for beginning of value
This is my first bigger project in Go, so I'm not entirely sure how I should go about this, but I can't imagine I'm the first who tries to insert a geoJSON in a mongoDB using Go?
from orb.
Weird that it works for insert but not find.
Find decodes the data to Go values. Decode fails because the codec does not know the type to create for an orb.Geometry.
I would guess the FeatureCollection type needs to implement MarshalBSON and UnmarshalBSON.
Yes.
I'm surprised the driver doesn't fallback to MarshalJSON is those aren't available.
BSON and JSON are different data encodings. MarshalJSON returns JSON, not BSON.
from orb.
Thanks @paulmach, I'll check it on friday!
from orb.
merged #123 and published https://github.com/paulmach/orb/releases/tag/v0.9.0 with the change
from orb.
Related Issues (20)
- Copy/pasted Deprecated comment in LengthHaversine HOT 1
- Check of overlapping geometries HOT 2
- copy the original mvt.Layers for reuse HOT 3
- The resulting MVT is too big (27MB) HOT 2
- Can we use wkb.Scanner with orb.Geometry type ? HOT 2
- Units of orb.Bound.Pad() HOT 2
- Reverse Geocoding HOT 2
- panic in wkt.Unmarshal
- Polygon and line intersection coordinates
- quadtree KNearest search is fickle
- Subdivide polygon HOT 1
- How to process the result of encoding/mvt HOT 3
- How to update DefaultRoundingFactor for Lat/Lon? HOT 6
- get geometry center HOT 1
- Failed to parse wkt MultiPolygon HOT 2
- Invalid MULTIPOLYGON no longer gives an error HOT 2
- Degraded performance wkt.Unmarshal since v.0.9.1 HOT 2
- Check function spelling (Haversine) HOT 1
- I got some error when i zoom the LineString map to high level on mapbox-gl.js HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orb.