> For the complete documentation index, see [llms.txt](https://docs.mburger.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mburger.cloud/how-to/advance-section-retrieval/obtain-distance-from-a-section.md).

# Obtain distance from a section

{% tabs %}
{% tab title="cURL" %}

```bash
curl https://mburger.cloud/api/blocks/<id>/sections?distance=latitude,longitude
-H "Accept: application/json" 
-H "X-MBurger-Token: <token>" 
-H "X-MBurger-Version: 3"
```

{% endtab %}

{% tab title="iOS SDK" %}

```swift
struct LocationParamter: MBParameter {
    let location: CLLocationCoordinate2D!
    
    func parameterRepresentation() -> [String: Any] {
        return [
            "latitude": location.latitude,
            "longitude": location.longitude
        ]
    }
}


...

let locationParameter = LocationParamter(location: CLLocationCoordinate2D(lat, lng))
MBClient.getSection(withId: SECTION_ID,
                    parameters: [locationParameter],
                    success: { section in
                                
                    },
                    failure: { error in
                                
                    })      
```

{% endtab %}

{% tab title="Android SDK" %}

```kotlin
val arrayParameters = ArrayList<Any>()
arrayParameters.add(MBGeneralParameter(key = "latitude", value = THE_LATITUDE))
arrayParameters.add(MBGeneralParameter(key = "longitude", value = THE_LONGITUDE))

val sectionsListener = object: MBSectionsResultListener{
            override fun onSectionsApiError(error: String) {
            }

            override fun onSectionsApiResult(sections: ArrayList<MBSection>, 
                                             block_id: Long, 
                                             paginationInfos: MBPaginationInfo) {
            }
        }
        
MBurgerTasks.askForSections(context = applicationContext, 
                         block_id = BLOCK_ID,
                         filters = arrayParameters,
                         getElements = true,
                         listener = sectionsListener)
```

{% endtab %}

{% tab title="PHP SDK" %}

```php
$response = (new MBurger())->distance(float $latitude, float $longitude)->getSections();
```

{% endtab %}

{% tab title="JS SDK" %}

```javascript
const mburger = require('mburger');

const instance = mburger.createClient({
    api_key: "12578sdfghjkl",
});

let latitude = 44.542,
    longitude = 10.452;

// Retrieve a specific block
instance.getBlock({
    block_id: 884,
    locale: 'it',
    original_media: false,
    filter: {
        'distance': latitude + ',' + longitude
    }
}).then(result => console.log(result));

```

{% endtab %}

{% tab title="Flutter SDK" %}

```dart
class LocationParameter extends MBParameter {
  final double latitude;
  final double longitude;

  LocationParameter(this.latitude, this.longitude);

  @override
  Map<String, String> get representation {
    return {
      'latitude': latitude.toString(),
      'longitude': longitude.toString(),
    };
  }
}

... 

MBFilterParameter locationParameter = LocationParameter(LAT, LNG);
MBSection section = await MBManager.shared.getSection(
  sectionId: SECTION_ID,
  includeElements: true,
  parameters: [locationParameter],
);
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mburger.cloud/how-to/advance-section-retrieval/obtain-distance-from-a-section.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
