During this week I was basically working on visualizing GIS data over a base layer from OpenStreetMaps. Visualizing GIS data this way makes sense only for the data that relates to earth's geography. With each piece of GIS data, MySQL allows you to store a Spatial Reference ID (SRID) which specifies spatial reference systems that relates to the stored data. Hence that need to be taken into consideration when visualizing GIS data.
Going through the documentation of OpenStreetMaps I identified that OpenLayers JavaScript library is an ideal candidate for our purpose. OpenLayers not only support layers from OpanLayers, but it can use data from various sources such as Google Maps, Google Earth, Virtual Earth, Yahoo Maps etc. Further you can add a vector layer on top of these maps which can then be used to draw standard geometric objects (points, linestrings, polygons). I added Mapnik, Osmarender and CycleMap layers which retrieves up to date data from OpenStreetMaps for display purpose.
I extended the PHP classes I created earlier to support the visualization with OpenStreetMaps. These classes generate the JavaScript code that relates to the geometric objects drawn on the vector layer. I also modified some of the code to take SRID into consideration as it is very important is visualizing data related to earth's geography.
When it comes to using different spatial reference systems, it is important to bring them to a unified reference system for visualization purposes. OpenLayers use proj4js JavaScript library to convert coordinates from one spatial reference system to another. I also used the same and now even the data in the same table which corresponds to different spatial reference systems are brought to a common one (EPSG:900913) for visualization purpose.
During this week I managed to get 'visualizing GIS data with OpenStreetMaps' feature up and running. However a lot more needs to be done to bring it up to the standard. Tooltips, proper initial placing and zooming levels, more options for base layers being few of them. So I will be doing those during the next week.
No comments:
Post a Comment