Our vision.
See code example in the server folder.
Run ./setup.sh
. This script will install bun and download required files to setup server
cd server
./setup.sh
Start Server
bun app.js
For detailed instructions on installing WSL, refer to the WSL Documentation.
-
Enable WSL:
- Open the Start menu.
- Type "WSL" and select "Windows Subsystem for Linux" from the search results.
- This will open the default Linux distribution installed on your system (typically Ubuntu) in a command line interface.
-
Access Windows Files in WSL:
- Navigate to your Windows files using
/mnt/
. - Example:
cd /mnt/c/Users/YourUsername/geoquery.in/
. - Replace YourUsername with your Windows username
- This command will take you to the
geoquery.in
folder in your Windows file system.
- Navigate to your Windows files using
-
Update Packages:
- Run:
sudo apt update
- Run:
-
Install dos2unix:
- Run:
sudo apt install dos2unix
- Run:
-
Navigate to Project Directory:
- Use
cd server
- Use
-
Convert Line Endings:
- Run:
dos2unix setup.sh
- Run:
- Run Setup Script:
- Execute:
./setup.sh
- Execute:
- Start Server:
- Run:
bun app.js
- Run:
- Open GitHub Codespaces:
- Navigate to geoquery.in GitHub repository.
- Click "Code" and select "Open with Codespaces".
cd server
- Execute:
./setup.sh
- Run:
bun app.js
This guide provides instructions for using the Docker container to deploy and interact with the application. The Docker container contains an application that provides location information based on district centroids.
Before getting started, ensure that you have Docker installed on your system. Refer to the Docker installation documentation for installation instructions based on your operating system.
Once Docker is installed, follow the steps below to set up and run the Docker container:
-
Clone the repository containing the Dockerfile and application files.
git clone https://github.com/ChakshuGautam/geoquery.in
-
Change working dir to
server
cd geoquery.in/server
-
Build the Docker image using the provided Dockerfile with the following command:
docker build . -t geoquery
Note: After adding your user to the Docker group, you can run Docker commands without using
sudo
. If you haven't added your user to the Docker group, remember to usesudo
before Docker commands. -
Run the Docker container using the following command:
docker run -d geoquery
This command will start the Docker container in detached mode, allowing you to interact with the application.
Once the Docker container is running, you can interact with the application using the provided commands.
-
Check Docker Container Status
To check the status of the Docker container, use the following command:
docker ps
This command will display a list of running Docker containers along with their details. Store "Container ID"
-
Retrieve Container IP Address
To retrieve the IP address of the Docker container, use the following command:
docker inspect <container_id> | grep -i "ipaddress" | grep -o '"IPAddress": "[^"]*' | grep -o '[^"]*$' | head -n1
Replace
<container_id>
with the ID of the running Docker container. -
Access Application Endpoint
To access the application endpoint and retrieve location information, use the following command:
curl "http://<container_ip_address>:3000/location/DISTRICT/centroid?query=<location_query>"
Replace
<container_ip_address>
with the IP address of the Docker container obtained in the previous step, and<location_query>
with the desired location query.Example:
curl "http://172.17.0.2:3000/location/DISTRICT/centroid?query=lucknow"
Here we have replaced
<container_ip_address>
with the actual IP address we obtained. This command will retrieve information about the centroid of the district "Lucknow".
Works with both ipv4 and ipv6.
Get geolocation corresponding to given IP
curl https://geoip.samagra.io/city/128.101.101.101
Get geolocation for given lat
& lon
curl https://geoip.samagra.io/georev?lat=28.7041&lon=77.1025
Get polygon centroid for given STATE/DISTRICT/SUBDISTRICT
with some query
curl https://geoip.samagra.io/location/DISTRICT/centroid?query=lucknow
Fuzzy search location by name with STATE/DISTRICT/SUBDISTRICT/VILLAGE
levels with query & location level filters in request body, filter
keys should one of these STATE/DISTRICT/SUBDISTRICT/VILLAGE
.
curl --location 'https://geoip.samagra.io/location/VILLAGE/fuzzysearch' \
--header 'Content-Type: application/json' \
--data '{
"query": "Arong",
"filter": {
"STATE": "Andaman & Nicobar Islands",
"DISTRICT": "Nicobars"
}
}'
# Response
{
"matches": [
{
"state": "Andaman & Nicobar Islands",
"district": "Nicobars",
"subDistrict": "Car Nicobar",
"village": "Arong"
}
]
}
DB will remain updated automatically. Please create a ticket if you see some issues.
- Please consider issues up from grabs.
- It will only be assigned with a PR.