Comments (5)
Honestly, the Contains
functionality is outside the bounds of what this library is attempting to do, which is be an API client library.
I'd suggest looking http://tile38.com/ for a MIT licensed in-memory geolocation data store, spatial index, and realtime geofence service written in Go. =)
from google-maps-services-go.
We accept pull requests =)
from google-maps-services-go.
Sure! I'll try.
Do you have any reference implementation or mathematical theory to afford this problem?
Regards,
Matías.
from google-maps-services-go.
I think the answer over here: https://s2geometry.io/about/overview and https://godoc.org/github.com/golang/geo/s2
Continue researching...
Regards,
Matías.
from google-maps-services-go.
Just for contributing with someone else, this is how I resolved this:
func extendBounds(bounds1, bounds2 maps.LatLngBounds) maps.LatLngBounds {
boundsPoints := []s2.Point{}
point1 := s2.PointFromLatLng(s2.LatLngFromDegrees(bounds1.NorthEast.Lng, bounds1.NorthEast.Lat).Normalized())
point2 := s2.PointFromLatLng(s2.LatLngFromDegrees(bounds1.SouthWest.Lng, bounds1.NorthEast.Lat).Normalized())
point3 := s2.PointFromLatLng(s2.LatLngFromDegrees(bounds1.SouthWest.Lng, bounds1.SouthWest.Lat).Normalized())
point4 := s2.PointFromLatLng(s2.LatLngFromDegrees(bounds1.NorthEast.Lng, bounds1.SouthWest.Lat).Normalized())
boundsPoints = append(boundsPoints, point1, point2, point3, point4)
point1 = s2.PointFromLatLng(s2.LatLngFromDegrees(bounds2.NorthEast.Lng, bounds2.NorthEast.Lat).Normalized())
point2 = s2.PointFromLatLng(s2.LatLngFromDegrees(bounds2.SouthWest.Lng, bounds2.NorthEast.Lat).Normalized())
point3 = s2.PointFromLatLng(s2.LatLngFromDegrees(bounds2.SouthWest.Lng, bounds2.SouthWest.Lat).Normalized())
point4 = s2.PointFromLatLng(s2.LatLngFromDegrees(bounds2.NorthEast.Lng, bounds2.SouthWest.Lat).Normalized())
boundsPoints = append(boundsPoints, point1, point2, point3, point4)
loop := s2.LoopFromPoints(boundsPoints)
loop.Normalize()
rect := loop.RectBound()
hi := rect.Hi()
lo := rect.Lo()
return maps.LatLngBounds{NorthEast: maps.LatLng{Lat: hi.Lat.Degrees(), Lng: hi.Lng.Degrees()}, SouthWest: maps.LatLng{Lat: lo.Lat.Degrees(), Lng: lo.Lng.Degrees()}}
}
from google-maps-services-go.
Related Issues (20)
- Remove metro_area metrics HOT 1
- Roads: Nearby Roads does not give error when trying to issue request without billing setup HOT 2
- Places: nearby search results do not contain opening hours info HOT 6
- nil pointer dereference on failed binary request HOT 1
- Improve HTML Instructions field in Step type HOT 1
- Directions: Support `maneuver` field in `Step` HOT 2
- Directions API: Unmarshal error in detecting Route.Legs as type string HOT 1
- Go Version typo in readme HOT 1
- metrics.Request receives an already drained *http.Response HOT 2
- Is there a way to set range for radius parameters? HOT 2
- googleMap Error: connect ECONNREFUSED 0.0.0.0:443 HOT 1
- maps.Client Automatic Retry? Exponential Backoff? HOT 1
- Static maps map_id parameter support HOT 2
- feat: add relative_time_description property to PlaceReview HOT 2
- Places Search has no json tag HOT 1
- ReverseGeocode: invalid character 'U' looking for beginning of value HOT 2
- Empty spaces in the README for the go get command HOT 2
- Client.PlaceDetails fails for ID ChIJUXcBoFD-nkcR3s74TnqlDHM HOT 5
- ParsePlaceSearchFieldMask missing case for 'business_status' HOT 2
- Address Validation API missing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-maps-services-go.