Code Monkey home page Code Monkey logo

Comments (16)

billthefarmer avatar billthefarmer commented on August 22, 2024

That's another good idea, I've tried it, it works. There is a potential pitfall with co-ordinate syntax, the convention in English is to use [xx.xxx,xx.xx] for co-ordinates, with a comma in the middle. I noticed that you have used [xx,xxx;xx,xxx], with a semicolon in the middle. So I have made it accept any combination. I would have missed that and had to fix it later. OpenStreetMap use the English convention, the embedded HTML is

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" 
src="http://www.openstreetmap.org/export/embed.html?bbox=3.1510806083679204%2C42.257412405489184%2C3.186914920806885%2C42.27211695157111&amp;layer=mapnik" style="border: 1px solid black"></iframe><br/>
<small><a href="http://www.openstreetmap.org/#map=16/42.2648/3.1690">View Larger Map</a></small>

That, and using image syntax for media will be in the next version.

from diary.

marcoM32 avatar marcoM32 commented on August 22, 2024

Very well, thanks!!!!!

from diary.

billthefarmer avatar billthefarmer commented on August 22, 2024

I think we've broken new ground here. I searched online for markdown map syntax and couldn't find anything. It does seem the convention however to put almost anything markdown in square brackets.

from diary.

marcoM32 avatar marcoM32 commented on August 22, 2024

Very good implementation!

from diary.

gilcot avatar gilcot commented on August 22, 2024

I'm not sure, it's not BBCode...

It does seem the convention however to put almost anything markdown in square brackets.

