Version 38 (modified by 11 years ago) ( diff ) | ,
---|
Introduction
This is a central location for users to share useful code samples for MapGuide, be they JavaScript, .Net, PHP, Java, or something entirely new...
Code Samples
JavaScript
- Hooking to events in the AJAX viewer
- Initial Task to invoke command on viewer startup
- Displaying custom cursors when the zoom tool is selected
- Displaying a watermark over the map in the AJAX viewer
- Display Mapguide Maps using OpenLayers
- Tweak of how 'Zoom to Rectangle' works
ASP.Net
- Building your own custom mapagent handler
- Dennis' Scribble Application
- Creating Temporary Markups
- ASP.net Development FAQ
.NET
- TF.NET Reader/Writer for MapGuide geometries
- MapGuide Maestro, MapGuide .Net API and Administrative GUI
PHP
- Calculating meters-per-unit for a map
- Dynamically setting initial map position and scale
- Dynamically adding a layer to the initial map
- General Tasks example - Markup, Theme, and Query
- Using MapGuide's Custom Aggregate Functions
- pgRouting example
- Modify MgMap properties
Java
Fusion
Tiled Maps
- Serving Mapguide map Tiles directly via Apache
- Client side tool for Seeding all Tiles in a tiled map
Other
Creating New Pages
Page Title
When creating a new page, please use the following convention for the page location:
CodeSamples/TechnologyType/YourPageName
for example: CodeSamples/JavaScript/AJAXViewerEventHooking
This is to ensure that pages are easily found via the TitleIndex, and may allow for an automated index at some point.
You can easily do this by editing the the CodeSamples page, copying another entry, and then modifying it to fit your title. Once you have saved the page, you will have a handy link to follow to edit your own sample.
Header Section
Please include the following on every Code Sample page. It allows users to easily navigate the page, and if they come in off a search engine link they can get to the code samples index more easily.
[[PageOutline]] This page is one of the !MapGuide Community CodeSamples. Visit the CodeSamples page to view more!
Syntax Highlighting
Trac has some really cool syntax highlighting built into it. The MapGuide Trac doesn't have all of these set up, but at least the text/html one works, and does a reasonable job with both HTML and JS. For example:
<script type="text/javascript"> // Map loaded handler function OnMapInitialized() { // Map has been initialized now we're off to the races. alert("Map has been initialized"); } </script>
Please use this where possible to make your inline examples more readable.