Skip to content

Commit

Permalink
fix image url errors in leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
Gooong committed Jul 23, 2018
1 parent d6407ba commit 3b160b6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion web/pgadmin/static/js/sqleditor/geometry_viewer.js
Expand Up @@ -4,23 +4,36 @@ import {Geometry} from 'wkx';
import {Buffer} from 'buffer';
import $ from 'jquery';
import L from 'leaflet';
import marker from 'leaflet/dist/images/marker-icon.png';
import marker2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
import layer from 'leaflet/dist/images/layers.png';
import layer2x from 'leaflet/dist/images/layers-2x.png';

import elementResizeDetectorMaker from 'element-resize-detector';


// fix the icon url issue according to https://github.com/PaulLeCam/react-leaflet/issues/255
marker,marker2x,markerShadow,layer,layer2x;


let GeometryViewer = {
'show_viewer':function (value) {
Alertify.mapDialog || Alertify.dialog('mapDialog',function(){
var $container = $('<div id="geometry-viewer-map" style="width: 100%; height: 100%"></div>');
var erd = elementResizeDetectorMaker();
var geometryLayer = L.geoJSON();
var geometryLayer = L.geoJSON();
var osmLayer = L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
});
var mymap;

return {
main:function(data){
let wkbBuffer = new Buffer(data, 'hex');
let geometry = Geometry.parse(wkbBuffer);
geometryLayer.clearLayers();
alert(JSON.stringify(geometry.toGeoJSON()));
geometryLayer.addData(geometry.toGeoJSON());
},
setup:function(){
Expand Down

0 comments on commit 3b160b6

Please sign in to comment.