How can I determine if a latitude/longitude fits in a rectangle?
This rectangle is built by two GeoPoints (minLat/minLong, maxLat/maxLong).
We could resolve without Solr or ElasticSearch?
From your description of how the rectangle is built, it sounds as if you just need to check that your latitude and longitude are within the min/max values
Related
I'm using an ArcGIS scene with an AreaMeasurement3D widget to allow users to draw a region to provides some parameters for a db query. I would also like them to be able to type in coordinates and have the widget produce a measurement for them. I see there's a newMeasurement method available but it doesn't seem to support this. Is there some other way to programmatically draw a region with this widget?
It's not clear to me whether you want to reuse the AreaMeasurement3D widget to retrieve the actual measurements or use it to visualize the area. At this point the measurement tools do not support this.
I would suggest to use geometryEngine.geodesicArea() or geometryEngine.planarArea() to calculate a measurement from given coordinates.
Using a GraphicsLayer you could then visualize the area as shown in the Add Graphics sample.
example: Given 3 points (1,1),(2,2),(5,5) and a rectangle (0,0)(3,3), get 2 points (1,1) and (2,2).
It's easy to get points in a circle using georadius, but it seems that there is not a convenient way to get points in a rectangle.
There's no built-in way to do that.
However, you can do a spatial search with a circle that can cover the whole rectangle. For each retrieved point, check if it's inside the rectangle.
I stumbled upon this question while exploring redis geospatial capabilities.
You can use the GEOSEARCH command to search points within a bounding box.
And I also found a well-written article explaining how to load a custom lua script to query points within a polygon.
is there any kind of way to input the coordinates for two locations, a startpoint and a destination, and get an image result (jpeg) of a map, say google map, showing the two locations on that same image?
I need this for a vb application
thanks!
Update:
I've successfully added the image with the two locations, but there's a tiny issue,
what if the two places are too close or too far from each other, the zooming should differ, and maybe the size too, what is the best way to manipulate these, according to the coordinates given?
Yes, you can use the Static Maps API to get the map image:
https://developers.google.com/maps/documentation/imageapis/
I am trying to create a custom map for iOS. For the time being I am using Openstreetmap images for the custom map app.
Now what I want is to convert the pixel point to Latitude and Longitude value at a particular zoom level. I am finding out the tile(pixel point) in which I clicked. I need to find out the Lat and Long of that particular point. How this can be calculated? Is there any general formula to find the Lat & Long from pixel point.
Thanks in advance
Do you know about route-me (https://github.com/route-me/route-me)? It is an open source iOS map library. I use a fork of this library found at https://github.com/Alpstein/route-me. These libraries provide the projections you are looking for and might even provide other functionalities you would have to implement yourself otherwise.
I have compiled a list of locations with latitude and longitude information. Can I check what is the best approach to filter and populate the list of "nearest" geolocations in a table and mapview based on my current location? (or a destination entered by a user). Also is it also possible to indicate what is the radius I am interested in? e.g. only select all the nearest bookstores within 5km from my location etc
Appreciate your advice on this
Zhen Hoe
Maybe I'm missing something, but why don't you just add your locations to a mapView, and center the map on the user's current location or whereever they want? MapKit will do all the calculations for you, and only show the ones near the center. The user can set their own radius by zooming in and out. MapKit is highly optimized for exactly this purpose, that's how you can see the "rain of pins" in real time.
Update:
You can also go the other way: once you have the annotations on the map, you can query the map for those annotations that are in the visible region with:
- (NSSet *)annotationsInMapRect:(MKMapRect)mapRect
From the docs:
This method offers a fast way to retrieve the annotation objects in a particular portion of the map. This method is much faster than doing a linear search of the objects in the annotations property yourself.
You may find - (CLLocationDistance)distanceFromLocation:(const CLLocation *)location to be very useful
http://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html#//apple_ref/occ/instm/CLLocation/distanceFromLocation:
The haversine formula is frequently used to in navigation for calculating distances between coordinates. This is a pretty decent resource for distance calculations, and even has a code sample for haversine (though it is in Javascript).
If your list of locations is relative small (hundreds, even), you can probably just iterate through the whole list and calculate the distance between each place against current location.