mapbox / geojson.io

A quick, simple tool for creating, viewing, and sharing spatial data
http://geojson.io/
ISC License
1.93k stars 576 forks source link

Copy shareable link #896

Open sancarn opened 4 months ago

sancarn commented 4 months ago

With small geojson layers the data can be included in the url as some base64-encoded string:

geojson.io/data=eyJ0eXBlIjoiRmVhdHVyZUNvbGxlY3Rpb24iLCJmZWF0dXJlcyI6W3sidHlwZSI6IkZlYXR1cmUiLCJwcm9wZXJ0aWVzIjp7fSwiZ2VvbWV0cnkiOnsiY29vcmRpbmF0ZXMiOlstMS4yODM3NTY2ODY1MzQxODk4LDUyLjI4Mzc5NDU1OTAwMDU3XSwidHlwZSI6IlBvaW50In19LHsidHlwZSI6IkZlYXR1cmUiLCJwcm9wZXJ0aWVzIjp7fSwiZ2VvbWV0cnkiOnsiY29vcmRpbmF0ZXMiOlstMS4yNjgzNDA3ODE5NDA2NTExLDUyLjI5NDU4MTM4NTg0OTYyNV0sInR5cGUiOiJQb2ludCJ9fSx7InR5cGUiOiJGZWF0dXJlIiwicHJvcGVydGllcyI6e30sImdlb21ldHJ5Ijp7ImNvb3JkaW5hdGVzIjpbWy0xLjI1NDIwOTUzNzMzNzk5OTMsNTIuMjk0MzY3MTAyOTk0Mzg2XSxbLTEuMjU5ODc3NDQ3ODc4Mjk1Nyw1Mi4yODMzODU2Mjc3NTE1XSxbLTEuMjgwNTQ4Nzc0NDkwMzcsNTIuMjgxMzEzNjY1NzI4MzM0XSxbLTEuMjc5NzY3NzYwMzgzOTQ3NSw1Mi4yNzMzNDc1NDMxOTI2N11dLCJ0eXBlIjoiTGluZVN0cmluZyJ9fV19

Alternatively could use jsonurl:

geojson.io/data=(type:FeatureCollection,features:((type:Feature,properties:(),geometry:(coordinates:(-1.2837566865341898,52.28379455900057),type:Point)),(type:Feature,properties:(),geometry:(coordinates:(-1.2683407819406511,52.294581385849625),type:Point)),(type:Feature,properties:(),geometry:(coordinates:((-1.2542095373379993,52.294367102994386),(-1.2598774478782957,52.2833856277515),(-1.28054877449037,52.281313665728334),(-1.2797677603839475,52.27334754319267)),type:LineString))))

Or perhaps better still would be encoding as Proto Buffers as these will be significantly smaller urls

sancarn commented 4 months ago

Oops, I've just spotted this is already half implemented in the API section. Just a clickable "share" button would need adding to the UI