2

I am working with CRS.Simple in Leafleat. The y-coordinates from the SVG don't match what I'm supposed to use in GeoJson. I do not want to calculate them manually. How to use coordinates from SVG so that they can be easily inserted into GeoJSON Polygon from SVG:

<polygon id="001" class="fil1 str0" points="145,779 169,749 139,726 131,754 125,765"/>

GeoJSON that renders correctly on the map:

 {
    "type": "Feature",
    "properties": {"party": "Republican"},
    "geometry": {
        "type": "Polygon",
        "coordinates": [[
            [145, 421],
            [169, 451],
            [139, 474],
            [131, 446],
            [125, 435]
        ]]
    }
}
1

1 Answer 1

0

Y coordinate in SVG goes from top down, but in GeoJSON it goes from bottom up. If you sum up Y coordinate for specific point from SVG and GeoJSON, you'll get SVG height, which is 1200.

This means that all you have to do to get right Y coordinate in GeoJSON is to subtract SVG Y coordinate from 1200.

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.