-1

I have a question guys. I can't make google links for geo points.I don't know why that code is not working.

for example I have that point below: 30.152169 41.070933

I can't see this location on Google Maps when I tryed like below.Could you please help me ?

public NetTopologySuite.Geometries.Geometry? GeoItem { get; set; }
 public string? GoogleMapsLink {get;set;}
 public void Links()
{
if(this.GeoItem !=null)
{
string x = this.GeoItem.Coordinate.X.ToString();
string y = this.GeoItem.Coordinate.Y.ToString();
string googleUrl = $"https://www.google.com/maps/@{x},{y},17.5z";
this.GoogleMapsLink=googleUrl;
}
}
Arda Şen
  • 47
  • 4

1 Answers1

1

I fixed above problem.

  1. Google Maps can approve the value with '.' not ','. Example 30,15464 41,21516; this was the mistaken one.

  2. The second one is URL. You can see the URL below.

    public void Links()
     {
       if (this.GeoItem != null && this.GeoItem.IsValid)
        {
          double x = this.GeoItem.Coordinate.X;
          double y = this.GeoItem.Coordinate.Y;
          string googleUrl = $@"https://www.google.com/maps/search/?api=1&query={y}%2C{x}";
          googleUrl = googleUrl.Replace(',', '.');
          this.GoogleMapsLink = googleUrl;
        }
     }
    
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Arda Şen
  • 47
  • 4