-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circle draw does not correspond to real word scale. #192
Comments
Hello @dalexhd , |
Okay... I will tell you later ^^ |
Im using "import { getDistance } from "ol/sphere";" getDistance function from that file. Is it a good choice to calculate the distance from 2 coordinates? |
Yep, this function, as I know, calculates distance using WGS84 ellipsoid. |
Okay, so this update does not solve my problem. Basically it seems to be a scalar problem. While the radio gets bigger, the error is bigger. |
Do you make calculation of the distance with points in the EPSG:4326 projection? |
My map data-projection prop is "EPSG:4326". |
Any news from here? |
Currently not yet |
From here https://github.com/openlayers/openlayers/blob/v5.3.0/src/ol/sphere.js#L84 |
this is old thread, but i struggled with same problem to draw 'real scale' circle. AFAIK ol.geom.Circle does not support real measures, but Polygon class does, this is how i resolved this issue with vuelayers <template>
<vl-layer-vector>
<vl-source-vector>
<vl-feature >
<vl-geom-polygon :coordinates="polygonCoord"/>
</vl-feature >
</vl-source-vector>
</vl-layer-vector>
</template>
<script>
import { circular } from "ol/geom/Polygon"
export default {
data() {
return{
polygonCoord: undefined,
}
},
methods:{
// longlat center, radius in meters, 64=number of vertices
createCircle(center, radius) {
const circleGeometry = circular(center, radius, 64);
//edit: if you use 3857 map projection you need to transform geometry
// circleGeometry = circleGeometry.transform(
// "EPSG:4326",
// "EPSG:3857"
// );
this.polygonCoord = circleGeometry.getCoordinates();
},
}
};
</script> this solution does not create real cirlce, but circular polygon you can control with number of vertices. |
I need to use circle in my project. My solution https://codesandbox.io/s/objective-rgb-xfqln?file=/src/components/Map.vue |
Your documentation example:
https://vuelayers.github.io/#/docs/component/circle-geom?id=usage
Good calculated radius:
https://www.mapdevelopers.com/draw-circle-tool.php?circles=%5B%5B300%2C43.3163855%2C-1.9424133%2C%22%23AAAAAA%22%2C%22%23000000%22%2C0.4%5D%2C%5B100%2C41.8902102%2C12.4922309%2C%22%23AAAAAA%22%2C%22%23000000%22%2C0.4%5D%5D
I'm having a problem while developing my circle dynamic locations filter. Depending on the radius, I search nearest business locations.
In this photo, the distance from "Fibrodyne" to the center according to google api is: 1540m.
So the problem comes with the circle radius, not with my code.
PD: Im using the same system as your example, with the global projection "EPSG:4326". For now I'm multiplying by 1.37597279904 to the radius... I know that this is an ugly fix xd...
The text was updated successfully, but these errors were encountered: