Posts Tagged ‘javascript’

Google Maps API for Flash

Wednesday, May 21st, 2008

Reprinted from The Map Room blog (original post here). The Google Maps API now has a Flash version, alongside its regular JavaScript and static versions. On the Google Maps API blog, Mike Jones writes:

So, what do I like about the API for Flash? Smoothness and speed are a big part of it. We’ve designed it so that Flash graphics can be used for each tile layer, marker and info window — opening up possibilities like dynamic shading, shadowing, animation, and video. When the user zooms the map, magnification changes happen smoothly and place names fade in. After the user drags a marker, it gently bounces to a halt. Generally, Flash allows for much greater embellishment, and, well … “flashiness.” I get excited just thinking about the creative ways developers might take advantage of having a Flash API for Google Maps.

See also Google LatLong. Apparently the idea is to embed this in Flash-based applications.

10 Examples Using The New Google Maps API For Flash

Wednesday, May 21st, 2008

Reprinted from Flash Speaks ActionScript (original post here).

These examples are from the API tutorials from Google.  Until now Google Maps via the Flash platform hasn’t been available unless you’ve been using the the UMAP component from AFComponents. As you may have heard, Google has opened up its API to the Flash and Flex community. This is huge as it offers more possibilities for Rich Interactive Applications and Google Maps. To find more info on Google Maps for Flash, check out Google’s official blog.

Check out the these examples using the new Google Maps for Flash API:

google_maps_example
Video Sync Map
A map pans and updates while a synchronized video shows footage from the city highlighted on the map.

 

Custom Local Searcher

 

Local Searcher
Displays a Flex UI with ComboBox, Button, and TextField that are used to perform a local search with the AJAX Local Search API.

campus map

Custom Campus Map
Creates a custom map by extending TileLayerBase to load in USC image tiles.

geo_map
Form Geocoding
Shows how to take a user-entered address from a Flex TextField, geocode it, and display the result as a map marker.

control options
Control Options
Shows how to customize the display of MapTypeControl and OverviewMapControl using their associated options classes.

draggable marker
Draggable Marker
Shows how to create a draggable marker and respond to its dragstart and dragend events.

custom tiles map
Custom Tiles Map
Creates a custom map that displays tiles that are actually Sprites displaying information about the tile x/y/z.

texture zoom
TextualZoom Control
Shows how to extend ControlBase to create a custom control with buttons for zooming in and zooming out.

encodded polyline
Encoded Polyline
Shows how to create a Polyline from an encoded points and encoded levels string.

flip map

Photo Flip Map
Locations in Las Vegas are plotted on the map with a small photo showing up inline; the view can be “flipped” to show a larger photo without the map. 

You can check the rest of the demos at the Google Maps API for Flash Demo Gallery.

Here’s a Quick Question:
Who will build the first feature-rich Google Maps AIR application? I’d love to see one or two!

ESRI to also support Flash interface

Monday, May 12th, 2008

Why are mashups via ESRI important? It will allow cartographers to create custom maps with our own look-and-feel, with thematic data, and still be fully enabled with the “mashup” web 2.0 mentality using APIs similar to those from Google and Yahoo.

The earlier post mentions a REST javascript API for interfacing with the Arc Server to create mashups. That’s true in the first release, but a followup release will allow Flash / Flex integration as well. 

Read more from flex888.com and see an example

More info on the REST api from mandownnz.com.

Newsflash! ESRI to best Google Maps with Mashup Capability

Monday, May 12th, 2008

(Reprinted from flex888.com. View original post.)

Finally, GeoWeb is Complete and Born

Posted by Moxie | March 19, 2008 .

What’s is the best RIA application ever created? If your answer is something aroundFlex or Flash, then it’ll be wrong answer. The right answer is Google Map. It’s Google Map makes AJAX known and RIA a reality. Google even goes above and beyond claimed the term “GeoWeb“. However, up till now, Google Map is still just the best client, the visualization end, of GeoWeb. The “Geo” part of GeoWeb was missing.

Yesterday, ESRI, the shy, but true and real “Geo” dude behind all, I mean ALL, the web map buzz and technologies, released its very own JavaScript API and REST based Geo Process services to the world. The GeoWeb is finally complete and born.

The JavaScript API has three parts, the ESRI JavaScript API, the Google Map extension, the Virtual Earth extension. That means you can use the top three GeoWeb clients with this simple API to do the real “Geo” things.

What is the “Geo” things and why it’s a big deal to GeoWeb?

Well, everyone and his/her grandma knows what Google Map does, plans the trip and shows locations. What’s the most mashed up platform? Google Map. What 99% Google Map mashup applications do? Put pins (markers) on the map? But what if we want to ask some questions beyond the pushpins:

  • Within 5 minutes driving time, show me the areas that I can reach. Don’t fool me with a circle. That is cheating. Because there might be highway, service street, or river among the 5 minutes driving range. The area you can cover by driving is a irregular polygon. But how do you get that polygon drawn on the map to show the 5 minute driving range?
  • Three of my friends want to meet for lunch. We want to meet at a Starbucks where everybody has the least driving time to get there. Fair enough? But how do you quickly give me that Starbucks location and provide driving direction for each of us.

The questions can go on and on. How these questions are answered? Through a thing called Geoprocessing, which is provided by the technology called GIS (geographic information system). But why you’ve never heard of it and it’s not well known in the Web 2.0 space? That’s because it’s a very hard nut to crack and only a few dudes know how to do it inside out. ESRI is the one does it the best, and now, it gets everything figured it out. The whole web can have it.

If I tell you, with three lines of JavaScript codes, plus some regular JavaScript programming you can easily answer the above question visually on either ESRI map, Google Map or Earth Map. Do you believe me?

You don’t have to because I’ll show you how.

First Line:

    var map = new esri.Map(“mapDiv”, { extent: startExtent });

Looks familiar, isn’t it. Indeed, it’s just like Google Map or Virtual Earth API.

Second Line:

    var streetMap = new esri.layers.ArcGISTiledMapServiceLayer
(“http://server.arcgisonline.com/ArcGIS/rest/services/
ESRI_StreetMap_World_2D/MapServer”);

Something new here. Well, if you head to ArcGIS Online, a free gwoweb resource from ESRI, you would find out there are lots of good free base maps you can choose. Or, you can use any map published to a ArcGIS Server. It’s long story here for those map publishing goodies, I’ll tell you later, piece by piece. But just you know this line of code gives you a whole big world of maps to works with. Just remembering that is enough for now.

Third Line:

var gp = new esri.tasks.Geoprocessor
(“http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Network/ESRI_DriveTime_US/ GPServer/CreateDriveTimePolygons”);

This is “Geo” part of the GeoWeb. One line, it consumes a geoprocess, in this case, a services called CreateDriveTimePolygons. This geoprocess called is actually via REST API (as the URL reveals) . The returned result can be in JSON, KML or XML. That means you really don’t have to use this JavaScript API. As matter of fact, I do have Perl or PHPexamples consume the very same gepprocess, but that’ll be another post.

The rest code is really just parse the result and draw the polygon on the map. If you know Google Map API, there are no surprises there.

The following is the true GeoWeb application I’ve introduced to you. You can zoom in to any city just like you would do with gmap (scrolling mouse, drag the map, etc.). Then click the map. The 1, 3 and 5 minutes driving time polygon will be shown.

Click Here to Run the Application (view source for detail code).

I will post another example to solve that other problem using Flex. Stay tuned.

Take Control of Your Maps (A List Apart)

Monday, May 12th, 2008

(Reprinted from A List Apart. Thanks Peter! Paul Smith is is a co-founder and developer at EveryBlock, see this blog post. He has been creating sites and applications on the Web since 1994. He’s also co-creator of the Election Day Advent Calendar, and a founding member of Friends of the Bloomingdale Trail. He lives in Chicago, Illinois.)

by PAUL SMITH

map a list apart

We live in the era of Google Maps. What started off as an impressive refresh of Mapquest-style maps now fuels web mashups. With APIs official and unofficial, Google Maps is simple enough for front-end designers to embed and for back-end programmers to target. Along the way to becoming nearly ubiquitous, it has played a major role in the “democratization of mapping.” For the practical developer who wants to add geospatial information to a site or application, the Google Maps API has been an easy call.

But, perhaps no longer. As websites mature and the demand for geographic applications grow, the old mashup arrangement is starting to chafe. Mapping components are more and more vital, and so we demand greater control, expressiveness, and functionality from them.

Fortunately, as in many aspects of internet technology, an ecology of open source online mapping tools has emerged alongside the market leader. It is now possible to replicate Google Maps’ functionality with open source software and produce high-quality mapping applications tailored to our design goals. The question becomes, then, how?

Continue reading how to create a custom web map . . .

– And skipping right to the conclusion –

Conclusion

One of the great things about online mapping is that it straddles the line between the artistry and communication of cartography, and the precision and programmability of GIS. You can produce great-looking maps that are highly functional and integrate smoothly with your application. It’s my hope that this article demystified the web map stack and will get you thinking about how you can take control of the maps in your site.

RESOURCES/EXTERNAL LINKS

There are many open source projects related to online mapping and GIS. This article touched on these:

In addition, just to name a few: Modest Maps and Mapstraction are browser UI libraries similar to OpenLayers, in Flash and JavaScript, respectively. GeoServer and MapServer are alternatives to Mapnik in the map rendering department. You owe it to yourself to investigate these alternatives, as they each excel in different ways and one may meet your needs better than the others.

Flash Wars: Adobe in the History and Future of Flash

Monday, May 12th, 2008

AppleInsider.com’s Prince McLean produced a three part series earlier this month on the Flash Wars.

Direct links to Part 1Part 2, and Part 3.

(Reprinted from AppleInsider) 

Pitted against Microsoft’s efforts to crush Flash using its own copycat Silverlight platform, open source projects seeking to duplicate Flash for free, and Apple’s efforts to create a mobile platform wholly free of any trace of Flash, Adobe has scrambled to announce efforts to make Flash a public specification in the Open Screen Project.

Will it help get Flash on the iPhone? Here’s the first segment of a three part series with a historical overview of the wars between Flash and Adobe, Microsoft, Sun, Apple, Google, and the open source community, the problems Flash faces today, and what future Flash can hope for as an open specification.

A Brief History of Flash

Flash originated at FutureWave Software as SmartSketch, an innovative drawing tool. In 1995, the software was repositioned as FutureSplash Animator, with support for cell based animation. It was pitched as a way to quickly draw and animate vector-based graphics for efficient delivery over the web, as a direct challenge to Macromedia’s heavier and more complex Authorware and its Director-created Shockwave content.

FutureWave pitched the product to Adobe, but it was Macromedia that bought it in 1996, hoping to integrate it as an approachable, entry level member of its content production tools as the company’s business was rapidly pushed from CD-ROM oriented products to the web. Macromedia abbreviated the name from FutureSplash to Flash.

It turned out that the easy to use Flash rapidly sidelined Macromedia’s existing Authorware and Shockwave. Flash made it easy for designers to create interactive content with only minimal development knowledge. The real break for Flash came when Macromedia lined up a bundling agreement with Microsoft’s Internet Explorer 5, which resulted in the Flash player software being widely distributed.

While Microsoft embraced Flash, it actively worked in parallel to stop Sun’s Java and Netscape’s web browser as threats to Windows. Microsoft’s efforts to sideline Java into a Windows programming language and its strategy to embrace and extend standards-based, platform agnostic HTML into web pages that only worked in Internet Explorer gave Macromedia’s Flash fertile ground to grow as a quick and simple alternative to the more complex and resource intensive Java as a way to create simple, interactive applets on the web.

Adobe Hates, Then Buys Flash

Adobe purchased Macromedia in 2005 largely to obtain Flash, the crown jewel of Macromedia’s web development tool assets. Prior to owning it, Adobe unsuccessfully worked hard to kill it as a competing product.

In 1998, when Macromedia and Microsoft submitted VML to the W3C as a potential web standard for vector graphics (based on Microsoft’s RTF), Adobe teamed up with Sun to push the rival PGML specification (based on Adobe’s PostScript). The W3C developed a new standard that drew from both, called SVG (Scalable Vector Graphics).

