解析纬度和经度

ShouryaShourya MemberPosts:5Newbie
Hello,
I am using rapidminer studio 9.6.000 on ubuntu 18.04.
I have latitude and longitudes values expressed as e.g. 50.833.333, where 50 is the degree, 833 is minutes and 333 is seconds. By default the values are loading as nominal. Not being able to use format numbers or parse numbers.
Can anyone please help me understand how I can use this values to plot maps in visualization?

Best Answer

一个nswers

  • jacobcybulskijacobcybulski Member, University ProfessorPosts:391Unicorn
    edited April 2020
    I am not aware of a general function to achieve conversion of map coordinates. However, you could parse your nominal lat and long values using regular expressions into their three components, i.e. degrees, minutes and seconds and then generate a new attribute with a formula:
    decimal_degrees = degrees + (minutes/60) + (seconds/3600)
    一个lternatively you can convert it in R or Python via the scripting extension.
    Jacob
    P.S. By the way, I'd expect some additional information in your coordinates, i.e. E,W,N or S? Or at least an optional sign in front of your coordinates? Also are minutes a sufficient precision on the map, I'd assume some additional decimal points at the end, e.g. 37.58.01.8.S,145.25.02.5.E.


  • jacobcybulskijacobcybulski Member, University ProfessorPosts:391Unicorn
    Having said this, you really need to be careful while converting map coordinates as rounding errors will move your points by 20-30 meters in real terms. You need to convert the coordinates in double precision. It is probably best to convert your geo-locations outside RapidMiner using a specialist package. On Linux there is this package called GeoConvert, I have never used it but if you are going to put some places back on maps, it will pay to spend some time doing it right.
  • ShouryaShourya MemberPosts:5Newbie
    Making the file available as well. I also have numbers like 50.23 or 50.2. I am not being able to frame a regex to catch them all. so we have 6 formats to catch:

    1. 50.333.333
    2. 50.2
    3. 50.333
    4. 50.33
    5. 4.333.333
    6. 433.333

  • jacobcybulskijacobcybulski Member, University ProfessorPosts:391Unicorn
    edited April 2020
    I attach an example with formats which I think should be there, but you are welcome to adapt it to your needs, e.g. when the minutes or seconds are missing you can include an "if" statement matching the pattern and if the pattern fails, insert a zero for these missing bits (the way I dealt with W, E, S and N). Check this out (you will need to save this XML as a RMP file into your repository).
    I made a correction to the millisecond translation.



























    <参数键=“parse_all_as_nominal”值= " false"/>





































    一个lso note that if you incorporate milliseconds, RapidMiner seems to be losing precision, which will translate into meters of difference.

    Jacob
    Shourya
  • jacobcybulskijacobcybulski Member, University ProfessorPosts:391Unicorn
    edited April 2020
    BTW, without information about East, West, North and South, your translation will be incorrect for southern or northern coordinates. So if the coordinates you received are very specific to the region, e.g. some place in USA, you will have to assume appropriate E/W, N/S location.
  • jacobcybulskijacobcybulski Member, University ProfessorPosts:391Unicorn
    I have just discovered RapidMiner has a GeoProcessing extension, which I have never used as all my coordinates processing was always done externally to RapidMiner (in R or Python). However, it may do the trick?
    Shourya BalazsBarany
  • BalazsBaranyBalazsBarany 一个dministrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified ExpertPosts:949Unicorn
    Hi,

    I'm the author of the GeoProcessing extension, feel free to ask me. It doesn't have an operator or conversion for this format, though.

    Regards,

    Balázs
Sign InorRegisterto comment.