Create a 2D point
Select the correct way to create a 2D point representing San Francisco’s coordinates.
go
point := neo4j./*select:Point2D*/{
X: -122.4194, // longitude
Y: 37.7749, // latitude
SpatialRefId: 4326,
}
-
❏ Point3D
-
✓ Point2D
-
❏ Point
-
❏ Location
Hint
For 2D coordinates (latitude and longitude), use the 2D point type.
Solution
The correct answer is Point2D
.
go
point := neo4j.Point2D{
X: -122.4194, // longitude
Y: 37.7749, // latitude
SpatialRefId: 4326,
}
Point2D
is used for 2D spatial coordinates, while Point3D
would be used for 3D coordinates that include altitude.
Lesson Summary
In this lesson, you learned how to work with spatial types in Neo4j using the Go driver.
You have now completed the module on handling results. In the next module, you will learn about best practices for production applications.