// Places API Example
$wemap = new WeMap\PlacesService([
'apiKey' => 'YOUR_API_KEY'
]);
// Search for nearby places
$places = $wemap->search([
'query' => 'restaurants',
'location' => [
'lat' => 41.0370, // Taksim Square
'lng' => 28.9850
],
'radius' => 1000
]);
// Geocoding Example
$geocoder = new WeMap\GeocodingService([
'apiKey' => 'YOUR_API_KEY'
]);
$location = $geocoder->geocode([
'address' => 'Taksim Square, Istanbul, Turkey'
]);
// Directions Example
$directions = new WeMap\DirectionsService([
'apiKey' => 'YOUR_API_KEY'
]);
$route = $directions->getRoute([
'origin' => 'Taksim Square, Istanbul',
'destination' => [
'lat' => 41.0087, // Sultanahmet Square
'lng' => 28.9801
],
'mode' => 'driving'
]);
// Places API Example
var wemap = new WeMap.PlacesService(
apiKey: "YOUR_API_KEY"
);
// Search for nearby places
var places = await wemap.SearchAsync(new SearchRequest {
Query = "restaurants",
Location = new LatLng {
Lat = 41.0370, // Taksim Square
Lng = 28.9850
},
Radius = 1000
});
// Geocoding Example
var geocoder = new WeMap.GeocodingService(
apiKey: "YOUR_API_KEY"
);
var location = await geocoder.GeocodeAsync(
address: "Taksim Square, Istanbul, Turkey"
);
// Directions Example
var directions = new WeMap.DirectionsService(
apiKey: "YOUR_API_KEY"
);
var route = await directions.GetRouteAsync(new RouteRequest {
Origin = "Taksim Square, Istanbul",
Destination = new LatLng {
Lat = 41.0087, // Sultanahmet Square
Lng = 28.9801
},
Mode = TravelMode.Driving
});
// Places API Example
#include <wemap/places.h>
#include <wemap/geocoding.h>
#include <wemap/directions.h>
class WeMapExample {
private:
WeMap::PlacesService wemap{"YOUR_API_KEY"};
WeMap::GeocodingService geocoder{"YOUR_API_KEY"};
WeMap::DirectionsService directions{"YOUR_API_KEY"};
public:
// Search for nearby places
void searchPlaces() {
WeMap::SearchRequest request;
request.query = "restaurants";
request.location = WeMap::LatLng{41.0370, 28.9850}; // Taksim Square
request.radius = 1000;
try {
auto places = wemap.search(request);
// Handle results
} catch (const WeMap::Error& e) {
std::cerr << e.what() << std::endl;
}
}
// Geocoding Example
void getLocation() {
try {
auto location = geocoder.geocode(
"Taksim Square, Istanbul, Turkey"
);
// Handle location
} catch (const WeMap::Error& e) {
std::cerr << e.what() << std::endl;
}
}
// Directions Example
void getRoute() {
WeMap::RouteRequest request;
request.origin = "Taksim Square, Istanbul";
request.destination = WeMap::LatLng{41.0087, 28.9801}; // Sultanahmet Square
request.mode = WeMap::TravelMode::DRIVING;
try {
auto route = directions.getRoute(request);
// Handle route
} catch (const WeMap::Error& e) {
std::cerr << e.what() << std::endl;
}
}
};
// Places API Example
import { WeMapService } from '@wemap/react';
const WeMapExample = () => {
const wemap = new WeMapService({
apiKey: 'YOUR_API_KEY'
});
// Search for nearby places
const searchPlaces = async () => {
try {
const places = await wemap.searchNearby({
query: 'restaurants',
location: {
lat: 41.0370, // Taksim Square
lng: 28.9850
},
radius: 1000
});
console.log(places);
} catch (error) {
console.error(error);
}
};
// Geocoding Example
const geocodeAddress = async () => {
try {
const location = await wemap.geocode({
address: 'Taksim Square, Istanbul, Turkey'
});
console.log(location);
} catch (error) {
console.error(error);
}
};
// Directions Example
const getDirections = async () => {
try {
const route = await wemap.getDirections({
origin: 'Taksim Square, Istanbul',
destination: {
lat: 41.0087, // Sultanahmet Square
lng: 28.9801
},
mode: 'driving'
});
console.log(route);
} catch (error) {
console.error(error);
}
};
return (
);
};
// Places API Example
import { WeMapService, WeMapView } from '@wemap/react-native';
const WeMapExample = () => {
const wemap = new WeMapService({
apiKey: 'YOUR_API_KEY'
});
// Search for nearby places
const searchPlaces = async () => {
try {
const places = await wemap.searchNearby({
query: 'restaurants',
location: {
lat: 41.0370, // Taksim Square
lng: 28.9850
},
radius: 1000
});
console.log(places);
} catch (error) {
console.error(error);
}
};
// Geocoding Example
const geocodeAddress = async () => {
try {
const location = await wemap.geocode({
address: 'Taksim Square, Istanbul, Turkey'
});
console.log(location);
} catch (error) {
console.error(error);
}
};
// Directions Example
const getDirections = async () => {
try {
const route = await wemap.getDirections({
origin: 'Taksim Square, Istanbul',
destination: {
lat: 41.0087, // Sultanahmet Square
lng: 28.9801
},
mode: 'driving'
});
console.log(route);
} catch (error) {
console.error(error);
}
};
// Places API Example
public class WeMapExample {
private WeMap wemap = new WeMap.PlacesService(
"YOUR_API_KEY"
);
// Search for nearby places
public void searchPlaces() {
Places places = wemap.search(new SearchRequest()
.setQuery("restaurants")
.setLocation(new LatLng(41.0370, 28.9850)) // Taksim Square
.setRadius(1000)
);
}
// Geocoding Example
private GeocodingService geocoder = new GeocodingService(
"YOUR_API_KEY"
);
public void getLocation() {
Location location = geocoder.geocode(
"Taksim Square, Istanbul, Turkey"
);
}
// Directions Example
private DirectionsService directions = new DirectionsService(
"YOUR_API_KEY"
);
public void getRoute() {
Route route = directions.getRoute(new RouteRequest()
.setOrigin("Taksim Square, Istanbul")
.setDestination(new LatLng(41.0087, 28.9801)) // Sultanahmet Square
.setMode(TravelMode.DRIVING)
);
}
}
// Places API Example
class WeMapExample {
private val wemap = WeMap.PlacesService(
apiKey = "YOUR_API_KEY"
)
// Search for nearby places
suspend fun searchPlaces() {
val places = wemap.search(
SearchRequest(
query = "restaurants",
location = LatLng(
lat = 41.0370, // Taksim Square
lng = 28.9850
),
radius = 1000
)
)
}
// Geocoding Example
private val geocoder = WeMap.GeocodingService(
apiKey = "YOUR_API_KEY"
)
suspend fun getLocation() {
val location = geocoder.geocode(
address = "Taksim Square, Istanbul, Turkey"
)
}
// Directions Example
private val directions = WeMap.DirectionsService(
apiKey = "YOUR_API_KEY"
)
suspend fun getRoute() {
val route = directions.getRoute(
RouteRequest(
origin = "Taksim Square, Istanbul",
destination = LatLng(
lat = 41.0087, // Sultanahmet Square
lng = 28.9801
),
mode = TravelMode.DRIVING
)
)
}
}
// Places API Example
class WeMapExample {
let wemap = WeMap.PlacesService(
apiKey: "YOUR_API_KEY"
)
// Search for nearby places
func searchPlaces() {
let request = SearchRequest(
query: "restaurants",
location: LatLng(
lat: 41.0370, // Taksim Square
lng: 28.9850
),
radius: 1000
)
wemap.search(request) { result in
switch result {
case .success(let places):
print(places)
case .failure(let error):
print(error)
}
}
}
// Geocoding Example
let geocoder = WeMap.GeocodingService(
apiKey: "YOUR_API_KEY"
)
func getLocation() {
geocoder.geocode("Taksim Square, Istanbul, Turkey") { result in
switch result {
case .success(let location):
print(location)
case .failure(let error):
print(error)
}
}
}
// Directions Example
let directions = WeMap.DirectionsService(
apiKey: "YOUR_API_KEY"
)
func getRoute() {
let request = RouteRequest(
origin: "Taksim Square, Istanbul",
destination: LatLng(
lat: 41.0087, // Sultanahmet Square
lng: 28.9801
),
mode: .driving
)
directions.getRoute(request) { result in
switch result {
case .success(let route):
print(route)
case .failure(let error):
print(error)
}
}
}
}