gazetteerhk / census_explorer

Explore Hong Kong's neighborhoods through visualizations of census data
http://gazetteer.hk
MIT License
42 stars 12 forks source link

Get the leaflet map working with CAs #10

Closed hxu closed 10 years ago

hxu commented 10 years ago

Partially implemented in MapCtrl

2blam commented 10 years ago

I asked Land Survey students to get some idea about the coordinate system. I used another approach to generate the geojson. Please check https://github.com/2blam/HK-geojson The map can show constituency area in Hong Kong. When the mouse clicked on the polygon, it shows the corresponding CA names. @vincentlaucy see if it can help and put it to frontend

debuggingfuture commented 10 years ago

Thanks @2blam,

Example for ref: http://tombatossals.github.io/angular-leaflet-directive/examples/geojson-example.html

Ideally IMO we can reuse the same map, when click to DC we increase zoom level and polygons are drawn to geojson of CA inside. zoom out to draw DC again. which is more dynamic than http://www.census2011.gov.hk/en/constituency-area-cnw.html

On Tue, Jan 28, 2014 at 7:01 PM, 2blam notifications@github.com wrote:

I asked Land Survey students to get some idea about the coordinate system. I used another approach to generate the geojson. Please check https://github.com/2blam/HK-geojson The map can show constituency area in Hong Kong. When the mouse clicked on the polygon, it shows the corresponding CA names. @vincentlaucy https://github.com/vincentlaucysee if it can help and put it to frontend

Reply to this email directly or view it on GitHubhttps://github.com/hxu/hk_census_explorer/issues/10#issuecomment-33468766 .

hxu commented 10 years ago

Sounds like a good strategy to me. So to summarize:

However, once zoomed into the CA, I would say that you need at least one links next to the map: a Zoom out or Back link to return to the DC view.

The other link may be to Select all, if you wanted to select more than one CA, but it would actually be better if you could do this without zooming into the CA view at all.

Also, I think any implementation should allow toggling of selecting more than one CA. In some cases, we only want to be able to select one CA. In other cases, we may want to select more than one.

hxu commented 10 years ago

@vincentlaucy are you working on the maps tonight? If not, I will take a look at it in a bit.

debuggingfuture commented 10 years ago

Not working at it at the moment. Can see anything to help on sun Am 31.01.2014 19:25 schrieb "hxu" notifications@github.com:

@vincentlaucy https://github.com/vincentlaucy are you working on the maps tonight? If not, I will take a look at it in a bit.

Reply to this email directly or view it on GitHubhttps://github.com/hxu/hk_census_explorer/issues/10#issuecomment-33786784 .

hxu commented 10 years ago

OK, no worries, it's a holiday, people should be with their families :-).

Just thinking out loud as I work through this: Taking a look at the geojson files, it looks like we still need to do a few things:

Next, to implement the actual interface, I will make a directive for the map. Going to plan it out with a spec and tests first, but it should probably implement the following features:

debuggingfuture commented 10 years ago

@2blam did a simplification inside qgis and got a smaller geojson https://github.com/2blam/HK-geojson Am 31.01.2014 20:51 schrieb "hxu" notifications@github.com:

OK, no worries, it's a holiday, people should be with their families :-).

Just thinking out loud as I work through this: Taking a look at the geojson files, it looks like we still need to do a few things:

  • GeoJSON objects for district councils and constituency areas need their unique identifiers in their features hashes.
  • Can probably strip the rest of the properties from the featureshash, though at some point it may be useful to have the area and perimeters of each area.
  • GeoJSON files need to be smaller -- Constituency Areas file is currently 4MB. Should run it through TopoJSONhttp://bost.ocks.org/mike/simplify/

Next, to implement the actual interface, I will make a directive for the map. Going to plan it out with a spec and tests first, but it should probably implement the following features:

  • Click to select individual CAs
  • Ability to select all CAs within a district at once
  • Show CAs or Districts based on zoom? Not sure about this one yet
  • Different styling for selected vs. non-selected CAs
  • Needs two way binding outside of directive, so that other objects can detect which CAs are selected.

Reply to this email directly or view it on GitHubhttps://github.com/hxu/hk_census_explorer/issues/10#issuecomment-33791447 .

hxu commented 10 years ago

Ah okay, I remember now. Thanks for reminding me.

On Fri, Jan 31, 2014 at 8:59 PM, vincentlaucy notifications@github.comwrote:

@2blam did a simplification inside qgis and got a smaller geojson https://github.com/2blam/HK-geojson Am 31.01.2014 20:51 schrieb "hxu" notifications@github.com:

OK, no worries, it's a holiday, people should be with their families :-).

Just thinking out loud as I work through this: Taking a look at the geojson files, it looks like we still need to do a few things:

  • GeoJSON objects for district councils and constituency areas need their unique identifiers in their features hashes.
  • Can probably strip the rest of the properties from the featureshash, though at some point it may be useful to have the area and perimeters of each area.
  • GeoJSON files need to be smaller -- Constituency Areas file is currently 4MB. Should run it through TopoJSON< http://bost.ocks.org/mike/simplify/>

Next, to implement the actual interface, I will make a directive for the map. Going to plan it out with a spec and tests first, but it should probably implement the following features:

  • Click to select individual CAs
  • Ability to select all CAs within a district at once
  • Show CAs or Districts based on zoom? Not sure about this one yet
  • Different styling for selected vs. non-selected CAs
  • Needs two way binding outside of directive, so that other objects can detect which CAs are selected.

Reply to this email directly or view it on GitHub< https://github.com/hxu/hk_census_explorer/issues/10#issuecomment-33791447>

.

— Reply to this email directly or view it on GitHubhttps://github.com/hxu/hk_census_explorer/issues/10#issuecomment-33791842 .

hxu commented 10 years ago

Fixed by pull request