I am working on a project where I need to identify buildings from a map. This could be a static map taken from an image or a dynamic map rendered in the browser. My main goal is to extract information about buildings, such as their outlines or coordinates, from the map.
I am looking for a JavaScript-based solution that can help me achieve this. I am open to using libraries or APIs that could simplify the process, but I’m not sure where to start or what would be the most effective approach.
Here are some specific questions I have:
Are there any JavaScript libraries or APIs specifically designed for analyzing map images to identify buildings?
How can I extract building outlines or coordinates from a map image using JavaScript? Are there any specific techniques or algorithms that are recommended for this purpose?
If I am working with a dynamic map (e.g., Google Maps, OpenStreetMap), what tools or APIs could I use to identify buildings in real-time as the map changes?
Are there any examples or tutorials that demonstrate how to identify buildings from a map image using JavaScript?
Any advice, tutorials, or pointers to relevant documentation would be greatly appreciated. I am especially interested in any open-source tools or libraries that could help with this task.
Thank you in advance for your help!
I tried to use TensorFlow.js to process map images and identify buildings by their outline or coordinates. My approach involved trying to train a model with labeled images of maps where buildings were clearly marked. I hoped that the model would learn to recognize similar patterns in new map images, but even at a basic level I was not successful.
function getMapDataSomehow() {
const markers = [
{ lat: 39.9334, lng: 32.8597 },
];
return markers;
}
function convertMapDataToTensors(mapData) {
const markerPositions = mapData.map(marker => [marker.lat, marker.lng]);
return tf.tensor2d(markerPositions);
}
function processTensorsWithTensorFlow(tensors) {
console.log('Tensor shape:', tensors.shape);
tensors.print();
const normalizedTensors = normalizeTensor(tensors);
normalizedTensors.print();
}
function normalizeTensor(tensor) {
const minLat = 36.0;
const maxLat = 42.0;
const minLng = 26.0;
const maxLng = 45.0;
const normalizedTensor = tensor.sub(tf.tensor([minLat, minLng])).div(tf.tensor([maxLat - minLat, maxLng - minLng]));
return normalizedTensor;
}
document.getElementById('processMap').addEventListener('click', () => {
const mapData = getMapDataSomehow();
const tensorData = convertMapDataToTensors(mapData);
processTensorsWithTensorFlow(tensorData);
});
