Restrict area map with latitude and longitude in React Native - react-native

I have a list page where I have latitude and longitude data of different items. I want to add a filter function to restrict the items to a certain radius. But how can I do that with latitude and longitude data?

Have a look at the ngeohash npm package to store the hash code of the locations that you have and filter the data as in the below example.
https://levelup.gitconnected.com/nearby-location-queries-with-cloud-firestore-e7f4a2f18f9d
The above example using the firestore as a backend store but you also can use your own.
ngeohash npm link: https://www.npmjs.com/package/ngeohash

Related

react native displaying items within 2KM

I have a large database of items and they each have a location field which stores their longitude and latitude . I only want to display the items within 2KM to the users location .
Since my database is huge , creating an array by mapping through each database item and use getDistance from geolib is not very efficient . Is there any other way i can do this effectively .
Thanks any help will be appreciated

Gooddata Report Showing Weather by Store

I do have in my project model 3 datasets showing stores (DS_SITE), cities (Cidades) and weather (DS_DADOS_CLIMA) like in the image below:
datasets
And I want to see the name of the store with it's respectively weather information, but when I try select the store name to the report, it's not permitted:
report
how
There is some way to show the weather with the store name in the same report? I've changed the model and the metric several times trying to do it, but it didn't work.
Here is the metric I used in the example above (DS_DC_TEMP_MAX = weather fact):
metric
The direction of the arrow between City and Weather is what's preventing you from slicing temperature by Store.
Are you're sure about it? (as modeled, each city can have multiple weathers, each weather belongs to at most one city)?
If the direction is correct (you're probably tracking history of weathers), you'll need to lift weather to city, see explicit lifting:
https://help.gooddata.com/display/doc/Explicit+Lifting.
If you don't need to track history, just reverse the direction of the arrow between city & weather and you should be able to slice temperature by store (show them side by side).
Hope that helps.

What is the best way to store a google maps path (array of lattitude and longitudes)

I am making a website where users can create routes on google maps and I have been looking around for the best way to store a path (the coordinates of there root) from google maps. I have found a few different options and I am not sure which is the best.
Should I
Store them in a JSON file then just store the path of the json file in a sql column? The only problem with that is I then cant make querys based off the coordinates in the json file.
or
Store every single latitude and Longitude point in a separate row? The only problem I see with this is one path on google maps could have over 1000 different points which would take up a lot of space in the database.
Any other ideas?
Store the points seperate in a table like this
coordinates table
-----------------
track_id
lng
lat
sequence_number --> you should also store a sequence to know the order in which you want to connect the coordinates
and another table containing the track info
tracks table
------------
id
name
other_stuff
If you then want to get all points of a track called My Bicycle Tour then run
select c.lng, c.lat, c.sequence
from coordinates c
join tracks t on t.id = c.track_id
where t.name = 'My Bicycle Tour'
order by c.sequence
Remember a DB can easily hold millions and even billions of records and with proper indexes this is also very fast to query.

Searching API for a specific Json key, value

I'm using the wunderground api to get weather conditions from a specific city. They have various ways to query the data here ---> http://www.wunderground.com/weather/api/d/docs?d=data/index. The response is in JSON.
Is there a possible way to GET the locations from a specific key, value using the api; like getting all the cities that have a current temperature of 75 degrees, without getting the data for various locations, then checking if the temperature is a certain number?

Get geo-locations from cities

I am trying to display a list of closest restaurants of a given city within a radius. In order to do this, I'll have to convert the city to a longitude/latitude.
When the user fills in his/her restaurant information, he/she will fill in the address. Based on that address i need to get a longitude/latitude and save that to the database.
I don't need to point this on a map. I'll be just displaying a list of all closest restaurants within the given radius to the user.
How can I do this with ASP.NET-MVC4?
Also, this project is based on Code First. And for address I have DbGeography as datatype set.
The project is kind of based on this tutorial
Edit
To avoid anyone else telling me this is not possible with ASP.NET on it's own, I am aware of that. an example with Google maps / .NET wrapper would be great.
This query itself is typically done in the database back-end because the program is the consumer of the data not the keeper of the data. You will have a table of restaurants, possibly for many cities, each restaurant having a latitude and longitude. You create a geospatial index on the table, which performs a tesselation for performance; you configure the tesselation parameters. You must determine the latitude/longitude of your restaurant-seeker's location. Your command object would feed that data to a stored procedure, along with the desired radius. The stored procedure would return an enumerable set of rows to your client program.
I found this .NET wrapper which fulfills my need.