Comments (11)
Hi @ArthurSalomaoo,
The file you are sending on this sample code is empty, without any features. If your geojson features are in the mapa.geojson
file, you should load/fetch it before sending it to the remote API. You can send an URL and indoorequal will load it.
There a remote tester https://indoorequal.org/remote.html. Try putting the URL of your gist in the "Open preview with URL": https://gist.githubusercontent.com/ArthurSalomaoo/54a78604c9edd11d196f70b7c551f223/raw/7d6c346bdb1b882bfdca66c7dabaa68176caca33/mapa.geojson
from indoorequal.org.
HI @francois2metz. I'm his advisor.
On remote tester it works properly. However, using indoor documentation example
<script>
const indoorEqualWindow = window.open("https://indoorequal.org/");
window.addEventListener('message', (e) => {
if (e.data.event === 'ready') {
const file = new File([JSON.stringify({type: 'FeatureCollection', features: []})], 'mapa.geojson');
indoorEqualWindow.postMessage({ command: 'preview',file }, '*');
}
});
</script>
Specifically on indoorEqualWindow.postMessage({ command: 'preview',file }, '*');
indoor equal doesn't load my geojson.
I've console.log(file)
object and I can see file content.
What do you suggest to fix this code and load this geojson file using postMessage method?
Thanks.
from indoorequal.org.
I've
console.log(file)
object and I can see file content.
Which file content do you see? {type: 'FeatureCollection', features: []})
is an empty geojson. It cannnot render anything.
What do you suggest to fix this code and load this geojson file using postMessage method?
You could "fetch" the geojson content and put it in the file before sending it to indoorequal.
from indoorequal.org.
I've
console.log(file)
object and I can see file content.Which file content do you see?
{type: 'FeatureCollection', features: []})
is an empty geojson. It cannnot render anything.What do you suggest to fix this code and load this geojson file using postMessage method?
You could "fetch" the geojson content and put it in the file before sending it to indoorequal.
Look what I did. I checked file size below. Unfortunatelly, indoorequal does not render it.
Could you see my code and suggest a solution to it.
The indoor map is to this location link
<body>
<input type="file" onchange="showFile(this)">
</body>
<script>
let arquivo = null
let indoorEqualWindow = null
function showFile(input) {
arquivo = input.files[0];
let reader = new FileReader();
reader.readAsText(arquivo);
reader.onload = function () {
arquivoContent = reader.result
const arquivo = new File([JSON.stringify(arquivoContent)], 'mapa.geojson');
};
reader.onerror = function () {
console.log(reader.error);
};
indoorEqualWindow = window.open("https://indoorequal.org/");
}
window.addEventListener('message', (e) => {
if (e.data.event === 'ready') {
alert('FILE SIZE>>>'+arquivo.size)
indoorEqualWindow.postMessage({ command: 'preview', arquivo }, '*');
}
});
Thanks.
In future, I can contribute to docummentation adding more examples.
from indoorequal.org.
<body> <input type="file" onchange="showFile(this)"> </body> <script> let arquivo = null let indoorEqualWindow = null function showFile(input) { arquivo = input.files[0]; let reader = new FileReader(); reader.readAsText(arquivo); reader.onload = function () { arquivoContent = reader.result const arquivo = new File([JSON.stringify(arquivoContent)], 'mapa.geojson');
You declare a new const here that is scoped to the function. You should at least remove the const.
}; reader.onerror = function () { console.log(reader.error); }; indoorEqualWindow = window.open("https://indoorequal.org/");
}
window.addEventListener('message', (e) => {
if (e.data.event === 'ready') { alert('FILE SIZE>>>'+arquivo.size) indoorEqualWindow.postMessage({ command: 'preview', arquivo }, '*');
The second parameter of the preview command must be named file
, not arquivo
}
});
I commented a few obvious problems. There is probably a timing issue between the onload of the reader and the listening of the 'ready' event from indoorequal.
from indoorequal.org.
@ArthurSalomaoo Did you make some progress? As this is not an indoor= issue I'm closing this. Feel free to open a discussion that I enabled: https://github.com/orgs/indoorequal/discussions
from indoorequal.org.
@ArthurSalomaoo Did you make some progress? As this is not an indoor= issue I'm closing this. Feel free to open a discussion that I enabled: https://github.com/orgs/indoorequal/discussions
Hi @francois2metz, we didn't make it. We are cloning your code and hoisting it and trying to render our geojson.
Thanks for your support! We'll send news about our advances.
from indoorequal.org.
Here is a working version: https://jsfiddle.net/2x5m6yuz/
from indoorequal.org.
Here is a working version: https://jsfiddle.net/2x5m6yuz/
Thanks. I’ll open a discuss to discuss with you to evaluate if indoorequal is a viable option to our research project.
from indoorequal.org.
Hello, @francois2metz , I would like to ask you a question about using Indoorequal. Could we start a discussion?
from indoorequal.org.
Hello, @francois2metz , I would like to ask you a question about using Indoorequal. Could we start a discussion?
Sure
from indoorequal.org.
Related Issues (20)
- i18n: Add zh-hant (Mandarin - Traditional Han script) as translation target language on Transifex HOT 4
- i18n: Remove duplicated zh_TW from Transifex project HOT 5
- Follow-up of "i18n: Remove duplicated zh_TW from Transifex project"
- Map not displayed HOT 18
- Indoormap requires too much zoom on mobile devices HOT 4
- Feature Request: Render man_made=column HOT 8
- Ignoring objects with level=x-y? HOT 2
- style transport related objects HOT 2
- style service related objects HOT 10
- Outline for areas with name? HOT 1
- Display room ref HOT 7
- Added walls disappear if along border of two floors HOT 3
- Rendering some more node POIs? HOT 4
- Add emergency POIs? HOT 4
- Support viewing indoor nodes and highway=corridor ways HOT 3
- Add support for one-based level scheme? HOT 1
- OSM attribution not visible iPhone 12 mini HOT 5
- Map readability issue due to label collisions between layers HOT 3
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from indoorequal.org.