Test GeoJSON() function with Z values.
(self)
| 276 | self.assertTrue(ref_kml_regex.match(h.kml)) |
| 277 | |
| 278 | def test_geojson(self): |
| 279 | """ |
| 280 | Test GeoJSON() function with Z values. |
| 281 | """ |
| 282 | self._load_city_data() |
| 283 | h = City3D.objects.annotate(geojson=AsGeoJSON("point", precision=6)).get( |
| 284 | name="Houston" |
| 285 | ) |
| 286 | # GeoJSON should be 3D |
| 287 | # `SELECT ST_AsGeoJSON(point, 6) FROM geo3d_city3d |
| 288 | # WHERE name='Houston';` |
| 289 | ref_json_regex = re.compile( |
| 290 | r'^{"type":"Point","coordinates":\[-95.363151,29.763374,18(\.0+)?\]}$' |
| 291 | ) |
| 292 | self.assertTrue(ref_json_regex.match(h.geojson)) |
| 293 | |
| 294 | def test_perimeter(self): |
| 295 | """ |