I’m converting xml files to geojson format using turf.js. Then I show it on the map. However, when I display geojson data on the map, there is an error in the coordinates. When I try the geojson output in the console in a mapbox or a different map program, there is no problem with the coordinates. Pictures are as follows. How can I resolve this situation. Thanks in advance
const polygon = turf.polygon([coordinatesList]);
const feature = turf.feature(polygon.geometry, properties);
const geojson2 = turf.featureCollection(features);
Is it possible that you may need to convert the positions to another EPSG? For instance, see GeoJSON in EPSG:3857.
Hi, I tried with different epsg codes but no difference. How can I solve this issue. Thanks in advance
You’re using MapBox in your “correct” example, what are you using in the “wrong” one? Different map providers have different levels of quality and accuracy in their maps, it just might be your coordinates are fine but the map is wrong? If you print out the coordinates from both, do the look the same?
I’m using Mapbox in “correct” example and I’m using cesium ion at “wrong” one. I’m working on an avation company. That’s why the places the coordinates show are very important to me.
I am curious if you can create one or two sandcastles which demonstrate the issue.
My first guess, as someone else suggested, is that map accuracy is the issue.
There is a sandcastle sample of the photo I took in the link above. You can also try different geojsons. Thanks in advance
You might want to try with any local data as well or other map providers.
Sorry, I don’t understand, is there no way to improve accuracy with Cesium Ion?
Accuracy of what, exactly?
You’ve got some real-world coordinates that matches the images of one map provider, but not another, however that’s not to say one is more correct than the other; are your world-coordinates accurate, or are they based on the outlines from a specific map provider?
Either use the same provider to match the coordinates, or make sure your coordinates are accurate, then choose the map provider with the most accurate map. Accuracy costs money.
Alternatively, store an image outline around each point in your world-coordinates, do edge detection against the map background, and try to align the coordinates again if you swap the maps. There is no one simple answer to this; the visual map from different providers is not the same as an accurate map from any provider (all maps are hotchpotches of images from multiple timelines distorted to some degree of accuracy against an actual world that changes over time), just like visual coordinates are not the same as accurate or precise coordinates. And don’t tilt the map so that height becomes something you want to deal with; vertical height accuracy is even harder to get right than horizontal accuracy. It all comes down to how much time and money and effort you’re willing to put in to do what you want it to do.