I'm making a call to the Mapbox Isochrone API to obtain a FeatureCollection with this code:

string getIso = lng.ToString() + ","
          + lat.ToString() 
          + "?contours_minutes=" + minutes.ToString()
          + "&polygons=true"
          + "&denoise=" + denoiseValue.ToString()
          + "&generalize=" + generalizeValue.ToString()
          + "&access_token=" + _appSettings.MapboxAccessToken;

HttpClient client = new HttpClient();
client.BaseAddress = new Uri(drivetimeURL);

HttpResponseMessage response = client.GetAsync(getIso).Result;
FeatureCollection dtPolygon = await response.Content.ReadFromJsonAsync<FeatureCollection>();

I'm trying to get the data as a FeatureCollection type using the GeoJson.Net library, but when I run the code, all I get is basically an empty object:

    "type": 8,
    "features": [],
    "boundingBoxes": null,
    "crs": null

If I run this:


here's what I get and this is what I need in an object (coordinates mostly removed):

    "features": [
            "properties": {
                "fill": "#bf4040",
                "fillOpacity": 0.33,
                "fill-opacity": 0.33,
                "fillColor": "#bf4040",
                "color": "#bf4040",
                "contour": 10,
                "opacity": 0.33,
                "metric": "time"
            "geometry": {
                "coordinates": [
                "type": "Polygon"
            "type": "Feature"
    "type": "FeatureCollection"

I suspect that I'm not completely understanding how GEOJson works and that I may have to manipulate the response from Mapbox to get it into a type that has the details. Or do I need to create a custom class/model that mimics the Mapbox response?

1 Answer 1


I think you can try to read as JSON first, then deserialize:

HttpResponseMessage response = client.GetAsync(getIso).Result;
string jsonResponse = await response.Content.ReadAsStringAsync();
FeatureCollection dtPolygon = JsonConvert.DeserializeObject<FeatureCollection>(jsonResponse);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.