I want to get static image with calling an API from mapbox, but it returns me this message:
{"message":"Failed parsing geojson"} // with status code:422
I used mapbox_search package to create the API. this is My code:
MapBoxStaticImage staticImage = MapBoxStaticImage(
apiKey:
'pk.eyJ1IjoiYXNocmFmaWowMDciLCJhIjoiY2s2Nm40ZjFkMDAxMDNubXo3M3V4Y2pvaiJ9.cQACwGfCXD1iuKdJeZDozA',
);
Future<String> getStaticImageWithMarker() async {
final locationData = await locationFinder.Location().getLocation();
return staticImage.getStaticUrlWithMarker(
center: Location(lat: locationData.latitude, lng: locationData.longitude),
marker: MapBoxMarker(
markerColor: Color.rgb(200, 0, 0),
markerLetter: 'p',
markerSize: MarkerSize.LARGE),
height: 300,
width: 600,
zoomLevel: 16,
style: MapBoxStyle.Streets,
render2x: true,
);
}
getStaticImageWithMarker() function returns this api for creating the image, but I get the error that I mentioned at the top.
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/pin-l-p+c800(-122.084,37.4219983)/-122.084,37.4219983,16,0,20/600x300@2x?access_token=pk.eyJ1IjoiYXNocmFmaWowMDciLCJhIjoiY2s2Nm40ZjFkMDAxMDNubXo3M3V4Y2pvaiJ9.cQACwGfCXD1iuKdJeZDozA
Is there anybody to know where I did wrong in this APIcalling?
In mapbox i got "Invalid Image" error. And i select Carto in Mapbox style it fixed.
enter image description here