ichim / LeafletForBlazor-NuGet

LeafletForBlazor NuGet Package - You can quickly add a map control to your Blazor application - 2.2.2.2 version. #12 issue, StreamLegend customization
https://www.nuget.org/packages/LeafletForBlazor#versions-body-tab
74 stars 9 forks source link

Longitude and latitude in local GEOJson seem to be swapped #2

Closed SilasPeters closed 1 year ago

SilasPeters commented 1 year ago

In my wwwroot folder, I have the following JSON file:

[
  {
    "type": "feature",
    "geometry": {
      "type": "point",
      "coordinates": [ 54.057122, 6.081795 ]
    },
    "properties": {
      "name": "prachtige rotonde"
    }
  },
  {
    "type": "feature",
    "geometry": {
      "type": "point",
      "coordinates": [ 54.059813, 6.073641 ]
    },
    "properties": {
      "name": "oude wielerbaan"
    }
  }
]

The thing is, they end up somewhere in Arabia and not near the Netherlands, where they should be. Google maps and openstreetmap itself do interpret these coordinates correctly.

My guess is that you confused longitude with latitude when interpreting a local GEOJson.

ichim commented 1 year ago

Hello sir,

Try to reverse the coordinates.

Thanks a lot for using package

From: Silas Peters @.> Sent: Sunday, February 26, 2023 2:22 PM To: ichim/LeafletForBlazor-NuGet @.> Cc: Subscribed @.***> Subject: [ichim/LeafletForBlazor-NuGet] Longitude and latitude in local GEOJson seem to be swapped (Issue #2)

In my wwwroot folder, I have the following JSON file:

[

{

"type": "feature",

"geometry": {

  "type": "point",

  "coordinates": [ 54.057122, 6.081795 ]

},

"properties": {

  "name": "prachtige rotonde"

}

},

{

"type": "feature",

"geometry": {

  "type": "point",

  "coordinates": [ 54.059813, 6.073641 ]

},

"properties": {

  "name": "oude wielerbaan"

}

}

]

The thing is, they end up somewhere in Arabia and not near the Netherlands, where they should be. Google maps and openstreetmap itself do interpret these coordinates correctly.

My guess is that you confused longitude with latitude when interpreting a local GEOJson. Another reason why I suspect this, is because the sample code provided on the readme on NuGethttps://www.nuget.org/packages/LeafletForBlazor/1.0.6#readme-body-tab first sets the longitude (y-axis) and then the latitude (x-axis), while normally x comes before y.

— Reply to this email directly, view it on GitHubhttps://github.com/ichim/LeafletForBlazor-NuGet/issues/2, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB7WGLYTXEV42JORSK2WAOLWZNDH7ANCNFSM6AAAAAAVIN36AM. You are receiving this because you are subscribed to this thread.Message ID: @.***>

ichim commented 1 year ago

…a clue for me is that the points fall in the Arab area, so reverse coordinates as in next example:

[

{

"type": "feature",

"geometry": {

  "type": "point",

  "coordinates": [6.081795, 54.057122]

},

"properties": {

  "name": "prachtige rotonde"

}

},

{

"type": "feature",

"geometry": {

  "type": "point",

  "coordinates": [6.073641, 54.059813,]

},

"properties": {

  "name": "oude wielerbaan"

}

}

]

Tanks a lot for using package, Laurentiu Ichim

From: Silas Peters @.> Sent: Sunday, February 26, 2023 2:22 PM To: ichim/LeafletForBlazor-NuGet @.> Cc: Subscribed @.***> Subject: [ichim/LeafletForBlazor-NuGet] Longitude and latitude in local GEOJson seem to be swapped (Issue #2)

In my wwwroot folder, I have the following JSON file:

[

{

"type": "feature",

"geometry": {

  "type": "point",

  "coordinates": [ 54.057122, 6.081795 ]

},

"properties": {

  "name": "prachtige rotonde"

}

},

{

"type": "feature",

"geometry": {

  "type": "point",

  "coordinates": [ 54.059813, 6.073641 ]

},

"properties": {

  "name": "oude wielerbaan"

}

}

]

The thing is, they end up somewhere in Arabia and not near the Netherlands, where they should be. Google maps and openstreetmap itself do interpret these coordinates correctly.

My guess is that you confused longitude with latitude when interpreting a local GEOJson. Another reason why I suspect this, is because the sample code provided on the readme on NuGethttps://www.nuget.org/packages/LeafletForBlazor/1.0.6#readme-body-tab first sets the longitude (y-axis) and then the latitude (x-axis), while normally x comes before y.

— Reply to this email directly, view it on GitHubhttps://github.com/ichim/LeafletForBlazor-NuGet/issues/2, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB7WGLYTXEV42JORSK2WAOLWZNDH7ANCNFSM6AAAAAAVIN36AM. You are receiving this because you are subscribed to this thread.Message ID: @.***>