Coder Social home page Coder Social logo

stefanocudini / leaflet-geojson-selector Goto Github PK

View Code? Open in Web Editor NEW
106.0 7.0 58.0 833 KB

Show GeoJSON Layer like as Interactive Menu List

Home Page: https://opengeo.tech/maps/leaflet-geojson-selector/

JavaScript 72.83% HTML 18.27% CSS 8.90%
geojson web-mapping leaflet vector-tiles

leaflet-geojson-selector's Issues

Persistent selection

I'm trying to use this plugin to implement polygon feature selection but I'm not sure if its possible just yet. Here's what I want to do...

Each feature and corresponding list element should either have default style, highlight style (when hovered over) or selected style (when clicked on). Selections could be exclusive (ie at most one feature selected at a time, clicking another feature de-selects any currently selected feature) or multiple (clicking toggles selection status).

I don't think this can be done with the current code base because the code only supports two styles, default and active, and I don't see how to extend this to selectable items. If I change the style of a selected feature on a click event it gets reset to default on mouseout events.

Is this possible now? Or is it worth implementing? I'm not much of a JS programmer but I'll do what I can....

demo broken

Hi Stefano,

Great work! The demo seems broken due to static file loading fail. Look forward to it. Thanks!

search input text

As a user, I would like to have a search input text on top of the country list

Key_on problem

Hi, I'm using json and folium for making a map of distribution. I'm fairly new to phyton and I don't understand the key_on parameter. Can you help me recognize it?

Search input box

Is possibile to have a search input for the points that I load from json?

How to make the table items clickable?

I've merged your code with some of my code, but some parts are being used as they were in the original. My question is about the table part of the code.

              geoList.on('selector:change', function(e) {

			var jsonObj = $.parseJSON( JSON.stringify(e.layers[0].feature.properties) );
			var html = 'Selection:<br /><table border="1">';
			$.each(jsonObj, function(key, value){
					html += '<tr>';
					html += '<td>' + key.replace(":", " ") + '</td>';
					html += '<td>' + value + '</td>';
					html += '</tr>';
			});
			html += '</table>';

			$('.selection').html(html);
		});

How can I make the table items clickable? I have a property inside my .geojson that I need to use at the end of an URL. Before knowing your selector, I was calling the property like this, just to give you an example:

function forEachFeature(feature, layer){
	popupContent = "<strong>Name</strong>: " + feature.properties.nome_area + "<br>" + 
	"<strong>City</strong>: " + feature.properties.munic + "<br>" +
	"<strong>Area</strong>: " + feature.properties.areaha + "<br>" +
	'<strong>Link for SIGEF consulting</strong>: ' +
	'<a href="https://sigef.incra.gov.br/geo/parcela/detalhe/' + feature.properties.parcela_co + '"' + ">" + "Click here" +  "</a>" + "<br>" +
	"<strong>Owners</strong>: " + feature.properties.BC5PROPRIE
	
	
	// Configuração do Popup
	if (feature.properties && feature.properties.popupContent) {
	popupContent += feature.properties.popupContent;
	}
	layer.bindPopup(popupContent);

The "feature.properties.parcela_co" is the property that I was talking about. Your function uses the same method to every property, so I can't apply in your table the same line I did in my code, because it will lead the client to inexistent links. Is there a way to solve this? Your selector is great, it is basically what I was trying to do, but I'm a jr. dev, so i'm having a hard time trying to understand the functions. The little I did, was using "console.log()" to see what each parameter was calling, but I still can't do the URL thing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.