Skip to main content
Tweeted twitter.com/StackDBAs/status/1499942819594711043
edited tags
Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

ERROR: invalid GeoJson representation

the GeoJSON Spec show,

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    "name": "Dinagat Islands"
  }
}

But when I wrap that in a call to ST_GeomFromGeoJSON, like this,

SELECT ST_GeomFromGeoJSON($${                                                                                                                          
  "type": "Feature",                                                                                                                                   
  "geometry": {                                                                                                                                        
    "type": "Point",                                                                                                                                   
    "coordinates": [125.6, 10.1]                                                                                                                       
  },                                                                                                                                                   
  "properties": {                                                                                                                                      
    "name": "Dinagat Islands"                                                                                                                          
  }                                                                                                                                                    
}$$);

I get the error,

ERROR: invalid GeoJson representation