1

I am running this query on overpass-turbo

[out:json][timeout:25];
rel(223133);
(
  rel(r);
);
rel(1250951);

out geom; 

and I have received this polygon.

enter image description here

but when I process this data my Image is like this :

enter image description here

I am using dot net core and this is my query

foreach (var m in geoElement.members)
{
    if (m is { type: "way", role: "outer" })
    {
        foreach (var g in m.geometry)
        {
            Coordinate coordinate = new Coordinate(g.lon, g.lat);
            coordinates.Add(coordinate);
        }
    }

}
var shell = new LinearRing(coordinates.ToArray());

var p = new Polygon(shell);
        var serializer = GeoJsonSerializer.Create();
        using var stringWriter = new StringWriter();
        using var jsonWriter = new JsonTextWriter(stringWriter);

        serializer.Serialize(jsonWriter, p);
        var geoJson = stringWriter.ToString();
        return geoJson;

First I added all geometries lat and lng into a coordinate list and finally, I make a polygon and at the end I make a GeoJSON.

What tips exist here?

I downloaded GeoJSON file from Overpass and I checked with my made GeoJSON. there is so different from points. I don't know why. How can I make GeoJSON like an overpass downloaded file?

This is my GeoJson file I made from Rwa data: https://pastebin.ubuntu.com/p/DSgkSf7qnH/

18
  • I downloaded the same polygon. The geometry part looks like: "geometry": { "type": "Polygon", "coordinates": [ [ [ 33.0320818, 38.1524781 ], [ 33.0264817, 38.143384 ], - see screenshot of the GeoJSON: i.stack.imgur.com/Cfgee.png
    – Babel
    Apr 30 at 19:34
  • I don't understand what is your point, I downloaded GeoJson but so different when we run my query and make a polygon. I want to make GeoJson from raw data by running query@Babel Apr 30 at 19:37
  • As you can see I made a polygon but my polygon has a problem. do you know is there the any tips to make polygon from Row data by running overpass query @Babel Apr 30 at 19:41
  • So it seems I don't understand your point - your question is not about how to create a GeoJSON file? Than you could simply imitate the structure of the downloaded file. If not, than your question is confusing an I'm not sure what you want to ask.
    – Babel
    Apr 30 at 19:43
  • 1
    Does it help to replace out geom; with >; out skel qt; ?
    – Babel
    Apr 30 at 20:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.