NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I am using the following code to retrieve the address from lon and lat: $lon = 100.753; $lat = 13.69362;

function getAddress($RG_Lat,$RG_Lon)
{
  $json = "https://nominatim.openstreetmap.org/reverse?format=json&lat=".$RG_Lat."&lon=".$RG_Lon."&zoom=27&addressdetails=1";

  $ch = curl_init($json);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0");
  $jsonfile = curl_exec($ch);
  curl_close($ch);

  $RG_array = json_decode($jsonfile,true);

  return $RG_array['display_name'];
  // $RG_array['address']['city'];
  // $RG_array['address']['country'];
}

$addr = getAddress($lat,$lon);
echo "Address: ".$addr;

My code works very well under ovh server.

My application is installed locally under wamp server.

The same code, does not return anything: What extension or something else that I must activate it locally to have a return of my code?

Do you have any idea, why my code no longer works locally (wamp server)?

This question is marked "community wiki".

asked 23 May '21, 23:12

Lemjid's gravatar image

Lemjid
11112
accept rate: 0%

edited 24 May '21, 08:46

Hello everyone, Someone has an approach, an idea: is it possible to use this code locally as my application is well installed locally ???

(25 May '21, 16:13) Lemjid

Help please ????????

(25 May '21, 18:39) Lemjid
2

You probably aren't getting any responses because nobody here knows how to help you. This doesn't sound like an OSM issue, but rather a more general issue with configuring a web server. You might get more help from somewhere like StackOverflow.

(26 May '21, 17:35) alester

@Alester : thanks

(26 May '21, 17:57) Lemjid
1

To add to what alester said - if something works in place A but not in place B then the difference is between place A and place B, and we don't have any information about those and so can't really comment.

(26 May '21, 18:00) SomeoneElse ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×133

question asked: 23 May '21, 23:12

question was seen: 590 times

last updated: 26 May '21, 18:00

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum