cridenour / go-postgis

PostGIS support for Go. Works with any Postgres driver.
MIT License
108 stars 26 forks source link

json: unsupported value: NaN #5

Closed selam closed 7 years ago

selam commented 7 years ago

I need to convert as json of Point but json.Marshall returns error with "json: unsupported value: NaN"

How can i solve this?

selam commented 7 years ago

type H struct { Id int json:"id" Point postgis.Point json:"point" }

... h := H{} rows.Scan(&h.Id, &h.Point) ; json.Marshall(h) .... If I remove Point from select cause and Scan interface everything works fine

cridenour commented 7 years ago

Hi @selam - that's bizarre! The point struct is just a couple of float64.

Can you print out your result while it's still in Go to ensure it's being read correctly?

selam commented 7 years ago

Sorry for bad bug report, I just use "select point from gis_table" as select statement and i get this error after scan, after looking your test files i realize i was just mis use your library.

cridenour commented 7 years ago

Ah no worries. Glad it's working now!