Adobe pushed SVG as a competitor to Flash right up until it bought Flash, distributing the Adobe SVG Player as a free web plugin. Microsoft continued to push its own VML, which it built into Internet Explorer. This prevented either VML or SVG from making much progress, as other browsers didn’t support VML, while the SVG open standard saw little adoption given Adobe’s weak presence in web development tools. That let Flash easily win out over both as the way to develop and present animated vector graphics on the web.

Flash continued to develop at Macromedia, gaining a scripting language based on JavaScript and other features that turned it into a full presentation development tool rather than just a way to distribute small interactive graphics. Macromedia even took swipes back at Adobe, introducing FlashPaper as an alternative to Adobe’s PDF as a way to distribute electronic documents in the Flash format.

After buying Flash, Adobe gave up support for its own weak SVG Player rival and has apparently discarded FlashPaper as a PDF competitor. However, the rest of the industry has plenty of reasons to still hate Flash, as will be presented in part two: The Many Enemies and Obstacles of Flash.

Continue reading on AppleInsider.com . . . 

Script: Find and Replace Graphics version 2

Wednesday, April 2nd, 2008

ai cs3 logoToday’s script installment is Find and Replace Graphics version 2.

Download script (13k file size).

Please give this script a whirl. Email me with bugs or feature enhancements.

find and replace graphics version 2 demo movie screenshot

Watch a movie demo of the script with voiceover! (2.2 mb)

Important Enhancements:

  1. The find-replace objects now remain on their original layer. No more error alerts about locked layers.
  2. The find-replace object are now in the same z-stacking (object stacking) order as the original.
  3. "Replacing" master object is now deleted once it has replaced all the find objects. Turn this off by changing line 43: var deleteReplaceWithObj = false;
  4. Centered, non-scaled XY placement is default.
  5. If non-proportional scaling is desired change line 37 to: var scaledObject = true;

Future Work:

  1. Proportional scaling in X, Y, or weighted XY that is still centered on the original object’s center point.

To install new scripts you need to:

  • Quit Illustrator
  • Copy the files into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

Script: Make Point Type version 3

Tuesday, April 1st, 2008

ai cs3 logoToday’s script installment is Make Point Type version 3. Version 2 was never released widely.

Download script (10k file size).

Please give this script a whirl. Email me with bugs or feature enhancements.

make point type demo movie image

Watch a movie demo of the script with voiceover! (2.1 mb)

Important Enhancements:

  1. The text objects now remains on their parent layer that it was found in. No more error alerts about locked layers.
  2. The type is EXACTLY in the same X-Y position it was as area type. No more small jump in Y layout.
  3. Rotated type is fully supported, even upside down type (must be a rectangular area).
  4. Type on a path now reflects the original XY position and the former curve is approximated with rotation.
  5. Type on a path conversion can be turned on by changing line 19 to true: var convertPathType = true;

Continuing Issues:

  1. In some rare cases the type will be flipped 180° (upside down).

To install new scripts you need to:

  • Quit Illustrator
  • Copy the files into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

“Find and Replace” JavaScript Bug Workaround

Thursday, November 15th, 2007

My most popular script for Adobe Illustrator is “Find and Replace Graphics”. This script is useful if you have generic path objects that you need to switch to another shape, or replace with a proper symbol. Most of the time this script works but occasionally it errors out saying a group cannot be moved, the end.

findreplacebefore.pngfindreplacecentered.png

If you are getting this error, you can either (a) unlock the top-most layer in your document and try again, or (b) copy and paste the subject objects into a new document, run the script there, and then copy-paste them back to your original document.

The bug is related to the fact the script is rather dumb about layer detection. In fact, you’ll notice it moves all your objects off their original layer and onto the bottom-most layer in the document.

A forthcoming update will fix this underlying object-layer problem, and the locked-layer bug.

New site, new look

Sunday, November 4th, 2007

In October, I attended the annual NACIS map conference in St. Louis, MO and demonstrated how Adobe Illustrator can be automated via JavaScripting. This can be especially useful for those needing to expand Illustrator’s default capabilities or make Illustrator behave more like the venerable Freehand (may it rest in peace). I created this website to host that presentation, and to capture some of my other projects. Last week Mordy Golding at his Real World Illustrator blog promoted my site and wow, traffic is up. So here’s a new look for a more integrated site.