Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
TileLayer.TileJSON: point radius in meters?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jack Michel  
View profile   Translate to Translated (View Original)
 More options May 26 2012, 7:35 am
From: Jack Michel <jackmichel6...@gmail.com>
Date: Sat, 26 May 2012 04:35:45 -0700 (PDT)
Local: Sat, May 26 2012 7:35 am
Subject: TileLayer.TileJSON: point radius in meters?

Hello!

I'm using the great TileLayer.TileJSON.js extention [1] for leafletjs.
I want to draw points on the map depending on the zoom level and with an
exactly size in meters.

Currently I use this style:

tile.styleFor = function (feature) {

>         var type = feature.geometry.type;
>         var styleColor = feature.properties.style.color;
>         switch (type) {
>             case 'Point':
>                 return {
>                     color: styleColor,
>                     radius: 3 // what's the unit?
>                 };

>         }
>     };

The radius value is used in the TileJSON.js the following:

g.arc(p.x, p.y, style.radius, 0, Math.PI * 2);


I'm wondering which unit is the radius value? Are these meters? If not, how
can I set this value to meters?
I'm using the default Openstreetmap projection.

Thank you for your help!

Best regards,
Jack

[1] https://gist.github.com/2479540


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diego Guidi  
View profile  
 More options May 26 2012, 8:37 am
From: Diego Guidi <diegogu...@gmail.com>
Date: Sat, 26 May 2012 14:37:20 +0200
Local: Sat, May 26 2012 8:37 am
Subject: Re: [Leaflet] TileLayer.TileJSON: point radius in meters?
> I'm using the great TileLayer.TileJSON.js extention [1] for leafletjs.

happy to read that you like it :)

> The radius value is used in the TileJSON.js the following:
>> g.arc(p.x, p.y, style.radius, 0, Math.PI * 2);
> I'm wondering which unit is the radius value? Are these meters? If not, how
> can I set this value to meters?
> I'm using the default Openstreetmap projection.

the unit here is in pixels, and is completely indipendent of
projection or even zoom factor.
If you want to draw a point that has a radius of 50 meters, you must
evaluate some points.
I'm not sure about this, so feel free to verify and to check better
what I write.
If you use spherical mercator projection (the same used by google and bing)
a pixel at the maximum zoom is a meter, so you simply must set radius
value as 50 / (2 * currentzoom).

Some useful references:
http://www.sharpgis.net/post/2007/05/spatial-references2c-coordinate-...
http://www.sharpgis.net/post/2007/07/The-Microsoft-Live-Maps-and-Goog...
http://msdn.microsoft.com/en-us/library/bb259689.aspx


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jack Michel  
View profile   Translate to Translated (View Original)
 More options May 27 2012, 5:46 am
From: Jack Michel <jackmichel6...@gmail.com>
Date: Sun, 27 May 2012 02:46:18 -0700 (PDT)
Local: Sun, May 27 2012 5:46 am
Subject: Re: [Leaflet] TileLayer.TileJSON: point radius in meters?

Hello Diego!

Am Samstag, 26. Mai 2012 14:37:20 UTC+2 schrieb Diego Guidi:

> If you use spherical mercator projection (the same used by google and
> bing)
> a pixel at the maximum zoom is a meter, so you simply must set radius
> value as 50 / (2 * currentzoom).

Do you mean with "currentzoom" the zoomlevel like 17? If so, the pixel
value for a 50m point would be 1,47.
I tried this, but comparing to the elements on my map (streets, buildings)
in zoom level 17, the point looks too small.

I found on the Openstreetmap wiki some information about "meters per pixel"
[1]. This document says that I have at zoom level 17 about 1,193 meter per
pixel. Therefore the radius value (in pixel) for a 50m point would be
(50m/1,193 pixel)/2 =  20.95

I'm not sure, if this is calculation is right. The point size on level 17
looks good, I think.
Is there a better - more scientific - solution?

[1] http://wiki.openstreetmap.org/wiki/Zoom_levels


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diego Guidi  
View profile   Translate to Translated (View Original)
 More options May 27 2012, 5:57 am
From: Diego Guidi <diegogu...@gmail.com>
Date: Sun, 27 May 2012 11:57:42 +0200
Local: Sun, May 27 2012 5:57 am
Subject: Re: [Leaflet] TileLayer.TileJSON: point radius in meters?
> I found on the Openstreetmap wiki some information about "meters per pixel"
> [1]. This document says that I have at zoom level 17 about 1,193 meter per
> pixel. Therefore the radius value (in pixel) for a 50m point would be
> (50m/1,193 pixel)/2 =  20.95

I'm sure this is right. Looks strange that a "actual" size in meters
of a pixel depends on current zoom, but maybe you can search for this
and other explainations also in google/openlayers forum.
Please share results of your experiments :)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »