Nearby Record Finder (Based on Custom Atlas APIs)
Introduction
This is an easy to integrate nearby search widget by MapmyIndia.
To search the nearby records as per specified record types from the Nearby Record finder database around the provided reference location.
Getting started
npm install mapmyindia-nearby-record-finder-react-native
- Install peerDependencies
npm i mapmyindia-map-react-native-beta
- If using React-native<0.60
react-native link mapmyindia-nearby-record-finder-react-native
Installation
Android
- Add followling line in
android/build.gradle
file:-
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven { url 'https://maven.mapmyindia.com/repository/mapmyindia/'}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
ios
- run pod install from ios folder
Usage
Step 1: Import
import mapmyIndiaNearbyRecord from'mapmyindia-nearby-record-finder-react-native';
import MapmyIndiaGL from 'mapmyindia-map-react-native-beta'
Step 2: Initialization
MapmyIndiaGL.setMapSDKKey(mapSDKKey);//place your mapsdkKey
MapmyIndiaGL.setRestAPIKey(restAPIKey);//your restApiKey
MapmyIndiaGL.setAtlasClientId(atlasClientId);//your atlasClientId key
MapmyIndiaGL.setAtlasClientSecret(atlasClientSecret); //your atlasClientSecret key
MapmyIndiaGL.setAtlasGrantType(atlasGrantType);
Step 3: Use Nearby Record API call
mapmyIndiaNearbyRecord({ recordType: 'test', location: 'MMI000' })
.then((res) => {
console.log(res);
setResult(res.toString());
})
.catch((e) => console.log(e.message));
Mandatory Parameters
-
recordType (String)
: The category or class of the record, referenced by a defined set of category codes from client. -
location (String)
: Provides the location around which the search will be performed. e.g. location: "28.454,77.435" The refLocation parameter can also accept eLoc as reference location. Example: location: "1T182A"
Optional Parameters
-
radius (number)
: The radius in meters for radial search. Default radius: 10000 meters. -
bounds (String)
: "(x1,y1;x2,y2)" Allows the developer to send in map bounds to provide a nearby search of the geobounds. where x1,y1 are the lat lng of the bound. The bounds are set from topLeft to bottomRight (North-West to South-East). Example :28.639256,77.211133;28.625214,77.237483. -
sortBy (String)
: Provides configured sorting operations for the client on cloud. Below are the available sorts:- dist:asc
- dist:desc
-
filter (String)
: This field accepts eloc and restricts the search to the provided administrative area eloc. Example : filter: "cop:TAVI5S". -
createdTime (number)
: This is an epoch value in seconds. All records whose creation time is 'greater than' the provided input time here are responded back in results. Example: createdTime: 1628855941 -
modifiedTime (number)
: This is an epoch value in seconds.All records whose modified time is 'greater than' the provided input time here are responded back in results. Example: modifiedTime: 1628855941 -
itemCount (number)
: Number of items per page. Minimum is 1; Default is 10.
Response Parameter
-
records
: List of nearby places -
pageInfo
: Details of result pages
Nearby Places Parameters
recordId(String)
recordEloc(String)
recordType(String)
distance(number)
orderIndex(number)
latitude(number)
longitude(number)
customNote(String)
createdOn(number)
modifiedOn(number)
isExpired(Boolean)
extendedInfo(Object)
For any queries and support, please contact:
Email us at apisupport@mapmyindia.com
Stack Overflow Ask a question under the mapmyindia-api
Support Need support? contact us!
Blog Read about the latest updates & customer stories
© Copyright 2021. CE Info Systems Pvt. Ltd. All Rights Reserved. | Terms & Conditions