Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geojson Decode() #100

Closed
lc-dmx opened this issue Sep 19, 2023 · 1 comment · Fixed by #101
Closed

geojson Decode() #100

lc-dmx opened this issue Sep 19, 2023 · 1 comment · Fixed by #101

Comments

@lc-dmx
Copy link

lc-dmx commented Sep 19, 2023

fc := `{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[122.993197,41.117725],[122.999399,41.115696],[122.99573,41.109516],[122.987146,41.106994],[122.984775,41.107699],[122.990687,41.117878],[122.993197,41.117725]]]},"properties":{}}]}`
_, err := geoencoding.Decode([]byte(fc), geoencoding.GeoJSON)
fmt.Println(err)

report error: geojson: not a feature: type=FeatureCollection

I thought the correct should be
if strings.Contains(string(s[9:26]), "FeatureCollection") {
rather than
if strings.Contains(string(s[9:20]), "FeatureCollection") {

@lc-dmx
Copy link
Author

lc-dmx commented Sep 19, 2023

Can someone fix it quickly? thanks a lot

@coolwxb coolwxb linked a pull request Sep 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant