mapbox-gl-native | thoroughly customizable maps in native Android | Map library
kandi X-RAY | mapbox-gl-native Summary
kandi X-RAY | mapbox-gl-native Summary
A C++ library that powers customizable vector maps in native applications on multiple platforms by taking stylesheets that conform to the Mapbox Style Specification, applying them to vector tiles that conform to the Mapbox Vector Tile Specification, and rendering them using OpenGL or Metal.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mapbox-gl-native
mapbox-gl-native Key Features
mapbox-gl-native Examples and Code Snippets
Community Discussions
Trending Discussions on mapbox-gl-native
QUESTION
So I have a UIButton and I'm setting the title in it to a string that is dynamic in length. I want the width of the titleLabel to be half of the screen width. I've tried using .sizeToFit() but this causes the button to use the CGSize before the constraint was applied to the titleLabel. I tried using .sizeThatFits(button.titleLabel?.intrinsicContentSize) but this also didn't work. I think the important functions below are the init() & presentCallout(), but I'm showing the entire class just for a more complete understanding. The class I'm playing with looks like:
...ANSWER
Answered 2021-Oct-25 at 19:13The UIButton
class owns the titleLabel
and is going to position and set the constraints on that label itself. More likely than not you are going to have to create a subclass of UIButton
and override its "updateConstraints" method to position the titleLabel
where you want it to go.
Your code should probably not be basing the size of the button off the size of the screen. It might set the size of off some other view in your hierarchy that happens to be the size of the screen but grabbing the screen bounds in the middle of setting a view's size is unusual.
QUESTION
During compilation, I am compiling a large program. One compilation step gives me the following error:
clang++ -o selfdrive/camerad/camerad -Wl,--as-needed -Wl,-rpath=/home/ziyuan/openpilot/phonelibs/snpe/x86_64-linux-clang -Wl,-rpath=/home/ziyuan/openpilot/cereal -Wl,-rpath=/home/ziyuan/openpilot/selfdrive/common selfdrive/camerad/main.o selfdrive/camerad/cameras/camera_common.o selfdrive/camerad/transforms/rgb_to_yuv.o selfdrive/camerad/imgproc/utils.o selfdrive/camerad/cameras/camera_frame_stream.o -Lphonelibs/snpe/x86_64-linux-clang -Lphonelibs/libyuv/x64/lib -Lphonelibs/mapbox-gl-native-qt/x86_64 -Lcereal -Lselfdrive/common -L/usr/lib -L/usr/local/lib -Lcereal -Lphonelibs -Lopendbc/can -Lselfdrive/boardd -Lselfdrive/common -lm -lpthread selfdrive/common/libcommon.a -ljson11 -ljpeg -lOpenCL cereal/libcereal.a cereal/libmessaging.a -lzmq -lcapnp -lkj cereal/libvisionipc.a selfdrive/common/libgpucommon.a -lGL
/usr/bin/ld: selfdrive/camerad/cameras/camera_common.o: in function CameraBuf::init(_cl_device_id*, _cl_context*, CameraState*, VisionIpcServer*, int, VisionStreamType, VisionStreamType, void (*)(void*, int))': /home/ziyuan/openpilot/selfdrive/camerad/cameras/camera_common.cc:92: undefined reference to
clCreateCommandQueueWithProperties'
When I check the linker, I got the following:
...ANSWER
Answered 2021-Aug-13 at 05:25As also answered here, clCreateCommandQueueWithProperties
is an OpenCL 2.0 thing. Nvidia GPUs only support OpenCL 1.2. Nvidia recently "upgraded" to OpenCL version 3.0, but this is just a new name for version 1.2. OpenCL 2.0 features are still not supported.
QUESTION
I am trying to compile the Mapbox GL offline tool (mbgl-offline) on Linux to generate a database with offline data for a specific region.
Steps followed as posted in github repository to compile the offline tool on Linux but it failed:
- git clone --recurse-submodules https://github.com/mapbox/mapbox-gl-native.git
- cd mapbox-gl-native
- make offline (i tried also make mbgl-offline)
- compilation failed: Error message: make: *** No rule to make target 'offline'. Stop.
Any idea what is going wrong with compilation of the tool ?
...ANSWER
Answered 2021-May-26 at 10:15The README.md clearly states how to build Mapbox: Developing
You tried to compile it with make
, but if you look around the repository there are a lot of CMakeLists.txt
, which indicates that you should use CMake to compile it.
These are the steps I followed to build it:
QUESTION
I need to add some aeronautical layers taken from FAA to the map. The layers are provided as GeoTIFF files.
Steps- Downloaded a GeoTiff file from FAA website.
- Using QGis app clipped the legend from the file. Actually the issue occurs without this step as well.
- Reprojected it to
EPSG:3857
using GDAL commandgdalwarp -q -t_srs EPSG:3857 -dstalpha -of vrt Albuquerque\ SEC\ 104-cut.tif /vsistdout/ | gdal_translate -co compress=lzw /vsistdin/ Albuquerque\ SEC\ 104-north-up-cut.tif
. Otherwise I gotError creating Mapnik Datasource: Invalid raster: Invalid rotation value in geotransform array
when uploading to Mapbox. - Created a Tileset by uploading GeoTIFFs to Mapbox.
- Created a new style in the Mapbox Studio.
- Added the tilesets as layers.
The map is showing well in Mapbox Studio:
Android ResultHowever in Android app this style shows with some black borders of random width depending on zoom level and camera position. Here is how it looks in android:
I tried it on Pixel 3a (Android 10), Nexus 5x (Android 8.1) and Android emulator (Android 10). I have good internet connection and gave it enough time so the tiles are loaded.
The source code where the map is embedded is official Demo app. I just replaced token and style URL:
...ANSWER
Answered 2020-May-28 at 14:11The black borders should be transparent, but the raster image format Mapbox is using (JPG) does not support transparency, which is a known issue that exists in every gl-native-based SDK. This issue presents itself when you reference a style that has the raster layer built in.
As a workaround, you can follow Mapbox's troubleshooting guide on troubleshooting raster images with black backgrounds to make your tileset transparent and then add the tileset as a RasterSource
within your Android application to display the raster tile as expected.
Please take a look at the following example as a reference for adding a RasterSource:
Instead of calling the rasterSource using "mapbox://username.tilesetID", you need to call it similarly to the Add a WMS Source example. The code below will resolve your issue:
style.addSource(RasterSource( "albuquerque-source", TileSet( "tileset", "https://api.mapbox.com/v4//{z}/{x}/{y}.png?access_token=" ), 256 ))
QUESTION
I'm trying to implement mapbox offline in my flutter application... until now I'm using the repository https://github.com/mapbox/mapbox-gl-native to get the map but this map comes in format *.db which is a SQLite format.
Now if I want to use that map (in format .db) in flutter I found the package https://github.com/tobrun/flutter-mapbox-gl where it has an instructions for loading the map (.db) ...
Now, that library is so basic .. I can't do more things like put markers or anything else.. that's why I'm trying to use the other library which is more common in fluter and is called 'flutter_map' and it has a way to load offline maps but the problem here is that I need '{x}{y}{z}.png' that's an image format.
Finally my question is: How can I pass from my map (.db) to that format ({x}{y}{z}.png) ??? or maybe ... how to convert (.db) to (*.mbtiles) ?? cause the last one is more common.
Thanks again!
...ANSWER
Answered 2020-Apr-09 at 10:13Mapbox offers the Raster Tiles API which will serve map tiles in ({x}{y}{z}.png) format. https://docs.mapbox.com/api/maps/#raster-tiles These images will be satellite imagery though.
Mapbox also offers the Vector Tiles API which serves map tiles in .mvt format. https://docs.mapbox.com/api/maps/#vector-tiles
Conversion to .mbtiles
- You can convert .mvt tiles to geoJSON using this converter.
- Use Mapbox Tippecanoe to convert from geoJSON to .mbtiles
QUESTION
I'm trying to build Mapbox GL Native using cmake .. so I cloned the repository from GitHub:
...ANSWER
Answered 2020-Apr-06 at 05:35If your OpenGL library path installation is defined in your ENV path,
you want to set up your CMAKE_PREFIX_PATH
to your OpenGL installation path (you could set it in your top level CMakeList.txt).
QUESTION
When I attempt to deploy an Azure function that makes use of the mapbox-gl-native library I get this error in the logs:
...ANSWER
Answered 2020-Mar-23 at 01:54I check the mapbox-gl-native
module and I found it's powered by vector tiles and OpenGL. Here is the problem, you will not be able to usethis module due to the GDI sandbox restrictions
(GDI - which openGL relies on).
Further more information you could refer to here: Win32k.sys (User32/GDI32) Restrictions.
QUESTION
I am trying to follow This tutorial and I am getting an error This is the stack trace
...ANSWER
Answered 2020-Feb-18 at 18:07That YouTube video you're following is a bit old. Setting up a simple MapView
is now done differently. For example, you can't set a map style URL via XML anymore.
https://docs.mapbox.com/android/maps/examples/create-a-simple-map-view shows the basic way to set up a Mapbox map.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mapbox-gl-native
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page