Links use both square brackets and parentheses, or only those latest. I mean [Bill's diary](https://github.com/billthefarmer/diary/) to make the text a clicable link Bill's diary.
But only (https://github.com/billthefarmer/diary/) to juste put the link as text for the link, like [https://github.com/billthefarmer/diary/](https://github.com/billthefarmer/diary/)
Both result to: https://github.com/billthefarmer/diary/ as link.

Medias are some special case where the link's ressource may be rendered (text browsers don't do it) ! Those special cases are indicated in Markdown with the exclamation mark prefix... E.g.
![Bill's diary](https://github.com/billthefarmer/diary/raw/master/src/main/res/drawable-mdpi/ic_launcher.png) for Bill's diary
The text part here, between square brakets, is not mandatory (but it's usefull within text browsers and when one disable media processing with graphical agents --yes, some people do it...) However, the square brackets are requiered (empty then) with the exclamation mark: ![](https://github.com/billthefarmer/diary/raw/master/src/main/res/drawable-mdpi/ic_launcher.png) produce visualy the same effect
Well, notice that Markdown use the same syntax and process the media type according to the file extension (in fact, it's an extension of next flavors ; original format knows only images) ...Whereas HTML has many tags: <img src... alt... />, <audio><source src... />...</audio>, <video><source src... />...</video>, <applet code...>...</applet> They're for popular entertainement media types and there's a generic tag <object data...>...</object> It can be used in place of others (like the MD common syntax) or combined with'em, and is similar (but richer) to <a href...>...</a>

Why am I making this laius? In fact, <iframe src...>...</iframe> (wich may be replaced by <object data...>...</object> or by the past <embed src...>...</embed> with Netscape) and <canvas></canvas> in the way do the the samething: hold a place where a specific content (an embended HTML page) is rendered. So I think a very similar syntax should be used, with the geo-URI scheme: ![my place](geo:45.xxx,7.xxx)
Now, as not everybody wouldn't render it the same way (some may like to use RDF or microFormat and other may like to display an iframe from OSM or GMD/GMN whereas some may have some other processing or use some other webservice) So it's better to have a simple setting for that :D It should be a text box where one put the desired call with the parameters (e.g. $N starting from zero.) Of course, when empty, you may default to:

<iframe width="$ScreenWidth" height="$ratio" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" 
src="http://www.openstreetmap.org/export/embed.html?bbox=$1%2C$2%2C3$1%2C$2&amp;layer=mapnik" style="border: 1px solid black"></iframe><br/>
<small><a href="http://www.openstreetmap.org/#map=16/$2/$1">$0</a></small>

Also note that, the default should ajust to the screen size...

That's all for my thoughts on that question.
Best regards

from diary.

billthefarmer avatar billthefarmer commented on August 22, 2024

I obviously didn't search for the right thing, I've never heard of a geo uri. Having already implemented it using [<lat>,<lng>] or [osm:<lat>,<lng>], I can't remove it. Also it allows for alternative embedded map sources. I could implement [wherever](geo:<lat>,<lng>] as alternative syntax.

from diary.

gilcot avatar gilcot commented on August 22, 2024

No worry, they're many many uri scheme people don't know, and to look for the right one one have to notice that it may be an URL what is not obvious. 😃

[osm:<lat>,<lon>] is good even if not derivated like [geo:osm=](http://wiki.openstreetmap.org/wiki/Key:url)
But [<lat>,<lon>] may become problematic for people that use as ponctuation or math symbole in their writings. 😶

By now, how does alternative map source works?

from diary.

billthefarmer avatar billthefarmer commented on August 22, 2024

I know you can embed Google maps in web pages, I haven't looked into it. There are others as well. I was thinking that I could use something like [glm:<lat>,<lng>] for google maps, or whatever the convention is, if there is one. But using a geo uri opens the possibility of receiving one from another app and putting a map in a diary page, which I also hadn't thought of. I was thinking to convert [<lat>,<lng>] or [osm:<lat>,<lng>] to ![](geo:<lat>,<lng>) in the diary entry, and then convert that to the <iframe> on it's way to the markdown view, as I am doing now. What I haven't thought of yet is how to indicate which map you would like in the geo uri markdown. And also does a geo uri use locale syntax for numbers, or is it fixed at geo:yy.yyy,xx.xxx, not geo:yy,yyy;xx,xxx in some locales.

from diary.

gilcot avatar gilcot commented on August 22, 2024

Hello Bill,

The geo URI scheme is well sumarized by Wikipedia article. Numbers are representated as decimals used to be in C (i.e. with dot and no hundred separators), and the coma is used to separe coordinates provided in the order lat,lng,alt (with that later optional). There are other possible parameters and they separated by semicolon, and coordinates always come first...

  • geo:48.858222,2.2945 is just the Eiffel Tower in France
  • geo:48.858222,2.2945,149.23 should be it's 2nd floor/level (at 115.73m from the local ground but 149.23m above sea level)
  • geo:48.858222,2.2945,357.5;u=10 should be ten meters around the antena...

Edit: values in example picked from this Wikipedian media

from diary.

gilcot avatar gilcot commented on August 22, 2024

About indicating wich map to use, I think it should be a preference setting (users rarely need to change from post/day to post/day and often want they choice to apply everywhere) But they are many services and other may appear in the future (and some people may use their own or some less known one.) That's why I suggested to let them give a parameterized string to apply ;)

geo.md

from diary.

billthefarmer avatar billthefarmer commented on August 22, 2024

Ok, I have implemented both types of markdown syntax. [osm:<lat>,<lng>] or [<lat>,<lng>] will get converted to [osm](geo:<lat>,<lng>) while you weren't looking and display a map. Geo Uris received from other apps will put a map in the diary entry. The only way I have found to do this is from openstreetmap in a browser. Everything else I tried sends a link to their web site.

from diary.

billthefarmer avatar billthefarmer commented on August 22, 2024

The only other map I have found which is completely free is OpenSeaMap, and their iframe API doesn't work. The docs page is suspiciously nearly identical to the OpenStreetMap docs. Google Maps need an API key.

from diary.

gilcot avatar gilcot commented on August 22, 2024

hehe geo uri is vendor neutral. I test this kind of link on a rooted smartphone with an OSM based app and the app was lauched. On my current smartphone with GoogleMaps (and all Google Services) installed, the same link lauch GM. Same link in Firefox at home open an app that was registred to run such scheme. But with same version of Firefox at work, it just say it doesn't know how to handle that protocol.

Now, regarding iframes, I never tryed the API but some kinda direct integration by the past. Of course one have to play with various parameters to found the good ones (those that show the desired result on their site: iframe is just to display this external page in a view port)

from diary.

gilcot avatar gilcot commented on August 22, 2024

However, there's no problem if this application uses OSM with [osm:<lat>,<lng>] and ![blah](geo:<lat>,<lng>) (of course [blah](geo:<lat>,<lng>) should just become a link) Without extra settings in preference, this application cannot handle many cases, and OSM is the simpliest and the easiest way to go for an OpenSource code.

from diary.

billthefarmer avatar billthefarmer commented on August 22, 2024

I tried playing with the Google Maps iframe as per your second link, as soon as you change anything it gets refused. I assumed there was a checksum or something to force you to use their official API. I put 'osm' in the link because I am only using OpenStreetMap maps.

from diary.

gilcot avatar gilcot commented on August 22, 2024

You may be right: a checksum (or some checking parameter that missmatch) It's a pitty they force people to use their API but that's the way proprietary things go (they want to track everybody weird)

from diary.

Related Issues (20)

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.