Comments (10)
so the current code needs a global function called createMapThumbnail
var createMapThumbnail = function(obj_id) {
var xmap = $('.olMapViewport');
height = xmap.height();
width = xmap.width();
var map = xmap.clone();
map.find('*').each(function(i) {
e = $(this);
if(e.css('display') === 'none' || (e.attr("class") !== undefined && (e.attr("class").indexOf('olControl') >= 0 || e.attr("class").indexOf('x-') >= 0))) {
e.remove();
} else if (e.attr('src') === '/static/geoexplorer/externals/ext/resources/images/default/s.gif') {
e.remove();
} else {
e.removeAttr("id");
}
});
var url = window.location.pathname.replace('/view', '');
if (typeof obj_id != 'undefined' && url.indexOf('new')){
url = url.replace('new', obj_id);
}
url+= '/thumbnail';
$.ajax({
type: "POST",
url: url,
data: ("<div style='height:" + height + "px; width: " + width + "px;'>" + map.html() + "</div>"),
success: function(data, status, jqXHR) {
return true;
}
});
return true;
};
from geonode-client.
from geonode-client.
@jj0hns0n can you tell me a bit more about the thumbnail endpoint? Can I post a base64 encoded image? Is it server-side rendering of HTML what Ian did?
from geonode-client.
from geonode-client.
We can do something similar to: http://openlayers.org/en/latest/examples/export-map.html
from geonode-client.
from geonode-client.
so it seems we need to also automatically update the thumbnail on save, like is done here?
https://github.com/GeoNode/geonode/blob/cea5011c2f735e83005bea013fa784034736d057/geonode/maps/templates/maps/map_geoexplorer.js#L34:L37
from geonode-client.
We also need to make sure that for our case thumbnail.js doesn't get included in the main geonode template: https://github.com/GeoNode/geonode/blob/23c42efc66b940875f76ea78ab457ffb3d07ebb6/geonode/maps/templates/maps/map_detail.html#L314
from geonode-client.
from geonode-client.
Right that's what we are working on now, but the standard template includes that thumbnail.js file when it shouldn't for the react viewer. Mila is working on a fix for that.
from geonode-client.
Related Issues (20)
- Add loading indicator for save map.
- Fix edit_map template
- Fix Save button not showing up in save map
- Saving styles to GeoServer HOT 1
- Add option in settings.py for checkLogin
- Map view layer list rendering issue HOT 2
- Add Transparency Slider
- Add ability to edit style on layer page
- need a different way to handle polyfills HOT 2
- Do not add layer from url params twice
- Default config on maps/new has weird non-existent layer (no name)
- maps/new zooms out too far now
- layers button goes over navigation bar when scrolling HOT 2
- we should pass on all possible sources to the add layer dialog
- maps in EPSG:4326 don't work ok HOT 3
- PDF map that is generated is all black when in 3D mode HOT 4
- "Local Geoserver" returns /maps/[object Object]/geoserver/wms
- Can't view map template HOT 8
- Upgrade to Python 3
- Update dependencies HOT 1
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 geonode-client.