Comments (8)
One solution could be to add an optional property to the constructor that would be an array of markers and then use a similar technique as the one discussed in Markers in the Map are not printed #32
this.markers.forEach((x, i) => {
mapRef.current = mapRef.current.addSource(`point${i}`, {
type: "geojson",
data: {
type: "Point",
coordinates: [x.position.lng, x.position.lat],
},
});
mapRef.current = mapRef.current.addLayer({
id: `point${i}`,
source: `point${i}`,
type: "circle",
paint: {
"circle-radius": 8,
"circle-color": "red",
"circle-stroke-width": 1,
"circle-blur": 0.5,
},
});
credits to @TARMAH
from maplibre-gl-export.
@PeterPilley, @puka-tchou, @Hags7978 ,@TARMAH
I finally managed this long term issue of exporting marker via PR #122. I used @TARMAH's approarch to export markers as circle layer, but the plugin get marker's coordinates info from DOM element directly. So, you don't need to pass markers additionally.
I added markerCirclePaint
option to allow to change circle style flexiblely. You can pass maplibre/mapbox expression to the plugin.
Please try the latest version of plugin.
- maplibre-gl-export: 3.4.0
- mapbox-gl-export: 3.1.0
from maplibre-gl-export.
#15 is also quite similar with this bug
from maplibre-gl-export.
@puka-tchou Thank you for the issue. This plugin only can export current style.json in map object. There is no style information about marker, that is why it is not exporting with custom marker. You have to add your own markers after this source code.
maplibre-gl-export/lib/map-generator.ts
Lines 165 to 178 in f1b6370
Maybe the plugin can have an optional parameter to apply any additional style into exported map.
Feel free to make pull request to the repository to add this feature.
from maplibre-gl-export.
watergis/mapbox-gl-export#32 is also the same issue with maplibre version
from maplibre-gl-export.
I'm currently reading the source code, I think that it might be more easily solved on my side. I can see that the generate()
method loads the canvas of the map and then prints it:
const renderMap = new MaplibreMap({
container,
style,
center: this.map.getCenter(),
zoom: this.map.getZoom(),
bearing: this.map.getBearing(),
pitch: this.map.getPitch(),
interactive: false,
preserveDrawingBuffer: true,
fadeDuration: 0,
attributionControl: false,
// hack to read transfrom request callback function
transformRequest: (this.map as any)._requestManager._transformRequestFn,
});
renderMap.once('idle', () => {
const canvas = renderMap.getCanvas();
the solution might be to add the markers on the map using a symbol layer instead of adding them via new maplibregl.Marker({element}).setLngLat(lngLat).addTo(map);
when I'm creating the map in my code.
But anyway, it would be nice to have the option right inside of maplibre-gl-export
, but I'm not sure that it's feasible.
from maplibre-gl-export.
Hi was there any update on this issue? or update on progress.
from maplibre-gl-export.
Push
from maplibre-gl-export.
Related Issues (18)
- mapbox-gl-export.umd.js throws Uncaught ReferenceError: Size is not defined HOT 3
- Non metric (US) Paper size support HOT 1
- No icons or images are output HOT 3
- Spanish translation HOT 3
- Additional exported elements HOT 6
- 3D Terrain with MapLibre v.2.2.0-pre.3 HOT 6
- maplibre-gl-export and maplibre-gl-legend HOT 6
- ESLint didn't fix all typescript files in lib directory
- Lib / dist file error HOT 3
- ReferenceError: Size is not defined HOT 2
- Uncaught TypeError: MaplibreExportControl is not a constructor HOT 2
- Bring new translations from mapbox-gl-export
- Getting the generated image and pass to the other component of the application.
- Export Icon SVG fill Color doesn't match the fill color of other MapLibre control icons.
- Dependency Dashboard
- PDF export for A3 size produces incorrect crop HOT 3
- Export is not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maplibre-gl-export.