Skip to content
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

orientation issue #1

Open
gearye opened this issue Jun 27, 2017 · 9 comments
Open

orientation issue #1

gearye opened this issue Jun 27, 2017 · 9 comments

Comments

@gearye
Copy link

gearye commented Jun 27, 2017

The top of the SVG I am converting is oriented just west of north. When converted with svg2geojson it scales and centers the image correctly but it ends up rotated and mirrored. The bounding rect of my SVG ends up oriented perfectly north-south / east-west in the geojson.

test.svg.txt
test.geojson.txt

@Phrogz
Copy link
Owner

Phrogz commented Jun 28, 2017

Confirmed. When I wrote this I knew that I was making an assumption that SVG Y axis was aligned with north up. This is what the cryptic second bullet point in the TODO section of the readme refers to.

How important is this to you? Would entering four registration points work for you?

@gearye
Copy link
Author

gearye commented Jun 28, 2017

I was able to get what I needed by hacking in my own converter. Not a rush, but for my use case the best solution is using my own coordinate converter. If there was a way to pass that in I would be golden. Thanks!

@Phrogz
Copy link
Owner

Phrogz commented Jun 28, 2017

To be clear, the sort of converter you're taking about is supplying a custom function that is supplied an SVG coordinate pair, and you return a GPS long/lat pair? That's a moderately simple change that is be happy to add as an option on the library side. I'll also consider if there's a reasonable way to make that happen using the command-line converter.

@Aditya-Sh
Copy link

I am having similar issues regarding orientation. Can you guide as to what I can do solve this or some example of convertor that solves this?

@Phrogz
Copy link
Owner

Phrogz commented Oct 25, 2017

@Aditya-Sh Can you please be very clear about what your situation is? I'd be happy to help with a solution, but I want to ensure that I'm satisfying the need correctly.

@Aditya-Sh
Copy link

Hello, the problem I am facing is my svg is not oriented properly when converted to geojson.
screen shot 2017-10-25 at 8 59 59 pm

As you see in the image, i want top of my svg to be parallel with 'CARR ST' on map. Am I not providing proper geo tags or something else is wrong?

@Phrogz
Copy link
Owner

Phrogz commented Oct 25, 2017

Thanks for the details. You're not doing anything wrong. I just have not implemented any feature to allow rotation. Which of the following options would you prefer?

  1. Specify an angle to rotate north along with your two corners. This should be the simplest to code up, but I've not thought it through fully. I'm not sure how easy it would be to use. (Would it be easy for you to calculate the angle of deviation from north for your SVG? Maybe?)
    svg2geojson-rotation1-2cornerswithangle

  2. Use three corners to represent a rotated rectangle. This one requires you to have one point that shares the latitude of one point and the longitude of another. Pretty easy to use, but might be sometimes hard to find points that happen to match with features in your map.
    svg2geojson-rotation2-3corners

  3. Use four corners to represent arbitrary points on the map. This might also be used to stretch or skew the map in addition to rotating it, but (if I do the math right) should work without skew if your SVG and GPS coordinates are consistent. This one is probably the most work (though I've worked through the math before), certainly the most powerful, possibly the most convenient, but also possibly error-prone.
    svg2geojson-rotation3-4corners

@Phrogz
Copy link
Owner

Phrogz commented Oct 25, 2017

BTW, after I made my graphics I realize that they don't really match your specific situation, since you actually want your buildings to rotate counter-clockwise, and the graphics for 1 and 2 would end up rotating the other way.

@sushilkjaiswar
Copy link

Hi Phrogz,

Aditya and I are looking at this issue together and I was thinking which option is better to handle any common projection we use for conversion.
I think if first option can be easily achieved if we provide additional info like rotation point and angle of rotation to existing inputs for conversion. But I don't know how it will work for different
projections.
If above is not a feasible or complex solution than option 3 is better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants