Project Group 15 - 122125
Project Group 15 - 122125
TECHNICAL REPORT
ON
FCI 300
USING
SUPERVISED BY:
PROF ADEOSUN
SUBMITTED TO
NOVEMBER 19 ,2024
INTRODUCTION
PROJECT GIVEN/DEFINITON
SOURCE CODE INPUT
CODE EXPLANATION
SOURCE CODE OUTPUT
INTRODUCTION
JavaScript is a high-level, versatile programming language primarily used for creating interactive and
dynamic content on websites. Javascript involves developing both front-end and back-end system that
provides features to help tourists explore destinations. Tools and Technologies involve making front-end
and back-end system in javascript is Java Script React, Node.js. JavaScript react is a JavaScript library
used for building user interface, particularly for single page application.
PROJECT GIVEN
A Tourist Guide Application System is a software application designed to provide information and
assistance to tourist, travelers and Visitors exploring a particular destination or region. The System
typically offers various features to enhance the user’s experience with their Destination Information and
Maps Navigation
SOURCE CODE INPUT
import "leaflet/dist/leaflet.css";
import "leaflet-routing-machine";
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconUrl: "https://unpkg.com/[email protected]/dist/images/marker-icon.png",
shadowUrl: "https://unpkg.com/[email protected]/dist/images/marker-shadow.png",
});
useEffect(() => {
if (!routingControlRef.current) {
routingControlRef.current = L.Routing.control({
waypoints: [
L.latLng(startCoords[0], startCoords[1]),
L.latLng(endCoords[0], endCoords[1]),
],
routeWhileDragging: true,
}).addTo(map);
return () => {
map.removeControl(routingControlRef.current);
routingControlRef.current = null;
};
};
useEffect(() => {
}, [map, coords]);
return null;
};
useEffect(() => {
navigator.geolocation.getCurrentPosition(
(position) => {
setUserCoords([position.coords.latitude, position.coords.longitude]);
setSelectedCoords([
position.coords.latitude,
position.coords.longitude,
]);
},
{ enableHighAccuracy: true }
);
}, []);
e.preventDefault();
setIsLoading(true);
try {
"https://nominatim.openstreetmap.org/search",
params: {
q: searchInput,
format: "json",
addressdetails: 1,
limit: 5,
},
);
setSearchResults(response.data);
} catch (error) {
setIsLoading(false);
};
setSelectedCoords([lat, lon]);
setSearchResults([]);
setSearchInput("");
setShowDirections(false);
};
};
useEffect(() => {
if (!showDirections) {
setShowTable(false);
}, [showDirections]);
() =>
searchResults.map((result) => ({
label: result.display_name,
...result,
})),
[searchResults]
);
return (
<div className="">
<form onSubmit={handleSearch}>
<Space.Compact
className="w-full"
style={{
width: "100%",
}}
>
<Input
size="large"
placeholder="Search map"
/>
<Button
size="large"
// onClick={handleSearch}
loading={isLoading}
type="primary"
htmlType="submit"
>
Search
</Button>
</Space.Compact>
</form>
{options?.length ? (
<List
dataSource={options}
renderItem={(item) => (
<List.Item
>
{item.label}
className="mt-4"
/>
</div>
) : null}
</div>
</div>
!options?.length ? (
<div className="">
<button
onClick={toggleDirections}
>
</button>
{showDirections && (
<button
onClick={toggleTableVisibility}
>
</button>
)}
</div>
): null
<MapContainer
center={selectedCoords}
zoom={13}
// className="h-screen w-full"
attributionControl={false}
>
<TileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
{userCoords && (
<Marker position={userCoords}>
<Popup>Your Location</Popup>
</Marker>
)}
<Marker position={selectedCoords}>
<Popup>Destination</Popup>
</Marker>
{/* Fly to the selected location when coordinates change */}
<RouteControl
startCoords={userCoords}
endCoords={selectedCoords}
enabled={showDirections}
showTable={showTable}
/>
)}
</MapContainer>
</div>
);
};
return null;
};
This application begins by collecting essential users details such as location preference, the details is
forward to backend for future handling which enable the system retrieves relevant location data using a
mapping API such as google map, This application queries the API for user specified destination and
fetches coordinate and nearby points of interest, The next step is displaying the location and providing
direction and running this code require your internet connection. This application serves as a reliable
travel companion, simplifying navigation and enhancing overall travel experience. It can be access
through this https://tourist-guide-application-system.netlify.app/